git.iko.soy/typeable/pandoc
on master help sign in
Made wrapper scripts sensitive to PANDOC_OPTS environment variable,
69e23affiddlosopher
@@ -141,6 +141,19 @@ is in the path, and some have additional requirements. (For example,
141
141
142 creates a file `mytextfile.pdf`.
142 creates a file `mytextfile.pdf`.
143
143
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+
144# Command-line options
157# Command-line options
145
158
146Various command-line options can be used to customize the output.
159Various command-line options can be used to customize the output.
html2markdown+2−2
@@ -12,7 +12,7 @@
12}
12}
13
13
14if [ -z "$1" ] || [ -f $1 ]; then
14if [ -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
16else
16else
17 # Treat given argument as an URL. Locate a
17 # Treat given argument as an URL. Locate a
18 # sensible text based browser (note the order).
18 # sensible text based browser (note the order).
@@ -35,5 +35,5 @@ else
35 exit 1 ;;
35 exit 1 ;;
36 esac
36 esac
37 # Fetch and feed to pandoc.
37 # 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
39fi
39fi
latex2markdown+1−1
@@ -4,4 +4,4 @@
4 echo >&2 "You need 'pandoc' to use this program!"
4 echo >&2 "You need 'pandoc' to use this program!"
5 exit 1
5 exit 1
6}
6}
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 @@
2.SH NAME
2.SH NAME
3html2markdown \- converts HTML to markdown-formatted text
3html2markdown \- converts HTML to markdown-formatted text
4.SH SYNOPSIS
4.SH SYNOPSIS
5−.B html2markdown
5+\fBhtml2markdown\fR [ \fIinput-file\fR or \fIURL\fR ]
6−[
7−.I input-file
8−or
9−.I URL
10−]
11.SH DESCRIPTION
6.SH DESCRIPTION
12−.I html2markdown
7+\fBhtml2markdown\fR converts \fIinput-file\fR or \fIURL\fR
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
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
19−(e.g. wget, w3m, lynx or curl) to fetch the contents of the URL.
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.
20.SH "SEE ALSO"
15.SH "SEE ALSO"
21\fBpandoc\fR(1),
16\fBpandoc\fR(1),
22\fBmarkdown2html\fR(1),
17\fBmarkdown2html\fR(1),
man/man1/latex2markdown.1+6−7
@@ -2,15 +2,14 @@
2.SH NAME
2.SH NAME
3latex2markdown \- converts LaTeX to markdown-formatted text
3latex2markdown \- converts LaTeX to markdown-formatted text
4.SH SYNOPSIS
4.SH SYNOPSIS
5−.B latex2markdown
5+\fBlatex2markdown\fR [ \fIinput-file\fR ]
6−[
7−.I input-file
8−]
9.SH DESCRIPTION
6.SH DESCRIPTION
10−.I latex2markdown
7+\fBlatex2markdown\fR converts \fIinput-file\fR
11−converts
12−.I input-file
13(or text from STDIN) from LaTeX to markdown-formatted plain text.
8(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.
14.SH "SEE ALSO"
13.SH "SEE ALSO"
15\fBpandoc\fR(1),
14\fBpandoc\fR(1),
16\fBmarkdown2html\fR(1),
15\fBmarkdown2html\fR(1),
man/man1/markdown2html.1+6−7
@@ -2,17 +2,16 @@
2.SH NAME
2.SH NAME
3markdown2html \- converts markdown-formatted text to HTML
3markdown2html \- converts markdown-formatted text to HTML
4.SH SYNOPSIS
4.SH SYNOPSIS
5−.B markdown2html
5+\fBmarkdown2html\fR [ \fIinput-files\fR ]
6−[
7−.I input-files
8−]
9.SH DESCRIPTION
6.SH DESCRIPTION
10−.I markdown2html
7+\fBmarkdown2html\fR converts \fIinput-files\fR
11−converts
12−.I input-files
13(or text from STDIN) from markdown-formatted plain text to HTML.
8(or text from STDIN) from markdown-formatted plain text to HTML.
14If multiple files are specified, they will be combined to make a single
9If multiple files are specified, they will be combined to make a single
15HTML document.
10HTML 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.
16.SH "SEE ALSO"
15.SH "SEE ALSO"
17\fBpandoc\fR(1),
16\fBpandoc\fR(1),
18\fBhtml2markdown\fR(1),
17\fBhtml2markdown\fR(1),
man/man1/markdown2latex.1+8−10
@@ -2,17 +2,15 @@
2.SH NAME
2.SH NAME
3markdown2latex \- converts markdown-formatted text to LaTeX
3markdown2latex \- converts markdown-formatted text to LaTeX
4.SH SYNOPSIS
4.SH SYNOPSIS
5−.B markdown2latex
5+\fBmarkdown2latex\fR [ \fIinput-files\fR ]
6−[
7−.I input-files
8−]
9.SH DESCRIPTION
6.SH DESCRIPTION
10−.I markdown2latex
7+\fBmarkdown2latex\fR converts \fIinput-files\fR (or text from STDIN)
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
8+from markdown-formatted plain text to LaTeX. If multiple files are
15−be combined to make a single LaTeX document.
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.
16.SH "SEE ALSO"
14.SH "SEE ALSO"
17\fBpandoc\fR(1),
15\fBpandoc\fR(1),
18\fBmarkdown2html\fR(1),
16\fBmarkdown2html\fR(1),
man/man1/markdown2pdf.1+13−21
@@ -2,28 +2,20 @@
2.SH NAME
2.SH NAME
3markdown2pdf \- converts markdown-formatted text to PDF, using pdflatex
3markdown2pdf \- converts markdown-formatted text to PDF, using pdflatex
4.SH SYNOPSIS
4.SH SYNOPSIS
5−.B markdown2pdf
5+\fBmarkdown2pdf\fR [ \fB-o|--output\fR \fIoutput-file\fR ]
6−[
6+[ \fIinput-file\fR ]
7−.B -o|--output
8−.I output-file
9−] [
10−.I input-file
11−]
12.SH DESCRIPTION
7.SH DESCRIPTION
13−.I markdown2pdf
14−converts
15−.I input-file
16−(or text from STDIN) from markdown-formatted
8+\fBmarkdown2pdf\fR converts \fIinput-file\fR (or text from STDIN) from
17−plain text to PDF, using
9+markdown-formatted plain text to PDF, using \fBpdflatex\fR. If no output
18−.I pdflatex.
19−If no output filename is specified, the name of the output file is derived
10+filename is specified, the name of the output file is derived from the
20−from the input file; thus, for example, if the input file is
11+input file; thus, for example, if the input file is \fIhello.txt\fR,
21−.IR hello.txt ,
22−the output file will be
12+the output file will be \fIhello.pdf\fR. If the input is read from STDIN
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
13+and no output filename is specified, the output file will be named
26−.IR stdin.pdf .
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.
27.SH "SEE ALSO"
19.SH "SEE ALSO"
28\fBpandoc\fR(1),
20\fBpandoc\fR(1),
29\fBmarkdown2html\fR(1),
21\fBmarkdown2html\fR(1),
man/man1/pandoc.1+25−54
@@ -2,48 +2,33 @@
2.SH NAME
2.SH NAME
3pandoc \- general markup converter
3pandoc \- general markup converter
4.SH SYNOPSIS
4.SH SYNOPSIS
5−.B pandoc
5+\fBpandoc\fR [ \fIoptions\fR ] [ \fIinput-files\fR ]
6−[
7−.I options
8−] [
9−.I input-files
10−]
11
6
12.SH DESCRIPTION
7.SH DESCRIPTION
13−.I Pandoc
14−converts files from one markup format to another. It can read markdown
8+\fIPandoc\fR converts files from one markup format to another. It can
15−and (subsets of) reStructuredText, HTML, and LaTeX, and it can write
9+read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and
16−markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML slide shows.
10+it can write markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML
11+slide shows.
17.PP
12.PP
18−If no
19−.I input-files
20−are specified, input is read from STDIN. Otherwise, the
13+If no \fIinput-files\fR are specified, input is read from STDIN. Otherwise,
21−.I input-files
22−are concatenated (with a blank line between each) and used
14+the \fIinput-files\fR are concatenated (with a blank line between each)
23−as input. Output goes to STDOUT. If you want output to a file,
15+and used as input. Output goes to STDOUT. If you want output to a file,
24use shell redirection:
16use shell redirection:
25.IP
17.IP
26.B pandoc input.txt > output.html
18.B pandoc input.txt > output.html
27.PP
19.PP
28−The default behavior of
20+The default behavior of \fIPandoc\fR is to convert the input from
29−.I Pandoc
30−is to convert the
31−input from markdown-formatted plain text to HTML. Different
21+markdown-formatted plain text to HTML. Different input and output
32−input and output formats can be specified using command-line
22+formats can be specified using command-line options. For example,
33−options. For example,
34.IP
23.IP
35.B pandoc -f latex -t markdown chap1.tex > chap1.txt
24.B pandoc -f latex -t markdown chap1.tex > chap1.txt
36.PP
25.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.
40See below for a detailed list of command-line options.
27See below for a detailed list of command-line options.
41.PP
28.PP
42−.I Pandoc
43−uses the UTF-8 character encoding for both input and output.
29+\fIPandoc\fR uses the UTF-8 character encoding for both input and output.
44−If your local character encoding is not UTF-8, you should pipe
30+If your local character encoding is not UTF-8, you should pipe input
45−input and output through
31+and output through \fBiconv\fR:
46−.BR iconv :
47.IP
32.IP
48.B iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
33.B iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
49
34
@@ -123,41 +108,27 @@ Link to a CSS style sheet.
123is the pathname of the style sheet.
108is the pathname of the style sheet.
124.TP
109.TP
125.B \-H FILENAME, \-\-include-in-header=FILENAME
110.B \-H FILENAME, \-\-include-in-header=FILENAME
126−Include contents of
127−.I FILENAME
128−at the end of the header. Implies
111+Include contents of \fIFILENAME\fR at the end of the header. Implies
129−.BR \-s .
112+\fB\-s\fR.
130.TP
113.TP
131.B \-B FILENAME, \-\-include-before-body=FILENAME
114.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.
135.TP
116.TP
136.B \-A FILENAME, \-\-include-after-body=FILENAME
117.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.
140.TP
119.TP
141.B \-\-custom-header=FILENAME
120.B \-\-custom-header=FILENAME
142−Use contents of
121+Use contents of \fIFILENAME\fR
143−.I FILENAME
144as the document header (overriding the default header, which can be
122as the document header (overriding the default header, which can be
145−printed by using the
123+printed by using the \fB\-D\fR option). Implies
146−.B \-D
124+\fB-s\fR.
147−option). Implies
148−.BR \-s .
149.TP
125.TP
150.B \-D FORMAT, \-\-print-default-header=FORMAT
126.B \-D FORMAT, \-\-print-default-header=FORMAT
151−Print the default header for
127+Print the default header for \fIFORMAT\fR
152−.I FORMAT
153−(
154−.I html, s5, latex, markdown, rst, rtf
128+(\fIhtml, s5, latex, markdown, rst, rtf\fR).
155−).
156.TP
129.TP
157.B \-T STRING, \-\-title-prefix=STRING
130.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.
161
132
162.SH "SEE ALSO"
133.SH "SEE ALSO"
163\fBmarkdown2html\fR(1),
134\fBmarkdown2html\fR(1),
markdown2html+1−1
@@ -4,4 +4,4 @@
4 echo >&2 "You need 'pandoc' to use this program!"
4 echo >&2 "You need 'pandoc' to use this program!"
5 exit 1
5 exit 1
6}
6}
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 @@
4 echo >&2 "You need 'pandoc' to use this program!"
4 echo >&2 "You need 'pandoc' to use this program!"
5 exit 1
5 exit 1
6}
6}
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.$$
58trap "status=$?; rm -rf $TEMP; exit $status" 0 INT
58trap "status=$?; rm -rf $TEMP; exit $status" 0 INT
59mkdir -p $TEMP
59mkdir -p $TEMP
60
60
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
62(
62(
63 cd $TEMP
63 cd $TEMP
64 if ! pdflatex -interaction=batchmode $BASE.tex >/dev/null 2>&1; then
64 if ! pdflatex -interaction=batchmode $BASE.tex >/dev/null 2>&1; then