3 # Christian Riddertrom 2003-11-124
6 if [[ "$1" == "" || "$1" == "-h" || "$1" == "--help" ]]; then
8 Fcn: Extract list of lfuns from a .C-file
13 -n Don't actually do anything
14 -r rev Use wget to retrieve release 'rev' from CVS web-interface
15 --normal Extract 'normal' functions
16 --no-normal Skip extracting 'normal' functions
17 --only-normal Only extract 'normal' functions
18 --fonts, --no-fonts and --only-fonts are similar to the above.
19 --accents, --no-accents and --only-accents are similar to the above.
20 --wiki-output Produce output in PmWiki-format
21 --wiki-page Produce a complete wiki-page (-r is required, and
22 no other options work)
24 # Extract 'normal' lfuns from release 1.3.3 (downloads file from the web)
26 # Same thing, but using the latest (VCS) version
29 Note: The output is normally the string for the user-command, followed
30 by a TAB and possibly a help string (for release lyx-1_3_3). However, if
31 the option '--wiki-output' is given, then a resulting line looks like this:
32 ||<user-command><TABs>||<help-text><TABs>||
34 To create a wiki page, use this sequence:
35 $S0 -r lyx-1_3_3 --wiki-page > LyxFunctionList1-3-3.pmwiki
42 [[ "$1" == --version ]] && { printf "%s\n" "$Version"; exit 0; }
44 # Use: Verbose [vLevel] formatString [arguments]
46 # Execute 'printf formatString [arguments]' if $Verbosity >= $vLevel,
47 # where the default value of $vLevel is 1, and the default is assumed if
48 # the length of the first argument is not one.
49 # Ex: Verbose 3 "Only printed if verbosity(%d) >= 3" "$Verbosity"
50 # Ex: Verbose "Only printed if verbosity >= 1"
52 Verbosity=0 # Default is Verbosity=0, i.e. no messages
54 if ((${#1} == 1)); then vLevel=$1; shift; else vLevel=1; fi
55 if (($Verbosity >= $vLevel)); then printf "$1\n" "${@:2}"; fi;
59 printf "$1\n" "${@:2}"
63 # Set default values for variables
71 dir0=~lyx/www/pmwiki # pmwiki/-directory
72 lyxDir=~lyx/www/sourcedoc
75 sedFile=`dirname $0`/make-lfun-list.sed
76 sedFileWiki=`dirname $0`/make-lfun-wiki.sed
77 baseURI=http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel
81 tmpResult=/tmp/lfuns.$$.tmp
84 while [[ "$1" != "" ]]; do
87 "-v") let ++Verbosity;;
91 -r) USE_WGET=1; rev=$2; shift;;
92 --normal) DO_NORMAL=1;;
94 --accents) DO_ACCENTS=1;;
95 --no-normal) DO_NORMAL=0;;
96 --no-fonts) DO_FONTS=0;;
97 --no-accents) DO_ACCENTS=0;;
98 --only-normal) DO_NORMAL=1; DO_FONTS=0; DO_ACCENTS=0;;
99 --only-fonts) DO_NORMAL=0; DO_FONTS=1; DO_ACCENTS=0;;
100 --only-accents) DO_NORMAL=0; DO_FONTS=0; DO_ACCENTS=1;;
101 --wiki-output) outputWiki=1;;
102 --wiki-page) outputPage=1;;
107 if(($outputPage)); then
109 !!!List of LyxFunctions in release $rev
111 The lists of [=LFUNs=] below were derived from from releaes $rev of [[LyxSrc:LyXAction.C?rev=lyx-1_3_3&content-type=text/vnd.viewcvs-markup src/LyXAction.C]].
112 Some of the commands below take arguments and others don't.
113 Feel free to add comments about what an LFUN does.
115 [[#various]]Various [=LFUNs=], sorted alphabetically:
118 $0 -r $rev --wiki-output
121 [[#font]][=LFUNs=] related to font commands:
123 $0 -r $rev --wiki-output --only-fonts
126 [[#accent]]Accent [=LFUNs=]:[[<<]]
127 Try for instance, @@M-x accent acute a@@ — which should give you the letter a with an ''acute'' above it. If you don't give an argument ('@@a@@' in the example), the command will be applied to the next letter you type.
129 $0 -r $rev --wiki-output --only-accents
133 Verbose "Processing options now finished."
134 if(($outputWiki)); then
135 Verbose "Redirecting output to %s" "$tmpResult"
140 if(($USE_WGET)); then
141 file=/tmp/$fileName-$rev-$$.C
142 wget -q -O $file "$baseURI/$srcDir/$fileName?rev=$rev"
144 file=$lyxDir/$srcDir/$fileName
147 function ExtractEnums() {
148 (($DO)) && sed -f $sedFile $file | sort
152 if (($DO && $DO_NORMAL)); then
153 ExtractEnums | grep -v '^\(font\|accent\)-'
156 if (($DO && $DO_FONTS)); then
157 ExtractEnums | grep '^\(font-\)'
160 if (($DO && $DO_ACCENTS)); then
161 ExtractEnums | grep '^\(accent-\)'
164 if(($outputWiki)); then
165 exec 1>&6 6>&- # Restore stdout and close file.desc.6
167 printf "||%-30s||%-28s||%s||\n" \
168 "'''Command string'''" "'''Help text'''" "'''Comment'''"
169 while read command helpText; do
170 printf "||%-30s||%-28s||\n" "$command" "$helpText"
176 if(($USE_WGET)); then