aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindXSLTPROC.cmake
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-10-19 15:03:55 -0700
committerGerald Combs <gerald@wireshark.org>2018-02-11 18:22:09 +0000
commit94a0f7c6414cb83535e89557ce3cce47a1808fec (patch)
treec6e6f18ed0e324bed987ac2873571ffa9e6e7d74 /cmake/modules/FindXSLTPROC.cmake
parent5a674d05c900be0007b71d11ff52e7f972359b5d (diff)
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such as direct PDF output) and is actively developed. It's written in Ruby but that dependency can be sidestepped with AsciidoctorJ, a self-contained bundle that only depends on the JRE. The current toolchain targets require Python, AsciiDoc, DocBook XML, DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler: HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC This change removes the AsciiDoc and FOP requirements and adds either AsciidoctorJ or Asciidoctor + Ruby: HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL PDF: Asciidoctor HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC Ideally we could generate all of these using AsciidoctorJ, Java, and lynx. Unfortunately we're not there yet. The release notes depend on several macros (ws-buglink, ws-salink, cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents. Remove the BUILD_xxx_GUIDES CMake options and add various output targets automatically. This means that you have to build the various documentation targets explicitly. Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a Reviewed-on: https://code.wireshark.org/review/25668 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'cmake/modules/FindXSLTPROC.cmake')
-rw-r--r--cmake/modules/FindXSLTPROC.cmake62
1 files changed, 10 insertions, 52 deletions
diff --git a/cmake/modules/FindXSLTPROC.cmake b/cmake/modules/FindXSLTPROC.cmake
index 62d71af846..fb2d50a77a 100644
--- a/cmake/modules/FindXSLTPROC.cmake
+++ b/cmake/modules/FindXSLTPROC.cmake
@@ -5,13 +5,6 @@
include(FindCygwin)
-if(ENABLE_PDF_GUIDES)
- find_package(FOP)
- if(${FOP_EXECUTABLE} STREQUAL "FOP_EXECUTABLE-NOTFOUND")
- message(FATAL_ERROR "fop wasn't found, but is necessary for building PDFs." )
- endif()
-endif()
-
find_program(XSLTPROC_EXECUTABLE
NAMES
xsltproc
@@ -44,7 +37,6 @@ if (WIN32 AND NOT "${CYGWIN_INSTALL_PATH}" STREQUAL "" AND ${XSLTPROC_EXECUTABLE
NAMES cygpath
PATHS ${CYGWIN_INSTALL_PATH}/bin
)
- # XXX Duplicate of TO_A2X_COMPATIBLE_PATH
MACRO( TO_XSLTPROC_COMPATIBLE_PATH _cmake_path _result )
execute_process(
COMMAND ${CYGPATH_EXECUTABLE} -u ${_cmake_path}
@@ -103,13 +95,18 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
# We depend on the docbook target to avoid parallel builds.
SET(_dbk_dep ${_target_dep}_docbook)
+ # We can pass chunker.xxx parameters to customize the chunked output.
+ # We have to use a custom layer to customize the single-page output.
+ # Set the output encoding for both to UTF-8. Indent the single-page
+ # output because we sometimes need to copy and paste the release
+ # note contents.
IF(${_mode} STREQUAL "chunked")
SET(_basedir ${_dir_pfx}_html_chunked)
- SET(_STYLESHEET "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl")
- SET(_modeparams --noout)
+ SET(_stylesheet "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl")
+ SET(_modeparams --stringparam chunker.output.encoding UTF-8)
ELSE() # single-page
SET(_basedir ${_dir_pfx}_html)
- SET(_STYLESHEET "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl")
+ SET(_stylesheet custom_layer_single_html.xsl)
SET(_modeparams --output ${_basedir}/index.html)
ENDIF()
@@ -121,11 +118,6 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
set(_gfx_deps ${CMAKE_CURRENT_SOURCE_DIR}/${_tmpgfx})
ENDFOREACH()
-# GET_FILENAME_COMPONENT(_GFXDIR ${_gfx} ABSOLUTE)
-# GET_FILENAME_COMPONENT(_GFXDIR ${_GFXDIR} PATH)
-# GET_FILENAME_COMPONENT(_OUTDIR ${_output} PATH)
-# SET(_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/${_OUTDIR})
-
SET(_gfx_dir ${_dir_pfx}_graphics)
ADD_CUSTOM_COMMAND(
OUTPUT
@@ -148,12 +140,13 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
${_common_xsltproc_args}
--stringparam admon.graphics.path ${_gfx_dir}/
${_modeparams}
- ${_STYLESHEET}
+ --noout ${_stylesheet}
${_dbk_source}
DEPENDS
${_dbk_xml_deps}
${_dbk_dep}
${_gfx_deps}
+ custom_layer_single_html.xsl
)
IF(NOT WIN32)
ADD_CUSTOM_COMMAND(
@@ -166,41 +159,6 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
ENDIF()
ENDMACRO(XML2HTML)
-# Translate XML to FO to PDF
-#XML2PDF(
-# user-guide-a4.fo or user-guide-us.fo
-# WSUG_SOURCE
-# custom_layer_pdf.xsl
-# A4 or letter
-#)
-MACRO(XML2PDF _target_dep _output _dbk_source _stylesheet)
- # We depend on the docbook target to avoid parallel builds.
- SET(_dbk_dep ${_target_dep}_docbook)
- file(RELATIVE_PATH _img_relative_path ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
- get_docbook_xml_depends(_dbk_xml_deps "${_dbk_source}")
- ADD_CUSTOM_COMMAND(
- OUTPUT
- ${_output}
- ${_output}.fo
- COMMAND ${XSLTPROC_EXECUTABLE}
- --path "${_xsltproc_path}"
- --stringparam img.src.path ${_img_relative_path}/
- --stringparam use.id.as.filename 1
- --stringparam admon.graphics.path ${_img_relative_path}/common_graphics/
- --nonet
- --output ${_output}.fo
- ${_stylesheet}
- ${_dbk_source}
- COMMAND ${FOP_EXECUTABLE}
- ${_output}.fo
- ${_output}
- DEPENDS
- ${_dbk_xml_deps}
- ${_dbk_dep}
- ${_stylesheet}
- )
-ENDMACRO(XML2PDF)
-
# Translate XML to HHP
#XML2HHP(
# wsug or wsdg