From 10359fd7014e5d33fdc6ee7cba6d98b10054cecc Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 10:00:04 +0200 Subject: [PATCH 1/5] gendocs: add option to choose pdf papersize The default will be US Letter [ci skip] --- tools/gendocs.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 9126a406..3d082024 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -1,5 +1,19 @@ #!/bin/bash + +# By default US Letter is used as the PDF papersize. +# For those preferring other dimensions add a4 or small +# as a commandline argument to this script to create a +# DIN A4 or smallbook version of the PDF. +case $1 in + a4*|afour*) + papersize='--texinfo=@afourpaper';; + small*) + papersize='--texinfo=@smallbook';; + *) + papersize='';; # US Letter is texinfo default +esac + echo "===================================== Making Info..." makeinfo ledger3.texi echo "===================================== Making PDF..." -texi2pdf --quiet --batch ledger3.texi +texi2pdf --quiet --batch ${papersize} ledger3.texi From d8bbe78756d02f7964095dcc5bebbf158f9c4acf Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 10:01:01 +0200 Subject: [PATCH 2/5] gendocs: make html documentation [ci skip] --- tools/gendocs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 3d082024..48b6a943 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -15,5 +15,7 @@ esac echo "===================================== Making Info..." makeinfo ledger3.texi +echo "===================================== Making HTML..." +makeinfo --html --no-split ledger3.texi echo "===================================== Making PDF..." texi2pdf --quiet --batch ${papersize} ledger3.texi From 0e496b4f9ba9b8376283bfe202d28bb538c438cc Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 10:04:05 +0200 Subject: [PATCH 3/5] gendocs: use hombrew texinfo on mac if installed The default texinfo (4.8) on Mac OS X shows odd warnings from a sed call and generates verbatim html tags in links if the part of the link was marked with @command{}. With a current version of texinfo (5.2) these oddities are gone. [ci skip] --- tools/gendocs.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 48b6a943..483f0230 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -13,6 +13,14 @@ case $1 in papersize='';; # US Letter is texinfo default esac +# Use keg-only Mac Hombrew texinfo if installed. +# Since texi2pdf is a shell script itself executing texi2dvi +# PATH is prepended with the path to correct texinfo scripts. +if [ $(uname -s) = 'Darwin' ]; then + brew list texinfo >/dev/null 2>&1 \ + && export PATH="$(brew --prefix texinfo)/bin:$PATH" +fi + echo "===================================== Making Info..." makeinfo ledger3.texi echo "===================================== Making HTML..." From e167cbb64713ec1feeefaa98594361069c973faa Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 11:06:02 +0200 Subject: [PATCH 4/5] doc: try to use groff if man2html is not found to generate a html version of the manpage, throw a fatal error otherwise. --- doc/CMakeLists.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2777da68..f0ead658 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -37,6 +37,7 @@ set(info_files ledger3.texi ledger-mode.texi) find_program(MAKEINFO makeinfo) find_program(TEXI2PDF texi2pdf) find_program(MAN2HTML man2html) +find_program(GROFF groff) ######################################################################## @@ -72,15 +73,21 @@ if(BUILD_WEB_DOCS) if(NOT BASH) message(FATAL_ERROR "Could not find bash. Unable to build documentation.") endif() - if(NOT MAN2HTML) - message(FATAL_ERROR "Could not find man2html. HTML version of man page cannot be built.") + if(MAN2HTML) + add_custom_command(OUTPUT ledger.1.html + COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 + VERBATIM) + list(APPEND ledger_doc_files ledger.1.html) + elseif(GROFF) + add_custom_command(OUTPUT ledger.1.html + COMMAND ${BASH} -c "groff -mandoc -Thtml ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 > ledger.1.html" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 + VERBATIM) + list(APPEND ledger_doc_files ledger.1.html) + else() + message(FATAL_ERROR "Could not find man2html or groff. HTML version of man page cannot be built.") endif() - - add_custom_command(OUTPUT ledger.1.html - COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html" - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 - VERBATIM) - list(APPEND ledger_doc_files ledger.1.html) endif(BUILD_WEB_DOCS) ######################################################################## From c933e7859922c04cafcd145090c7546e8d8d2d60 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 11:08:01 +0200 Subject: [PATCH 5/5] doc: add BUILD_A4_PDF cmake variable to create a DIN A4 paper version of the ledger pdf. --- doc/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index f0ead658..15f1318c 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -58,8 +58,11 @@ foreach(file ${info_files}) if(NOT TEXI2PDF) message(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.") else() + if(BUILD_A4_PDF) + set(papersize --texinfo=@afourpaper) + endif() add_custom_command(OUTPUT ${file_base}.pdf - COMMAND texi2pdf -b -q -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} + COMMAND texi2pdf ${papersize} -b -q -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} VERBATIM) list(APPEND ledger_doc_files ${file_base}.pdf)