diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-11-12 01:50:56 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-11-12 01:50:56 +0000 |
commit | 69e23af8e4198dc4e308935855662248a31c6dc2 (patch) | |
tree | 3bd2ad4e0f5f1e75e828f07f0d5964be4ae6eef0 | |
parent | 668a48534edf47d5b65f5589af7ca9350f44a6d3 (diff) |
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
-rw-r--r-- | README | 13 | ||||
-rw-r--r-- | html2markdown | 4 | ||||
-rw-r--r-- | latex2markdown | 2 | ||||
-rw-r--r-- | man/man1/html2markdown.1 | 23 | ||||
-rw-r--r-- | man/man1/latex2markdown.1 | 13 | ||||
-rw-r--r-- | man/man1/markdown2html.1 | 13 | ||||
-rw-r--r-- | man/man1/markdown2latex.1 | 18 | ||||
-rw-r--r-- | man/man1/markdown2pdf.1 | 34 | ||||
-rw-r--r-- | man/man1/pandoc.1 | 79 | ||||
-rw-r--r-- | markdown2html | 2 | ||||
-rw-r--r-- | markdown2latex | 2 | ||||
-rw-r--r-- | markdown2pdf | 2 |
12 files changed, 86 insertions, 119 deletions
@@ -141,6 +141,19 @@ is in the path, and some have additional requirements. (For example, creates a file `mytextfile.pdf`. +If you want to use pandoc's command-line options in these scripts, +put the options in the environment variable `PANDOC_OPTS`. For +example, to convert `tusks.txt` to `tusks.html` using smart quotes, +ellipses, and dashes, with "Elephants" as the page title prefix: + + PANDOC_OPTS="-S -T Elephants" markdown2html tusks.txt > tusks.html + +To make these options persistent, use `export`: + + export PANDOC_OPTS="-S -T Elephants" + markdown2html tusks.txt > tusks.html + markdown2html trunk.txt > trunk.html + # Command-line options Various command-line options can be used to customize the output. diff --git a/html2markdown b/html2markdown index 8bae3a3bf..fb5734f39 100644 --- a/html2markdown +++ b/html2markdown @@ -12,7 +12,7 @@ } if [ -z "$1" ] || [ -f $1 ]; then - tidy -utf8 $1 2>/dev/null | pandoc -r html -w markdown -s | iconv -f utf-8 + tidy -utf8 $1 2>/dev/null | pandoc $PANDOC_OPTS -r html -w markdown -s | iconv -f utf-8 else # Treat given argument as an URL. Locate a # sensible text based browser (note the order). @@ -35,5 +35,5 @@ else exit 1 ;; esac # Fetch and feed to pandoc. - $DUMPER $OPT $1 2>/dev/null | tidy -utf8 2>/dev/null | pandoc -r html -w markdown -s | iconv -f utf-8 + $DUMPER $OPT $1 2>/dev/null | tidy -utf8 2>/dev/null | pandoc $PANDOC_OPTS -r html -w markdown -s | iconv -f utf-8 fi diff --git a/latex2markdown b/latex2markdown index d55c69268..eeffb9b1e 100644 --- a/latex2markdown +++ b/latex2markdown @@ -4,4 +4,4 @@ echo >&2 "You need 'pandoc' to use this program!" exit 1 } -iconv -t utf-8 $* | pandoc -r latex -w markdown -s | iconv -f utf-8 +iconv -t utf-8 $* | pandoc $PANDOC_OPTS -r latex -w markdown -s | iconv -f utf-8 diff --git a/man/man1/html2markdown.1 b/man/man1/html2markdown.1 index c1fe11474..5f6162d13 100644 --- a/man/man1/html2markdown.1 +++ b/man/man1/html2markdown.1 @@ -2,21 +2,16 @@ .SH NAME html2markdown \- converts HTML to markdown-formatted text .SH SYNOPSIS -.B html2markdown -[ -.I input-file -or -.I URL -] +\fBhtml2markdown\fR [ \fIinput-file\fR or \fIURL\fR ] .SH DESCRIPTION -.I html2markdown -converts -.I input-file -or -.I URL -(or text from STDIN) -from HTML to markdown-formatted plain text. It uses an available program -(e.g. wget, w3m, lynx or curl) to fetch the contents of the URL. +\fBhtml2markdown\fR converts \fIinput-file\fR or \fIURL\fR +(or text from STDIN) from HTML to markdown-formatted plain text. +It uses an available program (e.g. wget, w3m, lynx or curl) to fetch +the contents of the URL. +.SH ENVIRONMENT +Any command-line options contained in the PANDOC_OPTS environment variable +will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1) +for a list of options that may be used. .SH "SEE ALSO" \fBpandoc\fR(1), \fBmarkdown2html\fR(1), diff --git a/man/man1/latex2markdown.1 b/man/man1/latex2markdown.1 index b4acd363c..f60aeffe9 100644 --- a/man/man1/latex2markdown.1 +++ b/man/man1/latex2markdown.1 @@ -2,15 +2,14 @@ .SH NAME latex2markdown \- converts LaTeX to markdown-formatted text .SH SYNOPSIS -.B latex2markdown -[ -.I input-file -] +\fBlatex2markdown\fR [ \fIinput-file\fR ] .SH DESCRIPTION -.I latex2markdown -converts -.I input-file +\fBlatex2markdown\fR converts \fIinput-file\fR (or text from STDIN) from LaTeX to markdown-formatted plain text. +.SH ENVIRONMENT +Any command-line options contained in the PANDOC_OPTS environment variable +will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1) +for a list of options that may be used. .SH "SEE ALSO" \fBpandoc\fR(1), \fBmarkdown2html\fR(1), diff --git a/man/man1/markdown2html.1 b/man/man1/markdown2html.1 index 63ad7a085..76b449ec8 100644 --- a/man/man1/markdown2html.1 +++ b/man/man1/markdown2html.1 @@ -2,17 +2,16 @@ .SH NAME markdown2html \- converts markdown-formatted text to HTML .SH SYNOPSIS -.B markdown2html -[ -.I input-files -] +\fBmarkdown2html\fR [ \fIinput-files\fR ] .SH DESCRIPTION -.I markdown2html -converts -.I input-files +\fBmarkdown2html\fR converts \fIinput-files\fR (or text from STDIN) from markdown-formatted plain text to HTML. If multiple files are specified, they will be combined to make a single HTML document. +.SH ENVIRONMENT +Any command-line options contained in the PANDOC_OPTS environment variable +will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1) +for a list of options that may be used. .SH "SEE ALSO" \fBpandoc\fR(1), \fBhtml2markdown\fR(1), diff --git a/man/man1/markdown2latex.1 b/man/man1/markdown2latex.1 index 5529f75ab..374896e5b 100644 --- a/man/man1/markdown2latex.1 +++ b/man/man1/markdown2latex.1 @@ -2,17 +2,15 @@ .SH NAME markdown2latex \- converts markdown-formatted text to LaTeX .SH SYNOPSIS -.B markdown2latex -[ -.I input-files -] +\fBmarkdown2latex\fR [ \fIinput-files\fR ] .SH DESCRIPTION -.I markdown2latex -converts -.I input-files -(or text from STDIN) from markdown-formatted -plain text to LaTeX. If multiple files are specified, they will -be combined to make a single LaTeX document. +\fBmarkdown2latex\fR converts \fIinput-files\fR (or text from STDIN) +from markdown-formatted plain text to LaTeX. If multiple files are +specified, they will be combined to make a single LaTeX document. +.SH ENVIRONMENT +Any command-line options contained in the PANDOC_OPTS environment variable +will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1) +for a list of options that may be used. .SH "SEE ALSO" \fBpandoc\fR(1), \fBmarkdown2html\fR(1), diff --git a/man/man1/markdown2pdf.1 b/man/man1/markdown2pdf.1 index 420c1bd86..dfbfd819e 100644 --- a/man/man1/markdown2pdf.1 +++ b/man/man1/markdown2pdf.1 @@ -2,28 +2,20 @@ .SH NAME markdown2pdf \- converts markdown-formatted text to PDF, using pdflatex .SH SYNOPSIS -.B markdown2pdf -[ -.B -o|--output -.I output-file -] [ -.I input-file -] +\fBmarkdown2pdf\fR [ \fB-o|--output\fR \fIoutput-file\fR ] +[ \fIinput-file\fR ] .SH DESCRIPTION -.I markdown2pdf -converts -.I input-file -(or text from STDIN) from markdown-formatted -plain text to PDF, using -.I pdflatex. -If no output filename is specified, the name of the output file is derived -from the input file; thus, for example, if the input file is -.IR hello.txt , -the output file will be -.IR hello.pdf . -If the input is read from STDIN and no output filename is specified, -the output file will be named -.IR stdin.pdf . +\fBmarkdown2pdf\fR converts \fIinput-file\fR (or text from STDIN) from +markdown-formatted plain text to PDF, using \fBpdflatex\fR. If no output +filename is specified, the name of the output file is derived from the +input file; thus, for example, if the input file is \fIhello.txt\fR, +the output file will be \fIhello.pdf\fR. If the input is read from STDIN +and no output filename is specified, the output file will be named +\fIstdin.pdf\fR. +.SH ENVIRONMENT +Any command-line options contained in the PANDOC_OPTS environment variable +will be passed to \fBpandoc\fR by this wrapper script. See \fBpandoc\fR(1) +for a list of options that may be used. .SH "SEE ALSO" \fBpandoc\fR(1), \fBmarkdown2html\fR(1), diff --git a/man/man1/pandoc.1 b/man/man1/pandoc.1 index 6ca3bb9e4..0d0c1b09f 100644 --- a/man/man1/pandoc.1 +++ b/man/man1/pandoc.1 @@ -2,48 +2,33 @@ .SH NAME pandoc \- general markup converter .SH SYNOPSIS -.B pandoc -[ -.I options -] [ -.I input-files -] +\fBpandoc\fR [ \fIoptions\fR ] [ \fIinput-files\fR ] .SH DESCRIPTION -.I Pandoc -converts files from one markup format to another. It can read markdown -and (subsets of) reStructuredText, HTML, and LaTeX, and it can write -markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML slide shows. +\fIPandoc\fR converts files from one markup format to another. It can +read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and +it can write markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML +slide shows. .PP -If no -.I input-files -are specified, input is read from STDIN. Otherwise, the -.I input-files -are concatenated (with a blank line between each) and used -as input. Output goes to STDOUT. If you want output to a file, +If no \fIinput-files\fR are specified, input is read from STDIN. Otherwise, +the \fIinput-files\fR are concatenated (with a blank line between each) +and used as input. Output goes to STDOUT. If you want output to a file, use shell redirection: .IP .B pandoc input.txt > output.html .PP -The default behavior of -.I Pandoc -is to convert the -input from markdown-formatted plain text to HTML. Different -input and output formats can be specified using command-line -options. For example, +The default behavior of \fIPandoc\fR is to convert the input from +markdown-formatted plain text to HTML. Different input and output +formats can be specified using command-line options. For example, .IP .B pandoc -f latex -t markdown chap1.tex > chap1.txt .PP -converts -.I chap1.tex -from LaTeX to markdown-formatted plain text. +converts \fIchap1.tex\fR from LaTeX to markdown-formatted plain text. See below for a detailed list of command-line options. .PP -.I Pandoc -uses the UTF-8 character encoding for both input and output. -If your local character encoding is not UTF-8, you should pipe -input and output through -.BR iconv : +\fIPandoc\fR uses the UTF-8 character encoding for both input and output. +If your local character encoding is not UTF-8, you should pipe input +and output through \fBiconv\fR: .IP .B iconv -t utf-8 input.txt | pandoc | iconv -f utf-8 @@ -123,41 +108,27 @@ Link to a CSS style sheet. is the pathname of the style sheet. .TP .B \-H FILENAME, \-\-include-in-header=FILENAME -Include contents of -.I FILENAME -at the end of the header. Implies -.BR \-s . +Include contents of \fIFILENAME\fR at the end of the header. Implies +\fB\-s\fR. .TP .B \-B FILENAME, \-\-include-before-body=FILENAME -Include contents of -.I FILENAME -at the beginning of the document body. +Include contents of \fIFILENAME\fR at the beginning of the document body. .TP .B \-A FILENAME, \-\-include-after-body=FILENAME -Include contents of -.I FILENAME -at the end of the document body. +Include contents of \fIFILENAME\fR at the end of the document body. .TP .B \-\-custom-header=FILENAME -Use contents of -.I FILENAME +Use contents of \fIFILENAME\fR as the document header (overriding the default header, which can be -printed by using the -.B \-D -option). Implies -.BR \-s . +printed by using the \fB\-D\fR option). Implies +\fB-s\fR. .TP .B \-D FORMAT, \-\-print-default-header=FORMAT -Print the default header for -.I FORMAT -( -.I html, s5, latex, markdown, rst, rtf -). +Print the default header for \fIFORMAT\fR +(\fIhtml, s5, latex, markdown, rst, rtf\fR). .TP .B \-T STRING, \-\-title-prefix=STRING -Specify -.I STRING -as a prefix to the HTML window title. +Specify \fISTRING\fR as a prefix to the HTML window title. .SH "SEE ALSO" \fBmarkdown2html\fR(1), diff --git a/markdown2html b/markdown2html index d1475f4b6..60dd78a6f 100644 --- a/markdown2html +++ b/markdown2html @@ -4,4 +4,4 @@ echo >&2 "You need 'pandoc' to use this program!" exit 1 } -iconv -t utf-8 $* | pandoc | iconv -f utf-8 +iconv -t utf-8 $* | pandoc $PANDOC_OPTS | iconv -f utf-8 diff --git a/markdown2latex b/markdown2latex index a93aca7cd..3f78adbda 100644 --- a/markdown2latex +++ b/markdown2latex @@ -4,4 +4,4 @@ echo >&2 "You need 'pandoc' to use this program!" exit 1 } -iconv -t utf-8 $* | pandoc -w latex -s | iconv -f utf-8 +iconv -t utf-8 $* | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8 diff --git a/markdown2pdf b/markdown2pdf index b7b728807..eba975436 100644 --- a/markdown2pdf +++ b/markdown2pdf @@ -58,7 +58,7 @@ TEMP=${TMPDIR-/tmp}/markdown2pdf.$$ trap "status=$?; rm -rf $TEMP; exit $status" 0 INT mkdir -p $TEMP -iconv -t utf-8 $infile | pandoc -w latex -s | iconv -f utf-8 > $TEMP/$BASE.tex +iconv -t utf-8 $infile | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8 > $TEMP/$BASE.tex ( cd $TEMP if ! pdflatex -interaction=batchmode $BASE.tex >/dev/null 2>&1; then |