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.
This commit is contained in:
Gerald Combs 2021-07-28 10:23:50 -07:00 committed by Wireshark GitLab Utility
parent d886837df9
commit b58edf3cb8
3 changed files with 76 additions and 1 deletions

View File

@ -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: []

View File

@ -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 )

View File

@ -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.