From 509d152e5407856ce00833b931ef29c3d98c3573 Mon Sep 17 00:00:00 2001 From: Mark Griffiths Date: Fri, 8 Aug 2014 03:44:37 +0100 Subject: Tutorial auto colouring, Man page and Make fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completely fixes #1557 and the underlying Doxygen changes that caused it. Should make fish docs simpler and more robust, more consistent and generally prettier. todo: - trap unmarked text as arguments in context - test & fix sed portability - see in particular. (so far tested on BSD (Mac) and GNU sed). - test Makefile changes - last round of aesthetic changes and getting that ascii fish in there… --- .gitignore | 5 +- Doxyfile | 44 +++- Doxyfile.help | 79 +++---- Doxyfile.user | 79 +++---- Makefile.in | 26 ++- doc_src/alias.txt | 4 +- doc_src/commands.hdr.in | 4 +- doc_src/design.hdr | 6 +- doc_src/echo.txt | 2 +- doc_src/faq.hdr | 4 +- doc_src/fish.txt | 2 +- doc_src/fish_indent.txt | 2 +- doc_src/fish_lexicon_filter.in | 411 ----------------------------------- doc_src/fish_prompt.txt | 3 +- doc_src/functions.txt | 2 +- doc_src/if.txt | 5 +- doc_src/index.hdr.in | 69 +++--- doc_src/nextd.txt | 2 +- doc_src/psub.txt | 8 +- doc_src/set.txt | 18 +- doc_src/set_color.txt | 2 +- doc_src/source.txt | 7 +- doc_src/trap.txt | 7 +- doc_src/tutorial.hdr | 356 +++++++++++++++--------------- doc_src/type.txt | 6 +- doc_src/user_doc.css | 3 +- doc_src/while.txt | 7 +- lexicon_filter.in | 475 +++++++++++++++++++++++++++++++++++++++++ 28 files changed, 888 insertions(+), 750 deletions(-) delete mode 100644 doc_src/fish_lexicon_filter.in create mode 100644 lexicon_filter.in diff --git a/.gitignore b/.gitignore index 492c5758..2fe2f215 100644 --- a/.gitignore +++ b/.gitignore @@ -30,14 +30,15 @@ share/man/ toc.txt user_doc/ xcuserdata +fish.xccheckout tests/*tmp.* tests/foo.txt FISH-BUILD-VERSION-FILE version messages.pot lexicon.txt -doc_src/fish_lexicon_filter -debug-lexicon.log +lexicon_filter +lexicon-debug.log Fish-Shell.sublime-workspace Fish-Shell.sublime-project diff --git a/Doxyfile b/Doxyfile index 3cd01663..38cbd687 100644 --- a/Doxyfile +++ b/Doxyfile @@ -228,8 +228,48 @@ TAB_SIZE = 8 # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. -ALIASES = "fish=\n
\verbatim" -ALIASES += "endfish=\endverbatim
" +ALIASES = "key{1}=\1" +ALIASES += "key{2}=\1-\2" +ALIASES += "key{3}=\1-\3" +ALIASES += "cursor_key{2}=\2" + +ALIASES += "fish=\htmlonly[block] \n
"
+ALIASES += "fish{1}=\htmlonly[block] \n
"
+ALIASES += "endfish=
\endhtmlonly \n" + +ALIASES += "asis{1}=\1" +ALIASES += "outp{1}=\1" +ALIASES += "blah{1}=#\1" +ALIASES += "cmnd{1}=\1" +ALIASES += "func{1}=\1" +ALIASES += "sbin{1}=\1" +ALIASES += "args{1}=\1" +ALIASES += "opts{1}=\1" +ALIASES += "vars{1}=\1" +ALIASES += "optr{1}=\1" +ALIASES += "redr{1}=\1" +ALIASES += "fsfo{1}=\1" +ALIASES += "path{1}=\1" +ALIASES += "clrv{1}=\1" + +ALIASES += "strg{1}=\1" +ALIASES += "sglq{1}='\1'" +ALIASES += "dblq{1}=\"\1\"" + +ALIASES += "prmt=>" +ALIASES += "prmt{1}=\1>" +ALIASES += "sgst{1}=\1" +ALIASES += "mtch{1}=\1" +ALIASES += "smtc{1}=\1" +ALIASES += "eror{1}=\1" +ALIASES += "curs=_" +ALIASES += "curs{1}=\1" + +ALIASES += "bold{1}=\1" +ALIASES += "emph{1}=\1" +ALIASES += "undr{1}=\1" +ALIASES += "span{2}=\2" +ALIASES += "spcl{2}=\2" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" diff --git a/Doxyfile.help b/Doxyfile.help index 74673382..7b905572 100644 --- a/Doxyfile.help +++ b/Doxyfile.help @@ -230,43 +230,48 @@ TAB_SIZE = 4 # Simplify Fish output from Doxygen for man pages. (see fish_lexicon_filter) -ALIASES = "key{1}=\1" -ALIASES += "key{2}=\1-\2" -ALIASES += "key{3}=\1-\3" -ALIASES += "cursor_key{2}=\2" - -ALIASES += "fish=
"
-ALIASES               += "fish{1}=
"
-ALIASES               += "endfish=
" - -ALIASES += "asis{1}=\1" -ALIASES += "blah{1}=\1" -ALIASES += "cmnd{1}=\b \1" -ALIASES += "func{1}=\b \1" -ALIASES += "sbin{1}=\b \1" -ALIASES += "args{1}=\1" -ALIASES += "opts{1}=\1" -ALIASES += "vars{1}=\1" -ALIASES += "optr{1}=\1" -ALIASES += "redr{1}=\1" -ALIASES += "fsfo{1}=\1" -ALIASES += "path{1}=\1" -ALIASES += "clrv{1}=\1" - -ALIASES += "strg{1}=\1" -ALIASES += "sglq{1}=\'\1\'" -ALIASES += "dblq{1}=\"\1\"" - -ALIASES += "prmt{1}=\1" -ALIASES += "sgst{1}=\1" -ALIASES += "eror{1}=\1" -ALIASES += "curs{1}=\1" - -ALIASES += "bold{1}=\1" -ALIASES += "emph{1}=\1" -ALIASES += "undr{1}=\1" -ALIASES += "span{2}=\1" -ALIASES += "spcl{2}=\1" +ALIASES = "key{1}=\1" +ALIASES += "key{2}=\1-\2" +ALIASES += "key{3}=\1-\3" +ALIASES += "cursor_key{2}=\2" + +ALIASES += "fish=
"
+ALIASES += "fish{1}=
"
+ALIASES += "endfish=
" + +ALIASES += "asis{1}=\1" +ALIASES += "outp{1}=\1" +ALIASES += "blah{1}= \1" +ALIASES += "cmnd{1}=\1" +ALIASES += "func{1}=\1" +ALIASES += "sbin{1}=\1" +ALIASES += "args{1}=\1" +ALIASES += "opts{1}=\1" +ALIASES += "vars{1}=\1" +ALIASES += "optr{1}=\1" +ALIASES += "redr{1}=\1" +ALIASES += "fsfo{1}=\1" +ALIASES += "path{1}=\1" +ALIASES += "clrv{1}=\1" + +ALIASES += "strg{1}=\1" +ALIASES += "sglq{1}='\1'" +ALIASES += "dblq{1}=\"\1\"" + +ALIASES += "prmt=>" +ALIASES += "prmt{1}=\1>" +ALIASES += "sgst{1}=\1" +ALIASES += "mtch{1}=\1" +ALIASES += "smtc{1}=\1" +ALIASES += "eror{1}=\1" +ALIASES += "curs=_" +ALIASES += "curs{1}=\1" + +ALIASES += "bold{1}=\1" +ALIASES += "emph{1}=\1" +ALIASES += "undr{1}=\1" +ALIASES += "span{2}=\2" +ALIASES += "spcl{2}=\2" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" diff --git a/Doxyfile.user b/Doxyfile.user index 09683abd..b1319a78 100644 --- a/Doxyfile.user +++ b/Doxyfile.user @@ -230,43 +230,48 @@ TAB_SIZE = 4 # Enhance Fish docs output from Doxygen. (See fish_lexicon_filter.in) -ALIASES = "key{1}=\1" -ALIASES += "key{2}=\1-\2" -ALIASES += "key{3}=\1-\2" -ALIASES += "cursor_key{2}=\1" - -ALIASES += "fish=\htmlonly[block] \n
"
-ALIASES               += "fish{1}=\htmlonly[block] \n
"
-ALIASES               += "endfish=
\endhtmlonly \n" - -ALIASES += "asis{1}=\1" -ALIASES += "blah{1}=\1" -ALIASES += "cmnd{1}=\1" -ALIASES += "func{1}=\1" -ALIASES += "sbin{1}=\1" -ALIASES += "args{1}=\1" -ALIASES += "opts{1}=\1" -ALIASES += "vars{1}=\1" -ALIASES += "optr{1}=\1" -ALIASES += "redr{1}=\1" -ALIASES += "fsfo{1}=\1" -ALIASES += "path{1}=\1" -ALIASES += "clrv{1}=\1" - -ALIASES += "strg{1}=\1" -ALIASES += "sglq{1}='\1'" -ALIASES += "dblq{1}=\"\1\"" - -ALIASES += "prmt{1}=" -ALIASES += "sgst{1}=" -ALIASES += "eror{1}=" -ALIASES += "curs{1}=" - -ALIASES += "bold{1}=\1" -ALIASES += "emph{1}=\1" -ALIASES += "undr{1}=\1" -ALIASES += "span{2}=\2" -ALIASES += "spcl{2}=\2" +ALIASES = "key{1}=\1" +ALIASES += "key{2}=\1-\2" +ALIASES += "key{3}=\1-\2" +ALIASES += "cursor_key{2}=\1" + +ALIASES += "fish=\htmlonly[block] \n
"
+ALIASES += "fish{1}=\htmlonly[block] \n
"
+ALIASES += "endfish=
\endhtmlonly \n" + +ALIASES += "asis{1}=\1" +ALIASES += "outp{1}=\1" +ALIASES += "blah{1}=#\1" +ALIASES += "cmnd{1}=\1" +ALIASES += "func{1}=\1" +ALIASES += "sbin{1}=\1" +ALIASES += "args{1}=\1" +ALIASES += "opts{1}=\1" +ALIASES += "vars{1}=\1" +ALIASES += "optr{1}=\1" +ALIASES += "redr{1}=\1" +ALIASES += "fsfo{1}=\1" +ALIASES += "path{1}=\1" +ALIASES += "clrv{1}=\1" + +ALIASES += "strg{1}=\1" +ALIASES += "sglq{1}='\1'" +ALIASES += "dblq{1}=\"\1\"" + +ALIASES += "prmt=>" +ALIASES += "prmt{1}=\1>" +ALIASES += "sgst{1}=\1" +ALIASES += "mtch{1}=\1" +ALIASES += "smtc{1}=\1" +ALIASES += "eror{1}=\1" +ALIASES += "curs= " +ALIASES += "curs{1}=\1" + +ALIASES += "bold{1}=\1" +ALIASES += "emph{1}=\1" +ALIASES += "undr{1}=\1" +ALIASES += "span{2}=\2" +ALIASES += "spcl{2}=\2" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" diff --git a/Makefile.in b/Makefile.in index cd1c5738..afcba3c9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -259,8 +259,8 @@ prof: all # The sed command deletes everything including and after the first -, for simpler version numbers # Cleans up the user_doc/html directory once Doxygen is done. -user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) doc_src/fish_lexicon_filter - (cat Doxyfile.user; echo INPUT_FILTER=doc_src/fish_lexicon_filter; \ +user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter + (cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \ echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | sed "s/-.*//") | doxygen - && touch user_doc; \ cd user_doc/html; rm -f bc_s.png bdwn.png closed.png ftv2*.png nav*.png open.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html @@ -276,8 +276,8 @@ doc_src/user_doc.css: doc_src/user_doc.css.in doc_src/fish_lexicon_filter # Source code documentation. Also includes user documentation. # -doc: *.h *.cpp doc.h Doxyfile - (cat Doxyfile; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ; +doc: *.h *.cpp doc.h Doxyfile lexicon_filter + (cat Doxyfile; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ; # @@ -368,6 +368,7 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES -e "s|'\(.*\)'|func \1|p"; \ sed >lexicon.tmp -n \ -e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \ + echo "sbin whoami\nsbin mkdir\nsbin basename" >> lexicon.tmp; \ mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt; # @@ -381,14 +382,19 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES # providing suitable CSS in user_doc.css.in # -doc_src/fish_lexicon_filter: lexicon.txt doc_src/fish_lexicon_filter.in +lexicon_filter: lexicon.txt lexicon_filter.in -rm $@.tmp $@ # Clean the filter input comments and set the shebang as sed can reside in # /bin or /usr/bin and some versions dont allow more than one comment!. - sed <$@.in >$@.tmp -e 's|@sed@|'"`command -v sed`"'|' -e '/^[ ]*#[^!]/d' + sed <$@.in >$@.tmp -e 's|@sed@|'"`which sed`"'|' -e '/^[ ]*#[^!]/d' # Scan through the lexicon, transforming each line to something useful to Doxygen. + if `echo "x" | sed "/[[:<:]]x/d"`; then \ + WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \ + else\ + WORDBL='\\<'; WORDBR='\\>'; \ + fi; \ sed >$@.tmp -n \ - -e 's|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,[[:<:]]\2[[:>:]],@\1{\2},g|p' \ + -e "s|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,$$WORDBL\2$$WORDBR,@\1{\2},g|p" \ -e '$$G;s/.*\n/b tidy/p'; \ mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi @@ -493,11 +499,11 @@ common.o: $(COMMON_FILES) # There ought to be something simpler. # -share/man: $(HELP_SRC) doc_src/fish_lexicon_filter +share/man: $(HELP_SRC) lexicon_filter -mkdir share/man touch share/man -rm -Rf share/man/man1 - PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| sed "s/-.*//"` INPUT_FILTER=doc_src/fish_lexicon_filter \ + PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| sed "s/-.*//"` INPUT_FILTER=./lexicon_filter \ ./build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share # @@ -812,7 +818,7 @@ clean: rm -f $(PROGRAMS) fish_tests key_reader rm -f command_list.txt command_list_toc.txt toc.txt rm -f doc_src/index.hdr doc_src/commands.hdr - rm -f doc_src/fish_lexicon_filter lexicon.txt debug-lexicon.log + rm -f lexicon_filter lexicon.txt lexicon.log rm -f FISH-BUILD-VERSION-FILE if test "$(HAVE_DOXYGEN)" = 1; then \ rm -rf doc user_doc share/man; \ diff --git a/doc_src/alias.txt b/doc_src/alias.txt index c1450cc4..079cabff 100644 --- a/doc_src/alias.txt +++ b/doc_src/alias.txt @@ -23,11 +23,9 @@ The following code will create `rmi`, which runs `rm` with additional arguments \fish alias rmi "rm -i" -\endfish -This is equivalent to entering the following function: +# This is equivalent to entering the following function: -\fish function rmi rm -i $argv end diff --git a/doc_src/commands.hdr.in b/doc_src/commands.hdr.in index 12269b2b..fb9ebefa 100644 --- a/doc_src/commands.hdr.in +++ b/doc_src/commands.hdr.in @@ -1,5 +1,5 @@ -/** \page commands Commands - +/** +\page commands Commands \htmlonly[block]