git.iko.soy/typeable/pandoc
on master help sign in
Made wrapper scripts sensitive to PANDOC_OPTS environment variable,

which may contain command-line options to be passed to pandoc. + Changed the scripts themselves, including $PANDOC_OPTS after 'pandoc' + Added ENVIRONMENT to man pages for wrappers + Formatting changes to man files + Added description of PANDOC_OPTS to README git-svn-id: https://pandoc.googlecode.com/svn/trunk@91 788f1e2b-df1e-0410-8736-df70ead52e1b

commit69e23af8e4198dc4e308935855662248a31c6dc2 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 12 Nov 2006, 01:50 (20 years ago) parent668a485
12 files changed+86−119
README+13 html2markdown+2−2 latex2markdown+1−1 man/man1/html2markdown.1+9−14 man/man1/latex2markdown.1+6−7 man/man1/markdown2html.1+6−7 man/man1/markdown2latex.1+8−10 man/man1/markdown2pdf.1+13−21 man/man1/pandoc.1+25−54 markdown2html+1−1 markdown2latex+1−1 markdown2pdf+1−1
README+13
@@ -141,6 +141,19 @@ is in the path, and some have additional requirements. (For example,
141141
142142 creates a file `mytextfile.pdf`.
143143
144+If you want to use pandoc's command-line options in these scripts,
145+put the options in the environment variable `PANDOC_OPTS`. For
146+example, to convert `tusks.txt` to `tusks.html` using smart quotes,
147+ellipses, and dashes, with "Elephants" as the page title prefix:
148+
149+ PANDOC_OPTS="-S -T Elephants" markdown2html tusks.txt > tusks.html
150+
151+To make these options persistent, use `export`:
152+
153+ export PANDOC_OPTS="-S -T Elephants"
154+ markdown2html tusks.txt > tusks.html
155+ markdown2html trunk.txt > trunk.html
156+
144157# Command-line options
145158
146159Various command-line options can be used to customize the output.
html2markdown+2−2
@@ -12,7 +12,7 @@
1212}
1313
1414if [ -z "$1" ] || [ -f $1 ]; then
15− tidy -utf8 $1 2>/dev/null | pandoc -r html -w markdown -s | iconv -f utf-8
15+ tidy -utf8 $1 2>/dev/null | pandoc $PANDOC_OPTS -r html -w markdown -s | iconv -f utf-8
1616else
1717 # Treat given argument as an URL. Locate a
1818 # sensible text based browser (note the order).
@@ -35,5 +35,5 @@ else
3535 exit 1 ;;
3636 esac
3737 # Fetch and feed to pandoc.
38− $DUMPER $OPT $1 2>/dev/null | tidy -utf8 2>/dev/null | pandoc -r html -w markdown -s | iconv -f utf-8
38+ $DUMPER $OPT $1 2>/dev/null | tidy -utf8 2>/dev/null | pandoc $PANDOC_OPTS -r html -w markdown -s | iconv -f utf-8
3939fi
latex2markdown+1−1
@@ -4,4 +4,4 @@
44 echo >&2 "You need 'pandoc' to use this program!"
55 exit 1
66}
7−iconv -t utf-8 $* | pandoc -r latex -w markdown -s | iconv -f utf-8
7+iconv -t utf-8 $* | pandoc $PANDOC_OPTS -r latex -w markdown -s | iconv -f utf-8
man/man1/html2markdown.1+9−14
@@ -2,21 +2,16 @@
22.SH NAME
33html2markdown \- converts HTML to markdown-formatted text
44.SH SYNOPSIS
5−.B html2markdown
6−[
7−.I input-file
8−or
9−.I URL
10−]
5+\fBhtml2markdown\fR [ \fIinput-file\fR or \fIURL\fR ]
116.SH DESCRIPTION
12−.I html2markdown
13−converts
14−.I input-file
15−or
16−.I URL
17−(or text from STDIN)
18−from HTML to markdown-formatted plain text. It uses an available program
19−(e.g. wget, w3m, lynx or curl) to fetch the contents of the URL.
7+\fBhtml2markdown\fR converts \fIinput-file\fR or \fIURL\fR
8+(or text from STDIN) from HTML to markdown-formatted plain text.
9+It uses an available program (e.g. wget, w3m, lynx or curl) to fetch
10+the contents of the URL.
11+.SH ENVIRONMENT
12+Any command-line options contained in the PANDOC_OPTS environment variable
13+will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1)
14+for a list of options that may be used.
2015.SH "SEE ALSO"
2116\fBpandoc\fR(1),
2217\fBmarkdown2html\fR(1),
man/man1/latex2markdown.1+6−7
@@ -2,15 +2,14 @@
22.SH NAME
33latex2markdown \- converts LaTeX to markdown-formatted text
44.SH SYNOPSIS
5−.B latex2markdown
6−[
7−.I input-file
8−]
5+\fBlatex2markdown\fR [ \fIinput-file\fR ]
96.SH DESCRIPTION
10−.I latex2markdown
11−converts
12−.I input-file
7+\fBlatex2markdown\fR converts \fIinput-file\fR
138(or text from STDIN) from LaTeX to markdown-formatted plain text.
9+.SH ENVIRONMENT
10+Any command-line options contained in the PANDOC_OPTS environment variable
11+will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1)
12+for a list of options that may be used.
1413.SH "SEE ALSO"
1514\fBpandoc\fR(1),
1615\fBmarkdown2html\fR(1),
man/man1/markdown2html.1+6−7
@@ -2,17 +2,16 @@
22.SH NAME
33markdown2html \- converts markdown-formatted text to HTML
44.SH SYNOPSIS
5−.B markdown2html
6−[
7−.I input-files
8−]
5+\fBmarkdown2html\fR [ \fIinput-files\fR ]
96.SH DESCRIPTION
10−.I markdown2html
11−converts
12−.I input-files
7+\fBmarkdown2html\fR converts \fIinput-files\fR
138(or text from STDIN) from markdown-formatted plain text to HTML.
149If multiple files are specified, they will be combined to make a single
1510HTML document.
11+.SH ENVIRONMENT
12+Any command-line options contained in the PANDOC_OPTS environment variable
13+will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1)
14+for a list of options that may be used.
1615.SH "SEE ALSO"
1716\fBpandoc\fR(1),
1817\fBhtml2markdown\fR(1),
man/man1/markdown2latex.1+8−10
@@ -2,17 +2,15 @@
22.SH NAME
33markdown2latex \- converts markdown-formatted text to LaTeX
44.SH SYNOPSIS
5−.B markdown2latex
6−[
7−.I input-files
8−]
5+\fBmarkdown2latex\fR [ \fIinput-files\fR ]
96.SH DESCRIPTION
10−.I markdown2latex
11−converts
12−.I input-files
13−(or text from STDIN) from markdown-formatted
14−plain text to LaTeX. If multiple files are specified, they will
15−be combined to make a single LaTeX document.
7+\fBmarkdown2latex\fR converts \fIinput-files\fR (or text from STDIN)
8+from markdown-formatted plain text to LaTeX. If multiple files are
9+specified, they will be combined to make a single LaTeX document.
10+.SH ENVIRONMENT
11+Any command-line options contained in the PANDOC_OPTS environment variable
12+will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1)
13+for a list of options that may be used.
1614.SH "SEE ALSO"
1715\fBpandoc\fR(1),
1816\fBmarkdown2html\fR(1),
man/man1/markdown2pdf.1+13−21
@@ -2,28 +2,20 @@
22.SH NAME
33markdown2pdf \- converts markdown-formatted text to PDF, using pdflatex
44.SH SYNOPSIS
5−.B markdown2pdf
6−[
7−.B -o|--output
8−.I output-file
9−] [
10−.I input-file
11−]
5+\fBmarkdown2pdf\fR [ \fB-o|--output\fR \fIoutput-file\fR ]
6+[ \fIinput-file\fR ]
127.SH DESCRIPTION
13−.I markdown2pdf
14−converts
15−.I input-file
16−(or text from STDIN) from markdown-formatted
17−plain text to PDF, using
18−.I pdflatex.
19−If no output filename is specified, the name of the output file is derived
20−from the input file; thus, for example, if the input file is
21−.IR hello.txt ,
22−the output file will be
23−.IR hello.pdf .
24−If the input is read from STDIN and no output filename is specified,
25−the output file will be named
26−.IR stdin.pdf .
8+\fBmarkdown2pdf\fR converts \fIinput-file\fR (or text from STDIN) from
9+markdown-formatted plain text to PDF, using \fBpdflatex\fR. If no output
10+filename is specified, the name of the output file is derived from the
11+input file; thus, for example, if the input file is \fIhello.txt\fR,
12+the output file will be \fIhello.pdf\fR. If the input is read from STDIN
13+and no output filename is specified, the output file will be named
14+\fIstdin.pdf\fR.
15+.SH ENVIRONMENT
16+Any command-line options contained in the PANDOC_OPTS environment variable
17+will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1)
18+for a list of options that may be used.
2719.SH "SEE ALSO"
2820\fBpandoc\fR(1),
2921\fBmarkdown2html\fR(1),
man/man1/pandoc.1+25−54
@@ -2,48 +2,33 @@
22.SH NAME
33pandoc \- general markup converter
44.SH SYNOPSIS
5−.B pandoc
6−[
7−.I options
8−] [
9−.I input-files
10−]
5+\fBpandoc\fR [ \fIoptions\fR ] [ \fIinput-files\fR ]
116
127.SH DESCRIPTION
13−.I Pandoc
14−converts files from one markup format to another. It can read markdown
15−and (subsets of) reStructuredText, HTML, and LaTeX, and it can write
16−markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML slide shows.
8+\fIPandoc\fR converts files from one markup format to another. It can
9+read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and
10+it can write markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML
11+slide shows.
1712.PP
18−If no
19−.I input-files
20−are specified, input is read from STDIN. Otherwise, the
21−.I input-files
22−are concatenated (with a blank line between each) and used
23−as input. Output goes to STDOUT. If you want output to a file,
13+If no \fIinput-files\fR are specified, input is read from STDIN. Otherwise,
14+the \fIinput-files\fR are concatenated (with a blank line between each)
15+and used as input. Output goes to STDOUT. If you want output to a file,
2416use shell redirection:
2517.IP
2618.B pandoc input.txt > output.html
2719.PP
28−The default behavior of
29−.I Pandoc
30−is to convert the
31−input from markdown-formatted plain text to HTML. Different
32−input and output formats can be specified using command-line
33−options. For example,
20+The default behavior of \fIPandoc\fR is to convert the input from
21+markdown-formatted plain text to HTML. Different input and output
22+formats can be specified using command-line options. For example,
3423.IP
3524.B pandoc -f latex -t markdown chap1.tex > chap1.txt
3625.PP
37−converts
38−.I chap1.tex
39−from LaTeX to markdown-formatted plain text.
26+converts \fIchap1.tex\fR from LaTeX to markdown-formatted plain text.
4027See below for a detailed list of command-line options.
4128.PP
42−.I Pandoc
43−uses the UTF-8 character encoding for both input and output.
44−If your local character encoding is not UTF-8, you should pipe
45−input and output through
46−.BR iconv :
29+\fIPandoc\fR uses the UTF-8 character encoding for both input and output.
30+If your local character encoding is not UTF-8, you should pipe input
31+and output through \fBiconv\fR:
4732.IP
4833.B iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
4934
@@ -123,41 +108,27 @@ Link to a CSS style sheet.
123108is the pathname of the style sheet.
124109.TP
125110.B \-H FILENAME, \-\-include-in-header=FILENAME
126−Include contents of
127−.I FILENAME
128−at the end of the header. Implies
129−.BR \-s .
111+Include contents of \fIFILENAME\fR at the end of the header. Implies
112+\fB\-s\fR.
130113.TP
131114.B \-B FILENAME, \-\-include-before-body=FILENAME
132−Include contents of
133−.I FILENAME
134−at the beginning of the document body.
115+Include contents of \fIFILENAME\fR at the beginning of the document body.
135116.TP
136117.B \-A FILENAME, \-\-include-after-body=FILENAME
137−Include contents of
138−.I FILENAME
139−at the end of the document body.
118+Include contents of \fIFILENAME\fR at the end of the document body.
140119.TP
141120.B \-\-custom-header=FILENAME
142−Use contents of
143−.I FILENAME
121+Use contents of \fIFILENAME\fR
144122as the document header (overriding the default header, which can be
145−printed by using the
146−.B \-D
147−option). Implies
148−.BR \-s .
123+printed by using the \fB\-D\fR option). Implies
124+\fB-s\fR.
149125.TP
150126.B \-D FORMAT, \-\-print-default-header=FORMAT
151−Print the default header for
152−.I FORMAT
153−(
154−.I html, s5, latex, markdown, rst, rtf
155−).
127+Print the default header for \fIFORMAT\fR
128+(\fIhtml, s5, latex, markdown, rst, rtf\fR).
156129.TP
157130.B \-T STRING, \-\-title-prefix=STRING
158−Specify
159−.I STRING
160−as a prefix to the HTML window title.
131+Specify \fISTRING\fR as a prefix to the HTML window title.
161132
162133.SH "SEE ALSO"
163134\fBmarkdown2html\fR(1),
markdown2html+1−1
@@ -4,4 +4,4 @@
44 echo >&2 "You need 'pandoc' to use this program!"
55 exit 1
66}
7−iconv -t utf-8 $* | pandoc | iconv -f utf-8
7+iconv -t utf-8 $* | pandoc $PANDOC_OPTS | iconv -f utf-8
markdown2latex+1−1
@@ -4,4 +4,4 @@
44 echo >&2 "You need 'pandoc' to use this program!"
55 exit 1
66}
7−iconv -t utf-8 $* | pandoc -w latex -s | iconv -f utf-8
7+iconv -t utf-8 $* | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8
markdown2pdf+1−1
@@ -58,7 +58,7 @@ TEMP=${TMPDIR-/tmp}/markdown2pdf.$$
5858trap "status=$?; rm -rf $TEMP; exit $status" 0 INT
5959mkdir -p $TEMP
6060
61−iconv -t utf-8 $infile | pandoc -w latex -s | iconv -f utf-8 > $TEMP/$BASE.tex
61+iconv -t utf-8 $infile | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8 > $TEMP/$BASE.tex
6262(
6363 cd $TEMP
6464 if ! pdflatex -interaction=batchmode $BASE.tex >/dev/null 2>&1; then