diff --git a/CMakeLists.txt b/CMakeLists.txt index b4b1020b..cd2f20c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,24 +76,8 @@ if(NOT DEFINED DOC_PATH) endif(NOT DEFINED DOC_PATH) set(DOC_FILES extras/convert.lua data/conky_no_x11.conf data/conky.conf) -set(HTML_PATH "${DOC_PATH}/html") -set(HTML_FILES - doc/config_settings.html - doc/docs.html - doc/lua.html - doc/variables.html) - -set(MAN_PATH "share/man/man1") -set(MAN_FILES doc/conky.1) - install(FILES ${DOC_FILES} DESTINATION ${DOC_PATH}) -if(BUILD_DOCS) - install(FILES ${HTML_FILES} DESTINATION ${HTML_PATH}) - - install(FILES ${MAN_FILES} DESTINATION ${MAN_PATH}) -endif(BUILD_DOCS) - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") install(FILES conky.desktop DESTINATION share/applications) install(FILES logo/conky-logomark-violet.svg diff --git a/cmake/ConkyPlatformChecks.cmake b/cmake/ConkyPlatformChecks.cmake index 55d25a87..4e324b55 100644 --- a/cmake/ConkyPlatformChecks.cmake +++ b/cmake/ConkyPlatformChecks.cmake @@ -484,36 +484,41 @@ endif(WANT_LIBXML2) # Look for doc generation programs if(BUILD_DOCS) # Used for doc generation - find_program(APP_DB2X_XSLTPROC db2x_xsltproc) - if(NOT APP_DB2X_XSLTPROC) - message(FATAL_ERROR "Unable to find program 'db2x_xsltproc'") - endif(NOT APP_DB2X_XSLTPROC) - find_program(APP_DB2X_MANXML db2x_manxml) - if(NOT APP_DB2X_MANXML) - message(FATAL_ERROR "Unable to find program 'db2x_manxml'") - endif(NOT APP_DB2X_MANXML) - find_program(APP_XSLTPROC xsltproc) - if(NOT APP_XSLTPROC) - message(FATAL_ERROR "Unable to find program 'xsltproc'") - endif(NOT APP_XSLTPROC) - find_program(APP_MAN man) - if(NOT APP_MAN) - message(FATAL_ERROR "Unable to find program 'man'") - endif(NOT APP_MAN) - find_program(APP_LESS less) - if(NOT APP_LESS) - message(FATAL_ERROR "Unable to find program 'less'") - endif(NOT APP_LESS) - find_program(APP_SED sed) - if(NOT APP_SED) - message(FATAL_ERROR "Unable to find program 'sed'") - endif(NOT APP_SED) - mark_as_advanced(APP_DB2X_XSLTPROC - APP_DB2X_MANXML - APP_XSLTPROC - APP_MAN - APP_SED - APP_LESS) + find_program(APP_PANDOC pandoc) + + if(NOT APP_PANDOC) + message(FATAL_ERROR "Unable to find program 'pandoc'") + endif(NOT APP_PANDOC) + mark_as_advanced(APP_PANDOC) + + # Python3 with Jinja2 and PyYaml required for manpage generation. + find_package(Python3 REQUIRED COMPONENTS Interpreter) + include(CMakePrintHelpers) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import yaml" + RESULT_VARIABLE EXIT_CODE + OUTPUT_QUIET + ) + + if(NOT ${EXIT_CODE} EQUAL 0) + message( + FATAL_ERROR + "The \"PyYAML\" Python3 package is not installed. Please install it using the following command: \"pip3 install pyyaml\"." + ) + endif() + + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import jinja2" + RESULT_VARIABLE EXIT_CODE + OUTPUT_QUIET + ) + + if(NOT ${EXIT_CODE} EQUAL 0) + message( + FATAL_ERROR + "The \"Jinja2\" Python3 package is not installed. Please install it using the following command: \"pip3 install Jinja2\"." + ) + endif() endif(BUILD_DOCS) if(CMAKE_BUILD_TYPE MATCHES "Debug") diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 00000000..6c8afecf --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +man.md diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 10ec4f44..d77c3bf6 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -18,9 +18,28 @@ # along with this program. If not, see . # -include(Docbook) - if(BUILD_DOCS) - wrap_xsltproc(lua config_settings variables) - wrap_man(docs) + add_custom_target(man.md + ALL + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/docgen.py man.md.j2 > ${CMAKE_CURRENT_BINARY_DIR}/man.md + OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/man.md + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + SOURCES config_settings.yaml variables.yaml lua.yaml man.md.j2 + ) + add_custom_target(conky.1 + ALL + COMMAND ${APP_PANDOC} -f markdown -t man ${CMAKE_CURRENT_BINARY_DIR}/man.md > ${CMAKE_CURRENT_BINARY_DIR}/conky.1 + SOURCES config_settings.yaml variables.yaml lua.yaml man.md.j2 + ) + add_dependencies(conky.1 man.md) + + set(MAN_PATH "share/man/man1") + set(MAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/conky.1) + + install(FILES ${DOC_FILES} DESTINATION ${DOC_PATH}) + + if(BUILD_DOCS) + install(FILES ${MAN_FILES} DESTINATION ${MAN_PATH}) + endif(BUILD_DOCS) + endif(BUILD_DOCS) diff --git a/doc/README.docs b/doc/README.docs deleted file mode 100644 index 340728a8..00000000 --- a/doc/README.docs +++ /dev/null @@ -1,41 +0,0 @@ -DA DOCS. YO. -============ -The main file that contains the bulk of our documentation is docs.xml . -We use the DocBook format, which is a really kickass xml-based way of -writing documentation, heavily oriented towards programming and computer -stuff. There are tags like and