From 9ae4e347d7af08e6fa54909d1eb2ca404cf0f2ac Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 22 May 2022 21:33:45 +0100 Subject: [PATCH] CLI: return ZINT_ERROR_INVALID_OPTION instead of 1 on bad option and ZINT_WARN_INVALID_OPTION instead of 0 on ignored option; more barcode synonyms manual: append man page zint.1.pmd instead of CLI help; various tweaks and fiddlings; rMQR add ISO 23941 (released the other day but haven't got yet) man page: expand and tweak doc/Makefile: add HTML demo --- .gitignore | 1 + ChangeLog | 5 + docs/Makefile | 61 ++- docs/inc_header_pdf.tex | 4 +- docs/manual.pmd | 211 +++----- docs/manual.txt | 723 +++++++++++++++++++++++----- docs/zint.1 | 303 +++++++++--- docs/zint.1.pmd | 237 ++++++--- frontend/main.c | 149 ++++-- frontend/tests/test_args.c | 411 ++++++++++------ frontend_qt/frontend_qt.pro | 1 + frontend_qt/frontend_qt_zintdll.pro | 1 + frontend_qt/mainwindow.cpp | 17 +- frontend_qt/resources.qrc | 2 +- 14 files changed, 1533 insertions(+), 593 deletions(-) diff --git a/.gitignore b/.gitignore index fcbd401c..46c37bd9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ CMakeLists.txt.user* backend/Makefile frontend/Makefile docs/manual.pdf +docs/zint.1.tex build-* win32/*.VC.opendb win32/*.VC.db diff --git a/ChangeLog b/ChangeLog index 59071a7d..22e9d6b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,9 @@ Version 2.10.0.9 (dev) not released yet - HANXIN, QRCODE/RMQR now warn when convert to GB 18030, Shift JIS resp. and no ECI given - GRIDMATRIX no longer attempts Latin-1 conversion when no ECI given +- CLI now returns ZINT_ERROR_INVALID_OPTION (8) on its failed option checks + and ZINT_WARN_INVALID_OPTION (2) on ignored options + NOTE: previously returned 1 and 0 respectively Changes ------- @@ -74,6 +77,8 @@ Changes - CLI: man page moved from frontend/zint.1.gz to docs/zint.1.gz, now generated from docs/zint.1.pmd - add README.linux to root dir +- CLI: return ZINT_ERROR_INVALID_OPTION instead of 1 on bad option and + ZINT_WARN_INVALID_OPTION instead of 0 on ignored option Bugs ---- diff --git a/docs/Makefile b/docs/Makefile index ff691615..dd7f1b81 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -14,6 +14,9 @@ INCLUDES_PDF = $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) INC_PDF = --include-in-header $(INC_HEADER_PDF) --include-before-body $(INC_BEFORE_BODY_PDF) INCLUDES_TXT = inc_header_txt.tex INC_TXT = --include-in-header $(INCLUDES_TXT) +SOURCE_MAN_PAGE = zint.1.pmd +OUT_MAN_PAGE = zint.1 +INC_HEADER_TEX_MAN = inc_header_man.tex IMAGES = \ images/zint.png \ images/zint-qt.png \ @@ -130,29 +133,55 @@ IMAGES = \ MAIN_FONT = mainfont="TeX Gyre Pagella" MONO_FONT = monofont="Liberation Mono" CJK_FONT = CJKmainfont="WenQuanYi Micro Hei Mono" -PDF_OPTS = --pdf-engine=xelatex --filter pandoc-tablenos --highlight-style=$(HIGHLIGHT_THEME) -V block-headings \ - -V colorlinks -V geometry:margin=20mm -V papersize=a4 --dpi=300 -M tablenos-warning-level=0 +PDF_OPTS = --pdf-engine=xelatex --filter pandoc-tablenos -M tablenos-warning-level=0 \ + --highlight-style=$(HIGHLIGHT_THEME) -V colorlinks -V geometry:margin=20mm -V papersize=a4 --dpi=300 +TEX_MAN_PAGE = zint.1.tex TXT_OPTS = --columns 80 --eol=lf -t plain -SOURCE_MAN = zint.1.pmd -OUT_MAN = zint.1 -MAN_OPTS = -t man -s +MAN_PAGE_OPTS = -s -t man -all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN) +all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE) -$(OUT_PDF) : $(SOURCE) $(HIGHLIGHT_THEME) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile - pandoc $(SOURCE) -f markdown $(INC_PDF) --toc --toc-depth=4 \ - -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \ +$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(HIGHLIGHT_THEME) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile + pandoc $(SOURCE_MAN_PAGE) -f markdown \ $(PDF_OPTS) \ + -o $(TEX_MAN_PAGE) + sed -i -e 's/section{/subsection{/' $(TEX_MAN_PAGE) # Convert man page sections to subsections + pandoc $(SOURCE) -f markdown $(INC_PDF) --toc --toc-depth=4 \ + -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) -V block-headings \ + $(PDF_OPTS) \ + --include-after-body $(TEX_MAN_PAGE) \ -o $(OUT_PDF) -$(OUT_TXT) : $(SOURCE) $(INCLUDES_TXT) Makefile - pandoc $(SOURCE) -f markdown $(INC_TXT) --toc --toc-depth=4 \ +$(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) Makefile + pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown $(INC_TXT) --toc --toc-depth=4 \ -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \ $(TXT_OPTS) \ -o $(OUT_TXT) - sed -i -e 's/ *$$//' $(OUT_TXT) + # Indent Man Page sections in TOC and remove trailing spaces + sed -i \ + -e 's/^\(- [A-Z][A-Z ]*\)$$/ \1/' \ + -e 's/ *$$//' \ + $(OUT_TXT) -$(OUT_MAN) : $(SOURCE_MAN) Makefile - pandoc $(SOURCE_MAN) -f markdown \ - $(MAN_OPTS) \ - -o $(OUT_MAN) +$(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) Makefile + pandoc $(SOURCE_MAN_PAGE) -f markdown \ + $(MAN_PAGE_OPTS) \ + -o $(OUT_MAN_PAGE) + +# HTML demo + +OUT_HTML = manual.html +HTML_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --highlight-style=$(HIGHLIGHT_THEME) \ + --eol=lf -s -t html + +$(OUT_HTML) : $(SOURCE) $(SOURCE_MAN_PAGE) Makefile + pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown --toc --toc-depth=4 \ + -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \ + $(HTML_OPTS) \ + -o $(OUT_HTML) + # Indent Man Page sections in TOC & change Man Page sections h1 -> h2 + sed -i \ + -e 's/\(Man Page<\/a>\)<\/li>/\1