From afaa0f3afd5744aec04bdc9d2e845d797570a470 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 29 May 2024 18:47:37 -0400 Subject: [PATCH] docs: Install man pages as html This will let us link to them from the docs. --- .gitlab-ci.yml | 1 + docs/reference/gtk/gtk4.toml.in | 1 + docs/reference/gtk/meson.build | 81 +++++++++++++++++++++------------ docs/reference/gtk/tools.md | 18 ++++++++ 4 files changed, 72 insertions(+), 29 deletions(-) create mode 100644 docs/reference/gtk/tools.md diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 56a43c2434..df48c2673a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -459,6 +459,7 @@ reference: - mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/ - mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/ - mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/ + - mv _build/docs/reference/gtk/*.html _reference/gtk4/ - mv _build/subprojects/pango/docs/Pango/ _reference/Pango/ - mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/ - mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/ diff --git a/docs/reference/gtk/gtk4.toml.in b/docs/reference/gtk/gtk4.toml.in index 5c2362fe88..dd38a06bfc 100644 --- a/docs/reference/gtk/gtk4.toml.in +++ b/docs/reference/gtk/gtk4.toml.in @@ -82,6 +82,7 @@ content_files = [ "wayland.md", "windows.md", "x11.md", + "tools.md", "visual_index.md", ] content_images = [ diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build index dd598f4240..b6f64034b3 100644 --- a/docs/reference/gtk/meson.build +++ b/docs/reference/gtk/meson.build @@ -25,7 +25,8 @@ expand_content_md_files = [ 'section-tree-widget.md', 'section-list-widget.md', 'question_index.md', - 'visual_index.md' + 'visual_index.md', + 'tools.md', ] gtk_images = [] @@ -60,39 +61,39 @@ if get_option('documentation') build_by_default: true, install: true, install_dir: docs_dir, + install_tag: 'doc', ) endif -rst2man = find_program('rst2man', 'rst2man.py', required: false) -if get_option('man-pages') and not rst2man.found() - error('No rst2man found, but man pages were explicitly enabled') +rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages')) +rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation')) + +rst_files = [ + [ 'gtk4-broadwayd', '1' ], + [ 'gtk4-builder-tool', '1' ], + [ 'gtk4-encode-symbolic-svg', '1', ], + [ 'gtk4-launch', '1', ], + [ 'gtk4-query-settings', '1', ], + [ 'gtk4-rendernode-tool', '1' ], + [ 'gtk4-update-icon-cache', '1', ], + [ 'gtk4-path-tool', '1', ], +] + +if get_option('build-demos') + rst_files += [ + [ 'gtk4-demo', '1', ], + [ 'gtk4-demo-application', '1', ], + [ 'gtk4-widget-factory', '1', ], + [ 'gtk4-icon-browser', '1', ], + [ 'gtk4-node-editor', '1', ], + ] endif -if get_option('man-pages') and rst2man.found() - rst_files = [ - [ 'gtk4-broadwayd', '1' ], - [ 'gtk4-builder-tool', '1' ], - [ 'gtk4-encode-symbolic-svg', '1', ], - [ 'gtk4-launch', '1', ], - [ 'gtk4-query-settings', '1', ], - [ 'gtk4-rendernode-tool', '1' ], - [ 'gtk4-update-icon-cache', '1', ], - [ 'gtk4-path-tool', '1', ], - ] +rst2x_flags = [ + '--syntax-highlight=none', +] - if get_option('build-demos') - rst_files += [ - [ 'gtk4-demo', '1', ], - [ 'gtk4-demo-application', '1', ], - [ 'gtk4-widget-factory', '1', ], - [ 'gtk4-icon-browser', '1', ], - [ 'gtk4-node-editor', '1', ], - ] - endif - - rst2man_flags = [ - '--syntax-highlight=none', - ] +if get_option('man-pages') foreach rst: rst_files man_name = rst[0] @@ -103,12 +104,34 @@ if get_option('man-pages') and rst2man.found() output: '@0@.@1@'.format(man_name, man_section), command: [ rst2man, - rst2man_flags, + rst2x_flags, '@INPUT@', ], capture: true, install: true, install_dir: get_option('mandir') / 'man@0@'.format(man_section), + install_tag: 'doc', + ) + endforeach +endif + +if get_option('documentation') + + foreach rst: rst_files + man_name = rst[0] + + custom_target( + input: '@0@.rst'.format(man_name), + output: '@0@.html'.format(man_name), + command: [ + rst2html5, + rst2x_flags, + '@INPUT@', + ], + capture: true, + install: true, + install_dir: docs_dir / 'gtk4', + install_tag: 'doc', ) endforeach endif diff --git a/docs/reference/gtk/tools.md b/docs/reference/gtk/tools.md new file mode 100644 index 0000000000..5ae731148c --- /dev/null +++ b/docs/reference/gtk/tools.md @@ -0,0 +1,18 @@ +Title: Tools and Demos + +GTK ships with a number of tools and demos that come with their own +documentation in the form of man pages. + + - [gtk4-broadwayd](gtk4-broadwayd.html) + - [gtk4-builder-tool](gtk4-builder-tool.html) + - [gtk4-demo](gtk4-demo.html) + - [gtk4-demo-application](gtk4-demo-application.html) + - [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html) + - [gtk4-icon-browser](gtk4-icon-browser.html) + - [gtk4-launch](gtk4-launch.html) + - [gtk4-node-editor](gtk4-node-editor.html) + - [gtk4-path-tool](gtk4-path-tool.html) + - [gtk4-query-settings](gtk4-query-settings.html) + - [gtk4-rendernode-tool](gtk4-rendernode-tool.html) + - [gtk4-update-icon-cache](gtk4-update-icon-cache.html) + - [gtk4-widget-factory](gtk4-widget-factory.html)