aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2021-07-28 10:23:50 -0700
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-07-30 21:05:37 +0000
commitb58edf3cb8bc56f09b2011df931a3fa5e40c66ce (patch)
tree8780eb97263db07a4de4468bfdce2c3389d71797
parentd886837df96a15a0af5bc1c6955e2bddb1cff8ea (diff)
Docs: Add epub targets for the guides.
Add user_guide_epub and developer_guide_epub targets that generate EPUB versions of the User's Guide and Developer's Guide. Ping #17494.
-rw-r--r--.gitlab-ci.yml6
-rw-r--r--cmake/modules/FindAsciidoctor.cmake47
-rw-r--r--docbook/CMakeLists.txt24
3 files changed, 76 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dd2564fafb..bd4e3ca9c3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -414,6 +414,7 @@ Documentation:
# XXX We might want to move this to wireshark-ubuntu-dev or debian-setup.sh.
- DEBIAN_FRONTEND=noninteractive apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get --yes install ruby-coderay ruby-asciidoctor-pdf
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install asciidoctor-epub3
- mkdir build
- cd build
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
@@ -425,9 +426,10 @@ Documentation:
after_script:
- mv -v build/docbook/ws[ud]g_html{,_chunked}.zip .
- mv -v build/docbook/{user,developer}-guide.pdf .
+ - mv -v build/docbook/{user,developer}-guide.epub .
- |
if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ] && [ -n "$S3_DESTINATION_DOCS" ] ; then
- for DOC_FILE in ws[ud]g_html{,_chunked}.zip {user,developer}-guide.pdf ; do
+ for DOC_FILE in ws[ud]g_html{,_chunked}.zip {user,developer}-guide.pdf {user,developer}-guide.epub ; do
aws s3 cp "$DOC_FILE" "$S3_DESTINATION_DOCS/"
done
fi
@@ -439,6 +441,8 @@ Documentation:
- wsdg_html_chunked.zip
- user-guide.pdf
- developer-guide.pdf
+ - user-guide.epub
+ - developer-guide.epub
needs: []
diff --git a/cmake/modules/FindAsciidoctor.cmake b/cmake/modules/FindAsciidoctor.cmake
index a452d4af22..f9d61e5c80 100644
--- a/cmake/modules/FindAsciidoctor.cmake
+++ b/cmake/modules/FindAsciidoctor.cmake
@@ -177,6 +177,53 @@ if(ASCIIDOCTOR_EXECUTABLE)
endif(ASCIIDOCTOR_PDF_EXECUTABLE)
+ FIND_PROGRAM(ASCIIDOCTOR_EPUB_EXECUTABLE
+ NAMES
+ asciidoctorj
+ asciidoctor-epub3
+ PATHS
+ /bin
+ /usr/bin
+ /usr/local/bin
+ ${CHOCOLATEY_BIN_PATH}
+ DOC "Path to Asciidoctor EPUB3 or AsciidoctorJ"
+ )
+
+ if(ASCIIDOCTOR_EPUB_EXECUTABLE)
+
+ set(_asciidoctor_epub_common_command
+ ${CMAKE_COMMAND} -E env TZ=UTC ASCIIDOCTORJ_OPTS="${_asciidoctorj_opts}"
+ ${ASCIIDOCTOR_EPUB_EXECUTABLE}
+ --backend epub3
+ ${_asciidoctor_common_args}
+ )
+
+ MACRO(ASCIIDOCTOR2EPUB _asciidocsource)
+ GET_FILENAME_COMPONENT(_source_base_name ${_asciidocsource} NAME_WE )
+ set(_output_epub ${_source_base_name}.epub)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT
+ ${_output_epub}
+ COMMAND ${_asciidoctor_epub_common_command}
+ --out-file ${_output_epub}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
+ ${ARGN}
+ )
+ add_custom_target(generate_${_output_epub} DEPENDS ${_output_epub})
+ set_asciidoctor_target_properties(generate_${_output_epub})
+ unset(_output_epub)
+ ENDMACRO()
+
+ else(ASCIIDOCTOR_EPUB_EXECUTABLE)
+
+ MACRO(ASCIIDOCTOR2EPUB _asciidocsource)
+ ENDMACRO()
+
+ endif(ASCIIDOCTOR_EPUB_EXECUTABLE)
+
endif(ASCIIDOCTOR_EXECUTABLE)
include( FindPackageHandleStandardArgs )
diff --git a/docbook/CMakeLists.txt b/docbook/CMakeLists.txt
index fa4623b0ba..6ae743c4ed 100644
--- a/docbook/CMakeLists.txt
+++ b/docbook/CMakeLists.txt
@@ -396,6 +396,18 @@ if(ASCIIDOCTOR_FOUND AND ASCIIDOCTOR_PDF_EXECUTABLE)
add_dependencies(user_guides user_guide_pdf)
endif()
+if(ASCIIDOCTOR_FOUND AND ASCIIDOCTOR_EPUB_EXECUTABLE)
+ ASCIIDOCTOR2EPUB(user-guide.adoc ${WSUG_SOURCE} ${WSUG_BUILT_DEPS})
+
+ add_custom_target(
+ user_guide_epub
+ DEPENDS
+ user-guide.epub
+ )
+ set_docbook_target_properties(user_guide_epub)
+ add_dependencies(user_guides user_guide_epub)
+endif()
+
# Developer's Guide chain.
if(ASCIIDOCTOR_FOUND AND XSLTPROC_EXECUTABLE)
XML2HTML(
@@ -436,6 +448,18 @@ if(ASCIIDOCTOR_FOUND AND ASCIIDOCTOR_PDF_EXECUTABLE)
add_dependencies(developer_guides developer_guide_pdf)
endif()
+if(ASCIIDOCTOR_FOUND AND ASCIIDOCTOR_EPUB_EXECUTABLE)
+ ASCIIDOCTOR2EPUB(developer-guide.adoc ${WSDG_SOURCE} ${WSDG_BUILT_DEPS})
+
+ add_custom_target(
+ developer_guide_epub
+ DEPENDS
+ developer-guide.epub
+ )
+ set_docbook_target_properties(developer_guide_epub)
+ add_dependencies(developer_guides developer_guide_epub)
+endif()
+
if (GUIDE_INSTALL_DIRS)
# The installation location and DOC_DIR in ui/help_url.c must
# match.