diff --git a/doc/.gitignore b/doc/.gitignore index 23b7e7539..cb29aa609 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,4 +1,5 @@ api +web *.tmp *.html *.pdf diff --git a/doc/Makefile b/doc/Makefile index 5efcab112..4182bdadc 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -111,21 +111,15 @@ api-dir: txt: $(addprefix $(srcdir),$(TXT_DOCS)) html: txt $(HTML_DOCS) pdf: txt $(PDF_DOCS) -man: txt $(MAN_DOCS) man-update +man: txt $(MAN_DOCS) api: api-dir $(API_DOCS) all-docs: man html pdf -man-update: $(MAN_DOCS) - @test "$(CONFIG_XMLTO)" = yes && \ - sed 's/^\.TH "ELINKS" 1 .*/.TH "ELINKS" 1 "The ELinks text-browser" "$(shell date -I)" "The ELinks text-browser"/' \ - < elinks.1 > $(srcdir)man/man1/elinks.1.in && \ - $(RM) $(MAN_DIR)/man1/elinks.1 - @test "$(CONFIG_XMLTO)" = yes && \ - sed -e 's/\\fI\\fR'\''/\\fI\\'\''\\fR/' < elinkskeys.5 | \ - sed 's/^\.TH "ELINKSKEYS" 5 .*/.TH "ELINKSKEYS" 5 "ELinks keybindings" "$(shell date -I)" "ELinks keybindings"/' \ - > $(srcdir)man/man5/elinkskeys.5 - @$(INSTALL) elinks.conf.5 $(srcdir)man/man5 +update-man: man + $(call cmd,installdata,$(srcdir)elinks.1,man/man1/elinks.1.in) + $(call cmd,installdata,$(srcdir)elinkskeys.5,man/man5/) + $(call cmd,installdata,$(srcdir)elinks.conf.5,man/man5/) clean-local: @$(RM) -r api $(GEN_TXT_DOCS) $(MAN_DOCS) $(HTML_DOCS) $(PDF_DOCS) *.tmp @@ -134,6 +128,9 @@ clean-local: # FIXME: Keep generated .txt files relative to the source directory and files # they are included in. +quiet_cmd_help2doc = ' [$(LINK_COLOR)HELP2DOC$(END_COLOR)] $(RELPATH)$@' + cmd_help2doc = $(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@ + import-features.conf.txt: $(FEATURES) $(IMPORT_FEATURES_CONF) $(IMPORT_FEATURES_CONF) > $@ @@ -142,7 +139,7 @@ keymap-defaults.txt keymap-actions.txt: $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND) $(LOCALES) $(srcdir)tools/make-elinkskeys-manpage $(KBDBIND) option-%.txt: $(ELINKS) $(HELP2DOC) - $(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@ + $(call cmd,help2doc) ## Default build rules # @@ -161,6 +158,11 @@ quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@' doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpage,book)) +MAN_DATE = $(shell date -I) +man_desc = `sed -n 's/:Description:\s*\(.*\)/\1/p' < $(subst .xml,.txt,$<)` +man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\" \"$(1)\"/" < $@ | \ + sed "s/@squote@/\\\\'/g" > $@.tmp && mv $@.tmp $@ + %.html: %.txt asciidoc.conf $(call cmd,asciidoc,xhtml11) @@ -169,9 +171,11 @@ doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpag %.1: %.1.xml $(call cmd,xmlto,man) + $(call man_hack,$(call man_desc)) %.5: %.5.xml $(call cmd,xmlto,man) + $(call man_hack,$(call man_desc)) %.html-chunked: %.xml $(call cmd,xmlto,html,-o $@) diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf index 7f49e9408..386f01256 100644 --- a/doc/asciidoc.conf +++ b/doc/asciidoc.conf @@ -18,6 +18,9 @@ # Some macros can have optional {0} value, that is what # the {0%...} and {0#...} handles. +[attributes] +squote=@squote@ + ############################################################################# # DocBook diff --git a/doc/tools/help2doc b/doc/tools/help2doc index 2983195ef..62255ecc4 100755 --- a/doc/tools/help2doc +++ b/doc/tools/help2doc @@ -98,6 +98,7 @@ do # the desciption is over. if test -z "$line" then + echo parse_description= parse_int_option= continue diff --git a/doc/tools/make-elinkskeys-manpage b/doc/tools/make-elinkskeys-manpage index 7953fcafa..5f45bb74d 100755 --- a/doc/tools/make-elinkskeys-manpage +++ b/doc/tools/make-elinkskeys-manpage @@ -86,8 +86,8 @@ print_keymap_defaults() key="Space" ;; *) - key=$(echo "$key" | sed "s/^'\(.*\)'/\1/" \ - | sed "s/'/\\\\'/") + key=$(echo "$key" | sed "s/^'\(.*\)'$/\1/" \ + | sed "s/'/{squote}/") ;; esac