aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/Makefile4
-rw-r--r--web/demos64
-rwxr-xr-xweb/mkdemos.pl27
-rwxr-xr-xweb/mkdemos.sh68
4 files changed, 93 insertions, 70 deletions
diff --git a/web/Makefile b/web/Makefile
index d37568b1b..ece37e8a0 100644
--- a/web/Makefile
+++ b/web/Makefile
@@ -10,8 +10,8 @@ clean:
for file in $(ALL); do rm $$file; done; \
rm -r example*;
-examples.txt : $(PANDOC_DEPS) mkdemos.sh
- ./mkdemos.sh . $(PANDOC_PATH) > $@
+examples.txt : $(PANDOC_DEPS) mkdemos.pl
+ PATH=$(PANDOC_PATH):$$PATH ./mkdemos.pl demos $@
%.html : %.txt $(PANDOC_DEPS)
$(MAKEPAGE) $< > $@
diff --git a/web/demos b/web/demos
new file mode 100644
index 000000000..de427df26
--- /dev/null
+++ b/web/demos
@@ -0,0 +1,64 @@
+% Pandoc examples
+
+To see the output created by each of the commands below,
+click on the name of the output file:
+
+1. HTML fragment:
+
+@ pandoc README -o example1.html
+
+2. Standalone HTML file:
+
+@ pandoc -s -S README -o example2.html
+
+3. HTML with smart quotes, CSS, and custom header and footer:
+
+@ pandoc -s -S -c main.css -B header.html -A footer.html README -o example3.html
+
+4. LaTeX:
+
+@ pandoc -s README -o example4.tex
+
+5. From LaTeX to markdown:
+
+@ pandoc -s README.tex -o example5.txt
+
+6. reStructuredText:
+
+@ pandoc -s -w rst README -o example6.txt
+
+7. Rich text format (RTF):
+
+@ pandoc -s README -o example7.rtf
+
+8. S5 HTML slide show (all in one file):
+
+@ pandoc -s -m -i -w s5 S5DEMO -o example8.html
+
+9. DocBook XML:
+
+@ pandoc -s -S -w docbook README -o example9.db
+
+10. Chunked XHTML via DocBook and [xmlto]:
+
+@ xmlto xhtml example9.db -o example10/
+
+11. ODF (open document format) via DocBook and [docbook2odf]:
+
+@ docbook2odf --input-file example9.db --output-file example11.odf
+
+12. Converting a web page to markdown:
+
+@ html2markdown http://www.gnu.org/software/make/ -o example12.txt
+
+13. From markdown to PDF:
+
+@ markdown2pdf README -o example13.pdf
+
+14. PDF with numbered sections and a custom LaTeX header:
+
+@ markdown2pdf -N -C myheader.tex README -o example14.pdf
+
+[xmlto]: http://cyberelk.net/tim/xmlto/
+[docbook2odf]: http://open.comsultia.com/docbook2odf/
+
diff --git a/web/mkdemos.pl b/web/mkdemos.pl
new file mode 100755
index 000000000..02e5da2f6
--- /dev/null
+++ b/web/mkdemos.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+# first argument is input filename - a demo template.
+# second argument is output filename.
+
+my $infile=$ARGV[0];
+my $outfile=$ARGV[1];
+
+open( IN, "< $infile" );
+open( OUT, "> $outfile" );
+
+while (<IN>) {
+
+ my $line = $_;
+ my $firstchar = substr ($line,0,1);
+ if ( $firstchar eq '@' ) {
+ my $command = substr ($line,4);
+ print STDERR "$command";
+ system "$command";
+ $line = $command;
+ $line =~ s/-/\-/;
+ $line =~ s/ ([A-Za-z0-9_:\/]+(\.|\/)[a-zA-Z0-9.\/]*|README|S5DEMO)/ <a href="$1">$1<\/a>/g;
+ $line =~ s/-/\\-/g;
+ $line =~ s/^(.*)$/ <code>$1<\/code>/g;
+ }
+ print OUT $line;
+
+}
diff --git a/web/mkdemos.sh b/web/mkdemos.sh
deleted file mode 100755
index 3e2ad2d2b..000000000
--- a/web/mkdemos.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh -e
-# creates example page for pandoc
-# argument #1 is the destination directory
-# argument #2 is pandoc path
-
-DEST=$1
-PROGPATH=$2
-
-NEWLINE='
-'
-EXAMPLES='HTML fragment:
-pandoc README -o example0.html
-Standalone HTML file:
-pandoc -s -S README -o example0.html
-HTML with smart quotes, CSS, and custom header and footer:
-pandoc -s -S -c main.css -B header.html -A footer.html README -o example0.html
-LaTeX:
-pandoc -s README -o example0.tex
-From LaTeX to markdown:
-pandoc -s README.tex -o example0.txt
-reStructuredText:
-pandoc -s -w rst README -o example0.txt
-Rich text format (RTF):
-pandoc -s README -o example0.rtf
-S5 HTML slide show (all in one file):
-pandoc -s -m -i -w s5 S5DEMO -o example0.html
-Docbook XML:
-pandoc -s -S -w docbook README -o example0.db
-Chunked XHTML via Docbook and the third-party `xmlto` tool:
-xmlto xhtml example(-1).db -o example0/
-Converting a web page to markdown:
-html2markdown http://www.gnu.org/software/make/ -o example0.txt
-From markdown to PDF:
-markdown2pdf README -o example0.pdf
-PDF with numbered sections and a custom LaTeX header:
-markdown2pdf -N -C myheader.tex README -o example0.pdf'
-
-oldifs=$IFS
-IFS=$NEWLINE
-set -- $EXAMPLES
-IFS=$oldifs
-
-cd $DEST
-
-echo '% Pandoc examples
-
-To see the output created by each of the commands below,
-click on the name of the output file:
-
-'
-num=0
-while [ $# -gt 0 ]; do
- description="$1"
- lastnum=$num
- num=$(($num + 1))
- command=$(echo $2 | sed -e "s/0/$num/" -e "s/(-1)/$lastnum/")
- firstpart=$(echo $command | sed -e 's/\(.*\) [^ ]* -o.*/\1/')
- input=$(echo $command | sed -e 's/.* \([^ ]*\) -o.*/\1/')
- output=$(echo $command | sed -e 's/.*-o \(.*\)/\1/')
- echo "1. $description"
- echo
- echo " <code>$firstpart <a href=\""$input"\" title=\""View input file"\">$input</a> -o <a href=\""$output"\" title=\""View pandoc output"\">$output</a></code>"
- echo $command >&2
- result=$(PATH=$PROGPATH:$PATH $command) # run the command and create output file
- shift
- shift
-done
-