]> granicus.if.org Git - fortune-mod/commitdiff
Convert more manpages to DocBook 5 XML.
authorShlomi Fish <shlomif@shlomifish.org>
Tue, 18 Aug 2020 11:10:50 +0000 (14:10 +0300)
committerShlomi Fish <shlomif@shlomifish.org>
Wed, 16 Sep 2020 11:00:36 +0000 (14:00 +0300)
cmake generating code.

See:

* https://github.com/shlomif/fortune-mod/issues/41

Made use of doclifter ( http://www.catb.org/~esr/doclifter/ ),
docmake ( https://www.shlomifish.org/open-source/projects/docmake/ ),
cmake, and Perl 5. Thanks!

The current plan is to provide the resultant nroff outputs (or easily 's/.../.../'able
templates of them) inside the source tarballs to avoid a build time dependency on
DocBook XSL and docmake.

fortune-mod/CMakeLists.txt
fortune-mod/fortune/gen-fortune-docbook-page.pl

index d0b8bd5d84187593341b57c6e8d445eb5f495757..72545f74f73d971d2b80723b40c27b8838dea517 100644 (file)
@@ -201,6 +201,26 @@ LIST(APPEND _my_man_pages_list "${_my_man_page}")
 
 INSTALL_RENAME_MAN("fortune.6" "6" "fortune" "${_my_man_page_dir}")
 
+MACRO(_fortune__generate_docbook basename offensive_flags)
+
+    SET (_my_man_page_dir "${CMAKE_CURRENT_SOURCE_DIR}/fortune")
+    # SET (_my_man_page "${_my_man_page_dir}/${basename}.man")
+    SET (_my_man_docbook "${_my_man_page_dir}/${basename}.docbook5.xml")
+    SET (_my_man_prog "${_my_man_page_dir}/gen-fortune-docbook-page.pl")
+    SET (_my_args "${_my_man_prog}" "--output" "${_my_man_docbook}" --cookiedir "[[cookiedir_placeholder]]" --ocookiedir "[[ocookiedir_placeholder]]" ${offensive_flags})
+    ADD_CUSTOM_COMMAND(
+        OUTPUT "${_my_man_docbook}"
+        COMMAND "${PERL_EXECUTABLE}"
+        ARGS ${_my_args}
+        DEPENDS "${_my_man_prog}"
+    )
+
+    LIST(APPEND _my_man_pages_list "${_my_man_docbook}")
+ENDMACRO()
+
+_fortune__generate_docbook("fortune_with_offensive" "")
+_fortune__generate_docbook("fortune_without_offensive" "--without-offensive")
+
 MACRO(_fortune__generate_manpage basename)
 
     SET (_my_man_page_dir "${CMAKE_CURRENT_SOURCE_DIR}/util")
index 008657fbf151122127c10ba7541d1b1065a3dc58..45aa421dc3f410b368c33dbe31426ef423b706a2 100644 (file)
@@ -381,7 +381,7 @@ $out->print(<<"END_OF_STRING");
 
 <!-- PD 0 -->
 
-<para><emphasis remap='I'>[[cookiedir placeholder]]</emphasis>
+<para><emphasis remap='I'>${cookiedir}</emphasis>
 Directory for innoffensive fortunes.</para>
 
 END_OF_STRING
@@ -390,7 +390,7 @@ if ($OFF)
 {
     $out->print(<<"EOF");
 
-<para><emphasis remap='I'>[[ocookiedir placeholder]]</emphasis>
+<para><emphasis remap='I'>${ocookiedir}</emphasis>
 Directory for offensive fortunes.</para>
 EOF
 }