From a717782480426e834011d4f91b0c5cafa0b7a5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Wed, 24 Aug 2022 00:12:04 +0200 Subject: [PATCH] Build with AsciiDoc as well as Asciidoctor --- CMakeLists.txt | 29 ++++++++++++++++++++--------- README.adoc | 3 ++- xB.adoc | 4 ++-- xC.adoc | 4 ++-- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ffe9b9..4b403f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,20 +204,31 @@ install (DIRECTORY plugins/xC/ # Generate documentation from text markup find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor) -if (NOT ASCIIDOCTOR_EXECUTABLE) - message (FATAL_ERROR "asciidoctor not found") +find_program (A2X_EXECUTABLE a2x) +if (NOT ASCIIDOCTOR_EXECUTABLE AND NOT A2X_EXECUTABLE) + message (FATAL_ERROR "Neither asciidoctor nor a2x were found") endif () foreach (page xB xC xD) set (page_output "${PROJECT_BINARY_DIR}/${page}.1") list (APPEND project_MAN_PAGES "${page_output}") - add_custom_command (OUTPUT ${page_output} - COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage - -a release-version=${project_version} - "${PROJECT_SOURCE_DIR}/${page}.adoc" - -o "${page_output}" - DEPENDS ${page}.adoc - COMMENT "Generating man page for ${page}" VERBATIM) + if (ASCIIDOCTOR_EXECUTABLE) + add_custom_command (OUTPUT ${page_output} + COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage + -a release-version=${project_version} + -o "${page_output}" + "${PROJECT_SOURCE_DIR}/${page}.adoc" + DEPENDS ${page}.adoc + COMMENT "Generating man page for ${page}" VERBATIM) + elseif (A2X_EXECUTABLE) + add_custom_command (OUTPUT ${page_output} + COMMAND ${A2X_EXECUTABLE} --doctype manpage --format manpage + -a release-version=${project_version} + -D "${PROJECT_BINARY_DIR}" + "${PROJECT_SOURCE_DIR}/${page}.adoc" + DEPENDS ${page}.adoc + COMMENT "Generating man page for ${page}" VERBATIM) + endif () endforeach () add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES}) diff --git a/README.adoc b/README.adoc index da7f3e7..2c1df33 100644 --- a/README.adoc +++ b/README.adoc @@ -71,7 +71,8 @@ a package with the latest development version from Archlinux's AUR. Building -------- -Build dependencies: CMake, pkg-config, asciidoctor, awk, liberty (included) + +Build dependencies: CMake, pkg-config, asciidoctor or asciidoc, awk, + liberty (included) + Runtime dependencies: openssl + Additionally for 'xC': curses, libffi, lua >= 5.3 (optional), readline >= 6.0 or libedit >= 2013-07-12 diff --git a/xB.adoc b/xB.adoc index 42fb4a8..ec5ecb6 100644 --- a/xB.adoc +++ b/xB.adoc @@ -65,9 +65,9 @@ for RPC, with the following subcommands: exists, the value will be empty. The response will be delivered in the following format: + -``` +.... XB :value -``` +.... + This is particularly useful for retrieving the *prefix* string. diff --git a/xC.adoc b/xC.adoc index 221c5bc..2d791cd 100644 --- a/xC.adoc +++ b/xC.adoc @@ -25,9 +25,9 @@ Options other formatting marks to ANSI codes retrieved from the *terminfo*(5) database: + -``` +.... printf '\x02bold\x02\n' | xC -f -``` +.... + This feature may be used to preview server MOTD files.