|
1 | 1 | '\" t |
2 | | -.\" Automatically generated by Pandoc 2.16 |
| 2 | +.\" Automatically generated by Pandoc 2.16.1 |
3 | 3 | .\" |
4 | | -.TH "Pandoc User\[cq]s Guide" "" "November 02, 2021" "pandoc 2.16.1" "" |
| 4 | +.TH "Pandoc User\[cq]s Guide" "" "November 20, 2021" "pandoc 2.16.2" "" |
5 | 5 | .hy |
6 | 6 | .SH NAME |
7 | 7 | pandoc - general markup converter |
@@ -304,6 +304,8 @@ if you need extensions not supported in \f[C]gfm\f[R]. |
304 | 304 | \f[C]twiki\f[R] (TWiki markup) |
305 | 305 | .IP \[bu] 2 |
306 | 306 | \f[C]vimwiki\f[R] (Vimwiki) |
| 307 | +.IP \[bu] 2 |
| 308 | +the path of a custom Lua reader, see Custom readers and writers below |
307 | 309 | .PP |
308 | 310 | Extensions can be individually enabled or disabled by appending |
309 | 311 | \f[C]+EXTENSION\f[R] or \f[C]-EXTENSION\f[R] to the format name. |
@@ -432,7 +434,7 @@ markup) |
432 | 434 | .IP \[bu] 2 |
433 | 435 | \f[C]zimwiki\f[R] (ZimWiki markup) |
434 | 436 | .IP \[bu] 2 |
435 | | -the path of a custom Lua writer, see Custom writers below |
| 437 | +the path of a custom Lua writer, see Custom readers and writers below |
436 | 438 | .PP |
437 | 439 | Note that \f[C]odt\f[R], \f[C]docx\f[R], \f[C]epub\f[R], and |
438 | 440 | \f[C]pdf\f[R] output will not be directed to \f[I]stdout\f[R] unless |
@@ -1598,6 +1600,11 @@ Error |
1598 | 1600 | T} |
1599 | 1601 | _ |
1600 | 1602 | T{ |
| 1603 | +1 |
| 1604 | +T}@T{ |
| 1605 | +PandocIOError |
| 1606 | +T} |
| 1607 | +T{ |
1601 | 1608 | 3 |
1602 | 1609 | T}@T{ |
1603 | 1610 | PandocFailOnWarningError |
@@ -1703,6 +1710,11 @@ T}@T{ |
1703 | 1710 | PandocFilterError |
1704 | 1711 | T} |
1705 | 1712 | T{ |
| 1713 | +84 |
| 1714 | +T}@T{ |
| 1715 | +PandocLuaError |
| 1716 | +T} |
| 1717 | +T{ |
1706 | 1718 | 91 |
1707 | 1719 | T}@T{ |
1708 | 1720 | PandocMacroLoop |
@@ -6216,7 +6228,7 @@ Include source position attributes when parsing \f[C]commonmark\f[R]. |
6216 | 6228 | For elements that accept attributes, a \f[C]data-pos\f[R] attribute is |
6217 | 6229 | added; other elements are placed in a surrounding Div or Span elemnet |
6218 | 6230 | with a \f[C]data-pos\f[R] attribute. |
6219 | | -.SS Extension: \f[C]short_subsuperscript\f[R] |
| 6231 | +.SS Extension: \f[C]short_subsuperscripts\f[R] |
6220 | 6232 | .PP |
6221 | 6233 | Parse multimarkdown style subscripts and superscripts, which start with |
6222 | 6234 | a `\[ti]' or `\[ha]' character, respectively, and include the |
@@ -7810,26 +7822,44 @@ text style. |
7810 | 7822 | With these custom styles, you can use your input document as a |
7811 | 7823 | reference-doc while creating docx output (see below), and maintain the |
7812 | 7824 | same styles in your input and output files. |
7813 | | -.SH CUSTOM WRITERS |
| 7825 | +.SH CUSTOM READERS AND WRITERS |
7814 | 7826 | .PP |
7815 | | -Pandoc can be extended with custom writers written in Lua. |
| 7827 | +Pandoc can be extended with custom readers and writers written in Lua. |
7816 | 7828 | (Pandoc includes a Lua interpreter, so Lua need not be installed |
7817 | 7829 | separately.) |
7818 | 7830 | .PP |
7819 | | -To use a custom writer, simply specify the path to the Lua script in |
7820 | | -place of the output format. |
| 7831 | +To use a custom reader or writer, simply specify the path to the Lua |
| 7832 | +script in place of the input or output format. |
7821 | 7833 | For example: |
7822 | 7834 | .IP |
7823 | 7835 | .nf |
7824 | 7836 | \f[C] |
7825 | 7837 | pandoc -t data/sample.lua |
| 7838 | +pandoc -f my_custom_markup_language.lua -t latex -s |
7826 | 7839 | \f[R] |
7827 | 7840 | .fi |
7828 | 7841 | .PP |
7829 | | -Creating a custom writer requires writing a Lua function for each |
7830 | | -possible element in a pandoc document. |
7831 | | -To get a documented example which you can modify according to your |
7832 | | -needs, do |
| 7842 | +A custom reader is a Lua script that defines one function, Reader, which |
| 7843 | +takes a string as input and returns a Pandoc AST. |
| 7844 | +See the Lua filters documentation for documentation of the functions |
| 7845 | +that are available for creating pandoc AST elements. |
| 7846 | +For parsing, the lpeg parsing library is available by default. |
| 7847 | +To see a sample custom reader: |
| 7848 | +.IP |
| 7849 | +.nf |
| 7850 | +\f[C] |
| 7851 | +pandoc --print-default-data-file creole.lua |
| 7852 | +\f[R] |
| 7853 | +.fi |
| 7854 | +.PP |
| 7855 | +If you want your custom reader to have access to reader options |
| 7856 | +(e.g.\ the tab stop setting), you give your Reader function a second |
| 7857 | +\f[C]options\f[R] parameter. |
| 7858 | +.PP |
| 7859 | +A custom writer is a Lua script that defines a function that specifies |
| 7860 | +how to render each element in a Pandoc AST. |
| 7861 | +To see a documented example which you can modify according to your |
| 7862 | +needs: |
7833 | 7863 | .IP |
7834 | 7864 | .nf |
7835 | 7865 | \f[C] |
|
0 commit comments