git.iko.soy/typeable/pandoc
on master help sign in
Update lua-filters doc from lua sources.
01ad939John MacFarlane
doc/lua-filters.md+710−678
@@ -11,10 +11,11 @@ title: Pandoc Lua Filters
11Pandoc has long supported filters, which allow the pandoc
11Pandoc has long supported filters, which allow the pandoc
12abstract syntax tree (AST) to be manipulated between the parsing
12abstract syntax tree (AST) to be manipulated between the parsing
13and the writing phase. [Traditional pandoc
13and the writing phase. [Traditional pandoc
14−filters](https://pandoc.org/filters.html) accept a JSON representation of the
14+filters](https://pandoc.org/filters.html) accept a JSON
15−pandoc AST and produce an altered JSON representation of the
15+representation of the pandoc AST and produce an altered JSON
16−AST. They may be written in any programming language, and
16+representation of the AST. They may be written in any
17−invoked from pandoc using the `--filter` option.
17+programming language, and invoked from pandoc using the
18+`--filter` option.
18
19
19Although traditional filters are very flexible, they have a
20Although traditional filters are very flexible, they have a
20couple of disadvantages. First, there is some overhead in
21couple of disadvantages. First, there is some overhead in
@@ -66,12 +67,12 @@ manual (MANUAL.txt) to HTML, with versions of the same JSON
66filter written in compiled Haskell (`smallcaps`) and interpreted
67filter written in compiled Haskell (`smallcaps`) and interpreted
67Python (`smallcaps.py`):
68Python (`smallcaps.py`):
68
69
69− Command Time
70+ Command Time
70− ----------------------------------------- -------
71+ --------------------------------------- -------
71− `pandoc` 1.01s
72+ `pandoc` 1.01s
72− `pandoc --filter ./smallcaps` 1.36s
73+ `pandoc --filter ./smallcaps` 1.36s
73− `pandoc --filter ./smallcaps.py` 1.40s
74+ `pandoc --filter ./smallcaps.py` 1.40s
74− `pandoc --lua-filter ./smallcaps.lua` 1.03s
75+ `pandoc --lua-filter ./smallcaps.lua` 1.03s
75
76
76As you can see, the lua filter avoids the substantial overhead
77As you can see, the lua filter avoids the substantial overhead
77associated with marshalling to and from JSON over a pipe.
78associated with marshalling to and from JSON over a pipe.
@@ -114,9 +115,9 @@ The return of a filter function must one of the following:
114- a pandoc object: this must be of the same type as the input
115- a pandoc object: this must be of the same type as the input
115 and will replace the original object.
116 and will replace the original object.
116- a list of pandoc objects: these will replace the original
117- a list of pandoc objects: these will replace the original
117− object; the list is merged with the neighbors of the original
118+ object; the list is merged with the neighbors of the
118− objects (spliced into the list the original object belongs
119+ original objects (spliced into the list the original object
119− to); returning an empty list deletes the object.
120+ belongs to); returning an empty list deletes the object.
120
121
121The function's output must result in an element of the same type
122The function's output must result in an element of the same type
122as the input. This means a filter function acting on an inline
123as the input. This means a filter function acting on an inline
@@ -135,7 +136,6 @@ Elements without matching functions are left untouched.
135See [module documentation](#module-pandoc) for a list of pandoc
136See [module documentation](#module-pandoc) for a list of pandoc
136elements.
137elements.
137
138
138−
139## Global variables
139## Global variables
140
140
141Pandoc passes additional data to Lua filters by setting global
141Pandoc passes additional data to Lua filters by setting global
@@ -151,12 +151,13 @@ variables.
151: Table of the options which were provided to the parser.
151: Table of the options which were provided to the parser.
152
152
153`PANDOC_VERSION`
153`PANDOC_VERSION`
154−: Contains the pandoc version as a [Version object] which
154+: Contains the pandoc version as a [Version
155+ object](#type-ref-Version) which behaves like a numerically
155− behaves like a numerically indexed table, most significant
156+ indexed table, most significant number first. E.g., for
156− number first. E.g., for pandoc 2.7.3, the value of the
157− variable is equivalent to a table `{2, 7, 3}`. Use
157+ pandoc 2.7.3, the value of the variable is equivalent to a
158− `tostring(PANDOC_VERSION)` to produce a version string. This
158+ table `{2, 7, 3}`. Use `tostring(PANDOC_VERSION)` to produce
159− variable is also set in custom writers.
159+ a version string. This variable is also set in custom
160+ writers.
160
161
161`PANDOC_API_VERSION`
162`PANDOC_API_VERSION`
162: Contains the version of the pandoc-types API against which
163: Contains the version of the pandoc-types API against which
@@ -178,8 +179,6 @@ variables.
178 variable is of type [CommonState](#type-ref-CommonState) and
179 variable is of type [CommonState](#type-ref-CommonState) and
179 is read-only.
180 is read-only.
180
181
181−[Version object]: #type-ref-Version
182−
183# Pandoc Module
182# Pandoc Module
184
183
185The `pandoc` lua module is loaded into the filter's lua
184The `pandoc` lua module is loaded into the filter's lua
@@ -228,8 +227,8 @@ default modules.
228
227
229The following snippet is an example of code that might be useful
228The following snippet is an example of code that might be useful
230when added to `init.lua`. The snippet adds all unicode-aware
229when added to `init.lua`. The snippet adds all unicode-aware
231−functions defined in the [`text` module] to the default `string`
230+functions defined in the [`text` module](#module-text) to the
232−module, prefixed with the string `uc_`.
231+default `string` module, prefixed with the string `uc_`.
233
232
234``` {.lua}
233``` {.lua}
235for name, fn in pairs(require 'text') do
234for name, fn in pairs(require 'text') do
@@ -240,14 +239,11 @@ end
240This makes it possible to apply these functions on strings using
239This makes it possible to apply these functions on strings using
241colon syntax (`mystring:uc_upper()`).
240colon syntax (`mystring:uc_upper()`).
242
241
243−[`text` module]: #module-text
244−
245# Examples
242# Examples
246
243
247−The following filters are presented as examples.
244+The following filters are presented as examples. A repository of
248−A repository of useful lua filters (which may also serve
245+useful lua filters (which may also serve as good examples) is
249−as good examples) is available at
250−<https://github.com/pandoc/lua-filters>.
246+available at <https://github.com/pandoc/lua-filters>.
251
247
252## Macro substitution.
248## Macro substitution.
253
249
@@ -552,13 +548,14 @@ end
552
548
553This filter converts raw LaTeX tikz environments into images. It
549This filter converts raw LaTeX tikz environments into images. It
554works with both PDF and HTML output. The tikz code is compiled
550works with both PDF and HTML output. The tikz code is compiled
555−to an image using `pdflatex`, and the image is converted from pdf
551+to an image using `pdflatex`, and the image is converted from
552+pdf to svg format using
556−to svg format using [`pdf2svg`](https://github.com/dawbarton/pdf2svg),
553+[`pdf2svg`](https://github.com/dawbarton/pdf2svg), so both of
557−so both of these must be in the system path. Converted images
554+these must be in the system path. Converted images are cached in
558−are cached in the working directory and given filenames based on
555+the working directory and given filenames based on a hash of the
559−a hash of the source, so that they need not be regenerated each
556+source, so that they need not be regenerated each time the
560−time the document is built. (A more sophisticated version of
557+document is built. (A more sophisticated version of this might
561−this might put these in a special cache directory.)
558+put these in a special cache directory.)
562
559
563``` {.lua}
560``` {.lua}
564local function tikz2image(src, filetype, outfile)
561local function tikz2image(src, filetype, outfile)
@@ -637,12 +634,11 @@ Example of use:
637 \end{tikzpicture}
634 \end{tikzpicture}
638 EOF
635 EOF
639
636
640−
641# Lua type reference
637# Lua type reference
642
638
643This section describes the types of objects available to Lua
639This section describes the types of objects available to Lua
644−filters. See the [pandoc module](#module-pandoc}) for functions
640+filters. See the [pandoc module](#module-pandoc%7D) for
645−to create these objects.
641+functions to create these objects.
646
642
647## Shared Properties
643## Shared Properties
648
644
@@ -666,16 +662,16 @@ Object equality is determined via
666[`pandoc.utils.equals`](#utils-equals).
662[`pandoc.utils.equals`](#utils-equals).
667
663
668`blocks`
664`blocks`
669−: document content ([List] of [Block]s)
665+: document content ([List](#module-pandoc.list) of
666+ [Block](#type-ref-Block)s)
670
667
671`meta`
668`meta`
672−: document meta information ([Meta] object)
669+: document meta information ([Meta](#Meta) object)
673−
674
670
675## Meta {#type-ref-meta}
671## Meta {#type-ref-meta}
676
672
677Meta information on a document; string-indexed collection of
673Meta information on a document; string-indexed collection of
678−[MetaValue]s.
674+[MetaValue](#type-ref-MetaValue)s.
679
675
680Object equality is determined via
676Object equality is determined via
681[`pandoc.utils.equals`](#utils-equals).
677[`pandoc.utils.equals`](#utils-equals).
@@ -689,7 +685,8 @@ Object equality is determined via
689
685
690### MetaBlocks {#type-ref-MetaBlocks}
686### MetaBlocks {#type-ref-MetaBlocks}
691
687
692−A list of blocks usable as meta value ([List] of [Block]s)
688+A list of blocks usable as meta value
689+([List](#module-pandoc.list) of [Block](#type-ref-Block)s)
693
690
694Fields:
691Fields:
695
692
@@ -702,7 +699,8 @@ Plain Lua boolean value (boolean)
702
699
703### MetaInlines {#type-ref-MetaInlines}
700### MetaInlines {#type-ref-MetaInlines}
704
701
705−List of inlines used in metadata ([List] of [Inline]s)
702+List of inlines used in metadata ([List](#module-pandoc.list) of
703+[Inline](#type-ref-Inline)s)
706
704
707Fields:
705Fields:
708
706
@@ -711,7 +709,8 @@ Fields:
711
709
712### MetaList {#type-ref-iMetaList}
710### MetaList {#type-ref-iMetaList}
713
711
714−A list of other [MetaValue]s. ([List])
712+A list of other [MetaValue](#type-ref-MetaValue)s.
713+([List](#module-pandoc.list))
715
714
716Fields:
715Fields:
717
716
@@ -734,7 +733,6 @@ with the same name as those listed.
734
733
735Plain Lua string value (string)
734Plain Lua string value (string)
736
735
737−
738## Block {#type-ref-Block}
736## Block {#type-ref-Block}
739
737
740Object equality is determined via
738Object equality is determined via
@@ -745,7 +743,8 @@ Object equality is determined via
745A block quote element
743A block quote element
746
744
747content:
745content:
748−: block content ([List] of [Block]s)
746+: block content ([List](#module-pandoc.list) of
747+ [Block](#type-ref-Block)s)
749
748
750`tag`, `t`
749`tag`, `t`
751: the literal `BlockQuote` (string)
750: the literal `BlockQuote` (string)
@@ -755,7 +754,8 @@ content:
755A bullet list
754A bullet list
756
755
757`content`
756`content`
758−: list of items ([List] of [Block]s)
757+: list of items ([List](#module-pandoc.list) of
758+ [Block](#type-ref-Block)s)
759
759
760`tag`, `t`
760`tag`, `t`
761: the literal `BulletList` (string)
761: the literal `BulletList` (string)
@@ -768,16 +768,18 @@ Block of code.
768: code string (string)
768: code string (string)
769
769
770`attr`
770`attr`
771−: element attributes ([Attr])
771+: element attributes ([Attr](#type-ref-Attr))
772
772
773`identifier`
773`identifier`
774: alias for `attr.identifier` (string)
774: alias for `attr.identifier` (string)
775
775
776`classes`
776`classes`
777−: alias for `attr.classes` ([List] of strings)
777+: alias for `attr.classes` ([List](#module-pandoc.list) of
778+ strings)
778
779
779`attributes`
780`attributes`
780−: alias for `attr.attributes` ([Attributes])
781+: alias for `attr.attributes`
782+ ([Attributes](#type-ref-Attributes))
781
783
782`tag`, `t`
784`tag`, `t`
783: the literal `CodeBlock` (string)
785: the literal `CodeBlock` (string)
@@ -797,19 +799,22 @@ Definition list, containing terms and their explanation.
797Generic block container with attributes
799Generic block container with attributes
798
800
799`content`
801`content`
800−: block content ([List] of [Block]s)
802+: block content ([List](#module-pandoc.list) of
803+ [Block](#type-ref-Block)s)
801
804
802`attr`
805`attr`
803−: element attributes ([Attr])
806+: element attributes ([Attr](#type-ref-Attr))
804
807
805`identifier`
808`identifier`
806: alias for `attr.identifier` (string)
809: alias for `attr.identifier` (string)
807
810
808`classes`
811`classes`
809−: alias for `attr.classes` ([List] of strings)
812+: alias for `attr.classes` ([List](#module-pandoc.list) of
813+ strings)
810
814
811`attributes`
815`attributes`
812−: alias for `attr.attributes` ([Attributes])
816+: alias for `attr.attributes`
817+ ([Attributes](#type-ref-Attributes))
813
818
814`tag`, `t`
819`tag`, `t`
815: the literal `Div` (string)
820: the literal `Div` (string)
@@ -822,24 +827,26 @@ Creates a header element.
822: header level (integer)
827: header level (integer)
823
828
824`content`
829`content`
825−: inline content ([List] of [Inline]s)
830+: inline content ([List](#module-pandoc.list) of
831+ [Inline](#type-ref-Inline)s)
826
832
827`attr`
833`attr`
828−: element attributes ([Attr])
834+: element attributes ([Attr](#type-ref-Attr))
829
835
830`identifier`
836`identifier`
831: alias for `attr.identifier` (string)
837: alias for `attr.identifier` (string)
832
838
833`classes`
839`classes`
834−: alias for `attr.classes` ([List] of strings)
840+: alias for `attr.classes` ([List](#module-pandoc.list) of
841+ strings)
835
842
836`attributes`
843`attributes`
837−: alias for `attr.attributes` ([Attributes])
844+: alias for `attr.attributes`
845+ ([Attributes](#type-ref-Attributes))
838
846
839`tag`, `t`
847`tag`, `t`
840: the literal `Header` (string)
848: the literal `Header` (string)
841
849
842−
843### HorizontalRule {#type-ref-HorizontalRule}
850### HorizontalRule {#type-ref-HorizontalRule}
844
851
845A horizontal rule.
852A horizontal rule.
@@ -849,7 +856,7 @@ A horizontal rule.
849
856
850### LineBlock {#type-ref-LineBlock}
857### LineBlock {#type-ref-LineBlock}
851
858
852−A line block, i.e. a list of lines, each separated from the next
859+A line block, i.e. a list of lines, each separated from the next
853by a newline.
860by a newline.
854
861
855`content`
862`content`
@@ -871,10 +878,11 @@ target format.
871An ordered list.
878An ordered list.
872
879
873`content`
880`content`
874−: list items ([List] of [Block]s)
881+: list items ([List](#module-pandoc.list) of
882+ [Block](#type-ref-Block)s)
875
883
876`listAttributes`
884`listAttributes`
877−: list parameters ([ListAttributes])
885+: list parameters ([ListAttributes](#ListAttributes))
878
886
879`start`
887`start`
880: alias for `listAttributes.start` (integer)
888: alias for `listAttributes.start` (integer)
@@ -893,7 +901,8 @@ An ordered list.
893A paragraph
901A paragraph
894
902
895`content`
903`content`
896−: inline content ([List] of [Inline]s)
904+: inline content ([List](#module-pandoc.list) of
905+ [Inline](#type-ref-Inline)s)
897
906
898`tag`, `t`
907`tag`, `t`
899: the literal `Para` (string)
908: the literal `Para` (string)
@@ -903,7 +912,8 @@ A paragraph
903Plain text, not a paragraph
912Plain text, not a paragraph
904
913
905`content`
914`content`
906−: inline content ([List] of [Inline]s)
915+: inline content ([List](#module-pandoc.list) of
916+ [Inline](#type-ref-Inline)s)
907
917
908`tag`, `t`
918`tag`, `t`
909: the literal `Plain` (string)
919: the literal `Plain` (string)
@@ -926,19 +936,24 @@ Raw content of a specified format.
926A table.
936A table.
927
937
928`caption`
938`caption`
929−: table caption ([List] of [Inline]s)
939+: table caption ([List](#module-pandoc.list) of
940+ [Inline](#type-ref-Inline)s)
930
941
931`aligns`
942`aligns`
932−: column alignments ([List] of [Alignment]s)
943+: column alignments ([List](#module-pandoc.list) of
944+ [Alignment](#type-ref-Alignment)s)
933
945
934`widths`
946`widths`
935: column widths (number)
947: column widths (number)
936
948
937`headers`
949`headers`
938−: header row ([List] of [table cells])
950+: header row ([List](#module-pandoc.list) of [table
951+ cells](#type-ref-table-cell))
939
952
940`rows`
953`rows`
941−: table rows ([List] of [List]s of [table cells])
954+: table rows ([List](#module-pandoc.list) of
955+ [List](#module-pandoc.list)s of [table
956+ cells](#type-ref-table-cell))
942
957
943`tag`, `t`
958`tag`, `t`
944: the literal `Table` (string)
959: the literal `Table` (string)
@@ -952,64 +967,70 @@ left-aligned, right-aligned, and centered, respectively. The
952default alignment is `AlignDefault` (often equivalent to
967default alignment is `AlignDefault` (often equivalent to
953centered).
968centered).
954
969
955−[Alignment]: #type-ref-Alignment
956−[table cells]: #type-ref-table-cell
957−
958## Inline {#type-ref-Inline}
970## Inline {#type-ref-Inline}
959
971
960Object equality is determined via
972Object equality is determined via
961[`pandoc.utils.equals`](#utils-equals).
973[`pandoc.utils.equals`](#utils-equals).
962
974
963### Cite {#type-ref-Cite}
975### Cite {#type-ref-Cite}
976+
964Citation
977Citation
965
978
966`content`
979`content`
967−: ([List] of [Inline]s)
980+: ([List](#module-pandoc.list) of [Inline](#type-ref-Inline)s)
968
981
969`citations`
982`citations`
970−: citation entries ([List] of [citations])
983+: citation entries ([List](#module-pandoc.list) of
984+ [citations](#type-ref-Citation))
971
985
972`tag`, `t`
986`tag`, `t`
973: the literal `Cite` (string)
987: the literal `Cite` (string)
974
988
975### Code {#type-ref-Code}
989### Code {#type-ref-Code}
990+
976Inline code
991Inline code
977
992
978`text`
993`text`
979: code string (string)
994: code string (string)
980
995
981`attr`
996`attr`
982−: attributes ([Attr])
997+: attributes ([Attr](#type-ref-Attr))
983
998
984`identifier`
999`identifier`
985: alias for `attr.identifier` (string)
1000: alias for `attr.identifier` (string)
986
1001
987`classes`
1002`classes`
988−: alias for `attr.classes` ([List] of strings)
1003+: alias for `attr.classes` ([List](#module-pandoc.list) of
1004+ strings)
989
1005
990`attributes`
1006`attributes`
991−: alias for `attr.attributes` ([Attributes])
1007+: alias for `attr.attributes`
1008+ ([Attributes](#type-ref-Attributes))
992
1009
993`tag`, `t`
1010`tag`, `t`
994: the literal `Code` (string)
1011: the literal `Code` (string)
995
1012
996### Emph {#type-ref-Emph}
1013### Emph {#type-ref-Emph}
1014+
997Emphasized text
1015Emphasized text
998
1016
999`content`
1017`content`
1000−: inline content ([List] of [Inline]s)
1018+: inline content ([List](#module-pandoc.list) of
1019+ [Inline](#type-ref-Inline)s)
1001
1020
1002`tag`, `t`
1021`tag`, `t`
1003: the literal `Emph` (string)
1022: the literal `Emph` (string)
1004
1023
1005### Image {#type-ref-Image}
1024### Image {#type-ref-Image}
1025+
1006−Image: alt text (list of inlines), target
1026+Image: alt text (list of inlines), target
1007
1027
1008`attr`
1028`attr`
1009−: attributes ([Attr])
1029+: attributes ([Attr](#type-ref-Attr))
1010
1030
1011`caption`
1031`caption`
1012−: text used to describe the image ([List] of [Inline]s)
1032+: text used to describe the image ([List](#module-pandoc.list)
1033+ of [Inline](#type-ref-Inline)s)
1013
1034
1014`src`
1035`src`
1015: path to the image file (string)
1036: path to the image file (string)
@@ -1021,28 +1042,33 @@ Image: alt text (list of inlines), target
1021: alias for `attr.identifier` (string)
1042: alias for `attr.identifier` (string)
1022
1043
1023`classes`
1044`classes`
1024−: alias for `attr.classes` ([List] of strings)
1045+: alias for `attr.classes` ([List](#module-pandoc.list) of
1046+ strings)
1025
1047
1026`attributes`
1048`attributes`
1027−: alias for `attr.attributes` ([Attributes])
1049+: alias for `attr.attributes`
1050+ ([Attributes](#type-ref-Attributes))
1028
1051
1029`tag`, `t`
1052`tag`, `t`
1030: the literal `Image` (string)
1053: the literal `Image` (string)
1031
1054
1032### LineBreak {#type-ref-LineBreak}
1055### LineBreak {#type-ref-LineBreak}
1056+
1033Hard line break
1057Hard line break
1034
1058
1035`tag`, `t`
1059`tag`, `t`
1036: the literal `LineBreak` (string)
1060: the literal `LineBreak` (string)
1037
1061
1038### Link {#type-ref-Link}
1062### Link {#type-ref-Link}
1063+
1039Hyperlink: alt text (list of inlines), target
1064Hyperlink: alt text (list of inlines), target
1040
1065
1041`attr`
1066`attr`
1042−: attributes ([Attr])
1067+: attributes ([Attr](#type-ref-Attr))
1043
1068
1044`content`
1069`content`
1045−: text for this link ([List] of [Inline]s)
1070+: text for this link ([List](#module-pandoc.list) of
1071+ [Inline](#type-ref-Inline)s)
1046
1072
1047`target`
1073`target`
1048: the link target (string)
1074: the link target (string)
@@ -1051,15 +1077,18 @@ Hyperlink: alt text (list of inlines), target
1051: alias for `attr.identifier` (string)
1077: alias for `attr.identifier` (string)
1052
1078
1053`classes`
1079`classes`
1054−: alias for `attr.classes` ([List] of strings)
1080+: alias for `attr.classes` ([List](#module-pandoc.list) of
1081+ strings)
1055
1082
1056`attributes`
1083`attributes`
1057−: alias for `attr.attributes` ([Attributes])
1084+: alias for `attr.attributes`
1085+ ([Attributes](#type-ref-Attributes))
1058
1086
1059`tag`, `t`
1087`tag`, `t`
1060: the literal `Link` (string)
1088: the literal `Link` (string)
1061
1089
1062### Math {#type-ref-Math}
1090### Math {#type-ref-Math}
1091+
1063TeX math (literal)
1092TeX math (literal)
1064
1093
1065`mathtype`
1094`mathtype`
@@ -1074,15 +1103,17 @@ TeX math (literal)
1074: the literal `Math` (string)
1103: the literal `Math` (string)
1075
1104
1076### Note {#type-ref-Note}
1105### Note {#type-ref-Note}
1106+
1077Footnote or endnote
1107Footnote or endnote
1078
1108
1079`content`
1109`content`
1080−: ([List] of [Block]s)
1110+: ([List](#module-pandoc.list) of [Block](#type-ref-Block)s)
1081
1111
1082`tag`, `t`
1112`tag`, `t`
1083: the literal `Note` (string)
1113: the literal `Note` (string)
1084
1114
1085### Quoted {#type-ref-Quoted}
1115### Quoted {#type-ref-Quoted}
1116+
1086Quoted text
1117Quoted text
1087
1118
1088`quotetype`
1119`quotetype`
@@ -1090,12 +1121,14 @@ Quoted text
1090 `DoubleQuote` (string)
1121 `DoubleQuote` (string)
1091
1122
1092`content`
1123`content`
1093−: quoted text ([List] of [Inline]s)
1124+: quoted text ([List](#module-pandoc.list) of
1125+ [Inline](#type-ref-Inline)s)
1094
1126
1095`tag`, `t`
1127`tag`, `t`
1096: the literal `Quoted` (string)
1128: the literal `Quoted` (string)
1097
1129
1098### RawInline {#type-ref-RawInline}
1130### RawInline {#type-ref-RawInline}
1131+
1099Raw inline
1132Raw inline
1100
1133
1101`format`
1134`format`
@@ -1108,48 +1141,56 @@ Raw inline
1108: the literal `RawInline` (string)
1141: the literal `RawInline` (string)
1109
1142
1110### SmallCaps {#type-ref-SmallCaps}
1143### SmallCaps {#type-ref-SmallCaps}
1144+
1111Small caps text
1145Small caps text
1112
1146
1113`content`
1147`content`
1114−: ([List] of [Inline]s)
1148+: ([List](#module-pandoc.list) of [Inline](#type-ref-Inline)s)
1115
1149
1116`tag`, `t`
1150`tag`, `t`
1117: the literal `SmallCaps` (string)
1151: the literal `SmallCaps` (string)
1118
1152
1119### SoftBreak {#type-ref-SoftBreak}
1153### SoftBreak {#type-ref-SoftBreak}
1154+
1120Soft line break
1155Soft line break
1121
1156
1122`tag`, `t`
1157`tag`, `t`
1123: the literal `SoftBreak` (string)
1158: the literal `SoftBreak` (string)
1124
1159
1125### Space {#type-ref-Space}
1160### Space {#type-ref-Space}
1161+
1126Inter-word space
1162Inter-word space
1127
1163
1128`tag`, `t`
1164`tag`, `t`
1129: the literal `Space` (string)
1165: the literal `Space` (string)
1130
1166
1131### Span {#type-ref-Span}
1167### Span {#type-ref-Span}
1168+
1132Generic inline container with attributes
1169Generic inline container with attributes
1133
1170
1134`attr`
1171`attr`
1135−: attributes ([Attr])
1172+: attributes ([Attr](#type-ref-Attr))
1136
1173
1137`content`
1174`content`
1138−: wrapped content ([List] of [Inline]s)
1175+: wrapped content ([List](#module-pandoc.list) of
1176+ [Inline](#type-ref-Inline)s)
1139
1177
1140`identifier`
1178`identifier`
1141: alias for `attr.identifier` (string)
1179: alias for `attr.identifier` (string)
1142
1180
1143`classes`
1181`classes`
1144−: alias for `attr.classes` ([List] of strings)
1182+: alias for `attr.classes` ([List](#module-pandoc.list) of
1183+ strings)
1145
1184
1146`attributes`
1185`attributes`
1147−: alias for `attr.attributes` ([Attributes])
1186+: alias for `attr.attributes`
1187+ ([Attributes](#type-ref-Attributes))
1148
1188
1149`tag`, `t`
1189`tag`, `t`
1150: the literal `Span` (string)
1190: the literal `Span` (string)
1151
1191
1152### Str {#type-ref-Str}
1192### Str {#type-ref-Str}
1193+
1153Text
1194Text
1154
1195
1155`text`
1196`text`
@@ -1159,37 +1200,45 @@ Text
1159: the literal `Str` (string)
1200: the literal `Str` (string)
1160
1201
1161### Strikeout {#type-ref-Strikeout}
1202### Strikeout {#type-ref-Strikeout}
1203+
1162Strikeout text
1204Strikeout text
1163
1205
1164`content`
1206`content`
1165−: inline content ([List] of [Inline]s)
1207+: inline content ([List](#module-pandoc.list) of
1208+ [Inline](#type-ref-Inline)s)
1166
1209
1167`tag`, `t`
1210`tag`, `t`
1168: the literal `Strikeout` (string)
1211: the literal `Strikeout` (string)
1169
1212
1170### Strong {#type-ref-Strong}
1213### Strong {#type-ref-Strong}
1214+
1171Strongly emphasized text
1215Strongly emphasized text
1172
1216
1173`content`
1217`content`
1174−: inline content ([List] of [Inline]s)
1218+: inline content ([List](#module-pandoc.list) of
1219+ [Inline](#type-ref-Inline)s)
1175
1220
1176`tag`, `t`
1221`tag`, `t`
1177: the literal `Strong` (string)
1222: the literal `Strong` (string)
1178
1223
1179### Subscript {#type-ref-Subscript}
1224### Subscript {#type-ref-Subscript}
1225+
1180Subscripted text
1226Subscripted text
1181
1227
1182`content`
1228`content`
1183−: inline content ([List] of [Inline]s)
1229+: inline content ([List](#module-pandoc.list) of
1230+ [Inline](#type-ref-Inline)s)
1184
1231
1185`tag`, `t`
1232`tag`, `t`
1186: the literal `Subscript` (string)
1233: the literal `Subscript` (string)
1187
1234
1188### Superscript {#type-ref-Superscript}
1235### Superscript {#type-ref-Superscript}
1236+
1189Superscripted text
1237Superscripted text
1190
1238
1191`content`
1239`content`
1192−: inline content ([List] of [Inline]s)
1240+: inline content ([List](#module-pandoc.list) of
1241+ [Inline](#type-ref-Inline)s)
1193
1242
1194`tag`, `t`
1243`tag`, `t`
1195: the literal `Superscript` (string)
1244: the literal `Superscript` (string)
@@ -1207,10 +1256,11 @@ Object equality is determined via
1207: element identifier (string)
1256: element identifier (string)
1208
1257
1209`classes`
1258`classes`
1210−: element classes ([List] of strings)
1259+: element classes ([List](#module-pandoc.list) of strings)
1211
1260
1212`attributes`
1261`attributes`
1213−: collection of key/value pairs ([Attributes])
1262+: collection of key/value pairs
1263+ ([Attributes](#type-ref-Attributes))
1214
1264
1215### Attributes {#type-ref-Attributes}
1265### Attributes {#type-ref-Attributes}
1216
1266
@@ -1232,10 +1282,12 @@ Object equality is determined via
1232 `NormalCitation` (string)
1282 `NormalCitation` (string)
1233
1283
1234`prefix`
1284`prefix`
1235−: citation prefix ([List] of [Inline]s)
1285+: citation prefix ([List](#module-pandoc.list) of
1286+ [Inline](#type-ref-Inline)s)
1236
1287
1237`suffix`
1288`suffix`
1238−: citation suffix ([List] of [Inline]s)
1289+: citation suffix ([List](#module-pandoc.list) of
1290+ [Inline](#type-ref-Inline)s)
1239
1291
1240`note_num`
1292`note_num`
1241: note number (integer)
1293: note number (integer)
@@ -1244,6 +1296,7 @@ Object equality is determined via
1244: hash (integer)
1296: hash (integer)
1245
1297
1246### ListAttributes {#type-ref-ListAttributes}
1298### ListAttributes {#type-ref-ListAttributes}
1299+
1247List attributes
1300List attributes
1248
1301
1249Object equality is determined via
1302Object equality is determined via
@@ -1253,19 +1306,19 @@ Object equality is determined via
1253: number of the first list item (integer)
1306: number of the first list item (integer)
1254
1307
1255`style`
1308`style`
1256−: style used for list numbers; possible values are `DefaultStyle`,
1309+: style used for list numbers; possible values are
1257− `Example`, `Decimal`, `LowerRoman`, `UpperRoman`,
1310+ `DefaultStyle`, `Example`, `Decimal`, `LowerRoman`,
1258− `LowerAlpha`, and `UpperAlpha` (string)
1311+ `UpperRoman`, `LowerAlpha`, and `UpperAlpha` (string)
1259
1312
1260`delimiter`
1313`delimiter`
1261: delimiter of list numbers; one of `DefaultDelim`, `Period`,
1314: delimiter of list numbers; one of `DefaultDelim`, `Period`,
1262 `OneParen`, and `TwoParens` (string)
1315 `OneParen`, and `TwoParens` (string)
1263
1316
1264−
1265## Hierarchical Element {#type-ref-Element}
1317## Hierarchical Element {#type-ref-Element}
1266
1318
1267Hierarchical elements can be either *Sec* (sections) or *Blk*
1319Hierarchical elements can be either *Sec* (sections) or *Blk*
1268−(blocks). *Blk* elements are treated like [Block]s.
1320+(blocks). *Blk* elements are treated like
1321+[Block](#type-ref-Block)s.
1269
1322
1270### Sec {#type-ref-Sec}
1323### Sec {#type-ref-Sec}
1271
1324
@@ -1278,22 +1331,23 @@ document contents.
1278: header level (integer)
1331: header level (integer)
1279
1332
1280`numbering`
1333`numbering`
1281−: section numbering ([list] of integers)
1334+: section numbering ([list](#module-pandoc.list) of integers)
1282
1335
1283`attr`
1336`attr`
1284−: header attributes ([Attr])
1337+: header attributes ([Attr](#type-ref-Attr))
1285
1338
1286`label`
1339`label`
1287−: header content ([list] of [Inline]s)
1340+: header content ([list](#module-pandoc.list) of
1341+ [Inline](#type-ref-Inline)s)
1288
1342
1289`contents`
1343`contents`
1290−: list of contents in this section ([list] of [hierarchical element]s)
1344+: list of contents in this section
1345+ ([list](#module-pandoc.list) of [hierarchical
1346+ element](#Element)s)
1291
1347
1292`tag`, `t`
1348`tag`, `t`
1293: constant `Sec` (string)
1349: constant `Sec` (string)
1294
1350
1295−[hierarchical element]: #Element
1296−
1297## ReaderOptions {#type-ref-ReaderOptions}
1351## ReaderOptions {#type-ref-ReaderOptions}
1298
1352
1299Pandoc reader options
1353Pandoc reader options
@@ -1323,7 +1377,7 @@ Pandoc reader options
1323 (boolean)
1377 (boolean)
1324
1378
1325`tab_stop`
1379`tab_stop`
1326−: width (i.e. equivalent number of spaces) of tab stops
1380+: width (i.e. equivalent number of spaces) of tab stops
1327 (integer)
1381 (integer)
1328
1382
1329`track_changes`
1383`track_changes`
@@ -1336,21 +1390,24 @@ The state used by pandoc to collect information and make it
1336available to readers and writers.
1390available to readers and writers.
1337
1391
1338`input_files`
1392`input_files`
1339−: List of input files from command line ([List] of strings)
1393+: List of input files from command line
1394+ ([List](#module-pandoc.list) of strings)
1340
1395
1341`output_file`
1396`output_file`
1342: Output file from command line (string or nil)
1397: Output file from command line (string or nil)
1343
1398
1344`log`
1399`log`
1345−: A list of log messages in reverse order ([List] of [LogMessage]s)
1400+: A list of log messages in reverse order
1401+ ([List](#module-pandoc.list) of
1402+ [LogMessage](#type-ref-LogMessage)s)
1346
1403
1347`request_headers`
1404`request_headers`
1348: Headers to add for HTTP requests; table with header names as
1405: Headers to add for HTTP requests; table with header names as
1349 keys and header contents as value (table)
1406 keys and header contents as value (table)
1350
1407
1351`resource_path`
1408`resource_path`
1352−: Path to search for resources like included images ([List] of
1409+: Path to search for resources like included images
1353− strings)
1410+ ([List](#module-pandoc.list) of strings)
1354
1411
1355`source_url`
1412`source_url`
1356: Absolute URL or directory of first source file (string or
1413: Absolute URL or directory of first source file (string or
@@ -1367,8 +1424,8 @@ available to readers and writers.
1367
1424
1368## LogMessage {#type-ref-LogMessage}
1425## LogMessage {#type-ref-LogMessage}
1369
1426
1370−A pandoc log message. Object have no fields, but can be converted
1427+A pandoc log message. Object have no fields, but can be
1371−to a string via `tostring`.
1428+converted to a string via `tostring`.
1372
1429
1373## Version {#type-ref-Version}
1430## Version {#type-ref-Version}
1374
1431
@@ -1402,9 +1459,10 @@ Parameters:
1402: minimum expected version ([Version](#type-ref-Version))
1459: minimum expected version ([Version](#type-ref-Version))
1403
1460
1404`error_message`
1461`error_message`
1405−: optional error message template. The string is used as format
1462+: optional error message template. The string is used as
1406− string, with the expected and actual versions as arguments.
1463+ format string, with the expected and actual versions as
1464+ arguments. Defaults to
1407− Defaults to `"expected version %s or newer, got %s"`.
1465+ `"expected version %s or newer, got %s"`.
1408
1466
1409Usage:
1467Usage:
1410
1468
@@ -1414,16 +1472,6 @@ Usage:
1414 'pandoc-types is too old: expected version %s, got %s'
1472 'pandoc-types is too old: expected version %s, got %s'
1415 )
1473 )
1416
1474
1417−
1418−[Block]: #type-ref-Block
1419−[List]: #module-pandoc.list
1420−[MetaValue]: #type-ref-MetaValue
1421−[Inline]: #type-ref-Inline
1422−[Attr]: #type-ref-Attr
1423−[Attributes]: #type-ref-Attributes
1424−[citations]: #type-ref-Citation
1425−[LogMessage]: #type-ref-LogMessage
1426−
1427# Module text
1475# Module text
1428
1476
1429UTF-8 aware text manipulation functions, implemented in Haskell.
1477UTF-8 aware text manipulation functions, implemented in Haskell.
@@ -1476,714 +1524,732 @@ Lua functions for pandoc scripts.
1476
1524
1477## Pandoc Document
1525## Pandoc Document
1478
1526
1479−### Pandoc {#Pandoc}
1527+[`Pandoc (blocks[, meta])`]{#Pandoc}
1480
1528
1481−`Pandoc (blocks[, meta])`
1529+: A complete pandoc document
1482
1530
1483−A complete pandoc document
1531+ Parameters:
1484
1532
1485−Parameters:
1533+ `blocks`:
1534+ : document content
1486
1535
1487−`blocks`:
1536+ `meta`:
1488−: list of [Blocks]
1537+ : document meta data
1489
1538
1490−`meta`:
1539+## Meta {#meta}
1491−: [Meta] value (see below)
1492
1540
1493−## Metadata
1541+[`Meta (table)`]{#Meta}
1494
1542
1495−### Meta {#Meta}
1543+: Create a new Meta object.
1496
1544
1497−`Meta (table)`
1545+ Parameters:
1498
1546
1499−Create a new [Meta] object.
1547+ `table`:
1548+ : table containing document meta information
1500
1549
1501−Parameters:
1550+## MetaValue {#metavalue}
1502
1551
1503−`table`:
1552+[`MetaBlocks (blocks)`]{#MetaBlocks}
1504−: table with string keys and [MetaValue] values
1505
1553
1506−## MetaValue
1554+: Meta blocks
1507
1555
1508−### MetaBlocks {#MetaBlocks}
1556+ Parameters:
1509
1557
1510−`MetaBlocks (blocks)`
1558+ `blocks`:
1559+ : blocks
1511
1560
1512−Block-level metadata content.
1561+[`MetaInlines (inlines)`]{#MetaInlines}
1513
1562
1514−Parameters:
1563+: Meta inlines
1515
1564
1516−`blocks`:
1565+ Parameters:
1517−: list of [Blocks]
1518
1566
1519−### MetaInlines {#MetaInlines}
1567+ `inlines`:
1568+ : inlines
1520
1569
1521−`MetaInlines (inlines)`
1570+[`MetaList (meta_values)`]{#MetaList}
1522
1571
1523−Inline-level metadata content.
1572+: Meta list
1524
1573
1525−Parameters:
1574+ Parameters:
1526
1575
1527−`inlines`:
1576+ `meta_values`:
1528−: list of [Inlines]
1577+ : list of meta values
1529
1578
1530−### MetaList {#MetaList}
1579+[`MetaMap (key_value_map)`]{#MetaMap}
1531
1580
1532−`MetaList (meta_values)`
1581+: Meta map
1533
1582
1534−List of metadata items.
1583+ Parameters:
1535
1584
1536−Parameters:
1585+ `key_value_map`:
1586+ : a string-indexed map of meta values
1537
1587
1538−`meta_values`:
1588+[`MetaString (str)`]{#MetaString}
1539−: list of [MetaValues][MetaValue]
1540
1589
1541−### MetaMap {#MetaMap}
1590+: Creates string to be used in meta data.
1542
1591
1543−`MetaMap (key_value_map)`
1592+ Parameters:
1544
1593
1545−Field/value map of metadata items.
1594+ `str`:
1595+ : string value
1546
1596
1547−Parameters:
1597+[`MetaBool (bool)`]{#MetaBool}
1548
1598
1549−`key_value_map`:
1599+: Creates boolean to be used in meta data.
1550−: a table with string keys and [MetaValue] values
1551
1600
1552−### MetaString {#MetaString}
1601+ Parameters:
1553
1602
1554−`MetaString (str)`
1603+ `bool`:
1604+ : boolean value
1555
1605
1556−String metadata content.
1606+## Blocks
1557
1607
1558−Parameters:
1608+[`Block`]{#Block}
1559
1609
1560−`str`:
1610+: Block elements
1561−: string value
1562
1611
1563−### MetaBool {#MetaBool}
1612+[`BlockQuote (content)`]{#BlockQuote}
1564
1613
1565−`MetaBool (bool)`
1614+: Creates a block quote element
1566
1615
1567−Boolean metadata content.
1616+ Parameters:
1568
1617
1569−Parameters:
1618+ `content`:
1619+ : block content
1570
1620
1571−`bool`:
1621+ Returns: block quote element
1572−: boolean value
1573
1622
1574−## Blocks {#Blocks}
1623+[`BulletList (content)`]{#BulletList}
1575
1624
1576−### BlockQuote {#BlockQuote}
1625+: Creates a bullet (i.e.
1577
1626
1578−`BlockQuote (content)`
1627+ Parameters:
1579
1628
1580−Creates a BlockQuote element
1629+ `content`:
1630+ : list of items
1581
1631
1582−Parameters:
1632+ Returns: bullet list element
1583
1633
1584−`content`:
1634+[`CodeBlock (text[, attr])`]{#CodeBlock}
1585−: list of [Blocks]
1586
1635
1587−Returns: BlockQuote element
1636+: Creates a code block element
1588
1637
1589−### BulletList {#BulletList}
1638+ Parameters:
1590
1639
1591−`BulletList (content)`
1640+ `text`:
1641+ : code string
1592
1642
1593−Creates a BulletList element
1643+ `attr`:
1644+ : element attributes
1594
1645
1595−Parameters:
1646+ Returns: code block element
1596
1647
1597−`content`:
1648+[`DefinitionList (content)`]{#DefinitionList}
1598−: list of items (where each item is a list of [Blocks])
1599
1649
1600−Returns: BulletList element
1650+: Creates a definition list, containing terms and their
1651+ explanation.
1601
1652
1602−### CodeBlock {#CodeBlock}
1653+ Parameters:
1603
1654
1604−`CodeBlock (text[, attr])`
1655+ `content`:
1656+ : list of items
1605
1657
1606−Creates a CodeBlock element
1658+ Returns: definition list element
1607
1659
1608−Parameters:
1660+[`Div (content[, attr])`]{#Div}
1609
1661
1610−`text`:
1662+: Creates a div element
1611−: string (the code)
1612
1663
1613−`attr`:
1664+ Parameters:
1614−: [Attr](#Attr) (code attributes)
1615
1665
1616−Returns: CodeBlock element
1666+ `content`:
1667+ : block content
1617
1668
1618−### DefinitionList {#DefinitionList}
1669+ `attr`:
1670+ : element attributes
1619
1671
1620−`DefinitionList (content)`
1672+ Returns: div element
1621
1673
1622−Creates a DefinitionList element
1674+[`Header (level, content[, attr])`]{#Header}
1623
1675
1624−Parameters:
1676+: Creates a header element.
1625
1677
1626−`content`:
1678+ Parameters:
1627−: list of items (where each item is a two element list,
1628− where the first element is a list of [Inlines], the
1629− term, and the second is a list of lists of [Blocks],
1630− the definitions)
1631
1679
1632−Returns: DefinitionList element
1680+ `level`:
1681+ : header level
1633
1682
1634−### Div {#Div}
1683+ `content`:
1684+ : inline content
1635
1685
1636−`Div (content[, attr])`
1686+ `attr`:
1687+ : element attributes
1637
1688
1638−Creates a Div element
1689+ Returns: header element
1639
1690
1640−Parameters:
1691+[`HorizontalRule ()`]{#HorizontalRule}
1641
1692
1642−`content`:
1693+: Creates a horizontal rule.
1643−: list of [Blocks]
1644
1694
1645−`attr`:
1695+ Returns: horizontal rule
1646−: [Attr](#Attr) (Div attributes)
1647
1696
1648−Returns: Div element
1697+[`LineBlock (content)`]{#LineBlock}
1649
1698
1650−### Header {#Header}
1699+: Creates a line block element.
1651
1700
1652−`Header (level, content[, attr])`
1701+ Parameters:
1653
1702
1654−Creates a Header element.
1703+ `content`:
1704+ : inline content
1655
1705
1656−Parameters:
1706+ Returns: line block element
1657
1707
1658−`level`:
1708+[`Null ()`]{#Null}
1659−: Header level (integer)
1660
1709
1661−`content`:
1710+: Creates a null element.
1662−: list of [Inlines] (header title)
1663
1711
1664−`attr`:
1712+ Returns: null element
1665−: [Attr](#Attr) (header attributes)
1666
1713
1667−Returns: Header element
1714+[`OrderedList (items[, listAttributes])`]{#OrderedList}
1668
1715
1669−### HorizontalRule {#HorizontalRule}
1716+: Creates an ordered list.
1670
1717
1671−`HorizontalRule ()`
1718+ Parameters:
1672
1719
1673−Creates a HorizontalRule element.
1720+ `items`:
1721+ : list items
1674
1722
1675−Returns: HorizontalRule element
1723+ `listAttributes`:
1724+ : list parameters
1676
1725
1677−### LineBlock {#LineBlock}
1726+ Returns: ordered list element
1678
1727
1679−`LineBlock (content)`
1728+[`Para (content)`]{#Para}
1680
1729
1681−Creates a LineBlock element.
1730+: Creates a para element.
1682
1731
1683−Parameters:
1732+ Parameters:
1684
1733
1685−`content`:
1734+ `content`:
1686−: list of lines (where each line is a list of [Inlines])
1735+ : inline content
1687
1736
1688−Returns: LineBlock element
1737+ Returns: paragraph element
1689
1738
1690−### Null {#Null}
1739+[`Plain (content)`]{#Plain}
1691
1740
1692−`Null ()`
1741+: Creates a plain element.
1693
1742
1694−Creates a Null block element.
1743+ Parameters:
1695
1744
1696−Returns: Null element
1745+ `content`:
1746+ : inline content
1697
1747
1698−### OrderedList {#OrderedList}
1748+ Returns: plain element
1699
1749
1700−`OrderedList (items[, listAttributes])`
1750+[`RawBlock (format, text)`]{#RawBlock}
1701
1751
1702−Creates an OrderedList element.
1752+: Creates a raw content block of the specified format.
1703
1753
1704−Parameters:
1754+ Parameters:
1705
1755
1706−`items`:
1756+ `format`:
1707−: list of items (where each item is a list of [Blocks])
1757+ : format of content
1708
1758
1709−`listAttributes`:
1759+ `text`:
1710−: [ListAttributes]{#ListAttributes}
1760+ : string content
1711
1761
1712−Returns: OrderedList element
1762+ Returns: raw block element
1713
1763
1714−### Para {#Para}
1764+[`Table (caption, aligns, widths, headers, rows)`]{#Table}
1715
1765
1716−`Para (content)`
1766+: Creates a table element.
1717
1767
1718−Creates a Para element.
1768+ Parameters:
1719
1769
1720−Parameters:
1770+ `caption`:
1771+ : table caption
1721
1772
1722−`content`:
1773+ `aligns`:
1723−: list of [Inlines]
1774+ : alignments
1724
1775
1725−Returns: Para element
1776+ `widths`:
1777+ : column widths
1726
1778
1727−### Plain {#Plain}
1779+ `headers`:
1780+ : header row
1728
1781
1729−`Plain (content)`
1782+ `rows`:
1783+ : table rows
1730
1784
1731−Creates a Plain element.
1785+ Returns: table element
1732
1786
1733−Parameters:
1787+## Inline {#inline}
1734
1788
1735−`content`:
1789+[`Inline`]{#Inline}
1736−: list of [Inlines]
1737
1790
1738−Returns: Plain element
1791+: Inline element class
1739
1792
1740−### RawBlock {#RawBlock}
1793+[`Cite (content, citations)`]{#Cite}
1741
1794
1742−`RawBlock (format, text)`
1795+: Creates a Cite inline element
1743
1796
1744−Creates a RawBlock of the specified format.
1797+ Parameters:
1745
1798
1746−Parameters:
1799+ `content`:
1800+ : List of inlines
1747
1801
1748−`format`:
1802+ `citations`:
1749−: string (format of content, e.g. 'latex')
1803+ : List of citations
1750
1804
1751−`text`:
1805+ Returns: citations element
1752−: string content
1753
1806
1754−Returns: RawBlock element
1807+[`Code (text[, attr])`]{#Code}
1755
1808
1756−### Table {#Table}
1809+: Creates a Code inline element
1757
1810
1758−`Table (caption, aligns, widths, headers, rows)`
1811+ Parameters:
1759
1812
1760−Creates a Table element.
1813+ `text`:
1814+ : code string
1761
1815
1762−Parameters:
1816+ `attr`:
1817+ : additional attributes
1763
1818
1764−`caption`:
1819+ Returns: code element
1765−: table caption (list of [Inlines])
1766
1820
1767−`aligns`:
1821+[`Emph (content)`]{#Emph}
1768−: alignments (a list of
1769− `pandoc.AlignDefault`, `pandoc.AlignLeft`, `pandoc.AlignRight`,
1770− `pandoc.AlignCenter`, one for each column)
1771
1822
1772−`widths`:
1823+: Creates an inline element representing emphasised text.
1773−: column widths (a list of floats, one for each column,
1774− denoting the fraction of the textwidth needed for the
1775− column, 0.5 = half width; OR an empty list for a
1776− simple table where cells need not wrap)
1777
1824
1778−`headers`:
1825+ Parameters:
1779−: header row (a list of cells, each cell a list of [Blocks])
1780
1826
1781−`rows`:
1827+ `content`:
1782−: table rows (a list of rows, each row a list of cells,
1828+ : inline content
1783− each cell a list of [Blocks])
1784
1829
1785−Returns: Table element
1830+ Returns: emphasis element
1786
1831
1787−## Inlines {#Inlines}
1832+[`Image (caption, src[, title[, attr]])`]{#Image}
1788
1833
1789−### Cite {#Cite}
1834+: Creates a Image inline element
1790
1835
1791−`Cite (content, citations)`
1836+ Parameters:
1792
1837
1793−Creates a Cite element
1838+ `caption`:
1839+ : text used to describe the image
1794
1840
1795−Parameters:
1841+ `src`:
1842+ : path to the image file
1796
1843
1797−`content`:
1844+ `title`:
1798−: list of [Inlines]
1845+ : brief image description
1799
1846
1800−`citations`:
1847+ `attr`:
1801−: list of [Citation]s
1848+ : additional attributes
1802
1849
1803−Returns: citations element
1850+ Returns: image element
1804
1851
1805−### Code {#Code}
1852+[`LineBreak ()`]{#LineBreak}
1806
1853
1807−`Code (text[, attr])`
1854+: Create a LineBreak inline element
1808
1855
1809−Creates a Code inline element
1856+ Returns: linebreak element
1810
1857
1811−Parameters:
1858+[`Link (content, target[, title[, attr]])`]{#Link}
1812
1859
1813−`text`:
1860+: Creates a link inline element, usually a hyperlink.
1814−: string (the code)
1815
1861
1816−`attr`:
1862+ Parameters:
1817−: [Attr](#Attr) (code attributes)
1818
1863
1819−Returns: Code element
1864+ `content`:
1865+ : text for this link
1820
1866
1821−### Emph {#Emph}
1867+ `target`:
1868+ : the link target
1822
1869
1823−`Emph (content)`
1870+ `title`:
1871+ : brief link description
1824
1872
1825−Creates an Emph inline element
1873+ `attr`:
1874+ : additional attributes
1826
1875
1827−Parameters:
1876+ Returns: image element
1828
1877
1829−`content`:
1878+[`Math (mathtype, text)`]{#Math}
1830−: list of [Inlines]
1831
1879
1832−Returns: Emph element
1880+: Creates a Math element, either inline or displayed.
1833
1881
1834−### Image {#Image}
1882+ Parameters:
1835
1883
1836−`Image (alt, src[, title[, attr]])`
1884+ `mathtype`:
1885+ : rendering specifier
1837
1886
1838−Creates a Image inline element
1887+ `text`:
1888+ : Math content
1839
1889
1840−Parameters:
1890+ Returns: Math element
1841
1891
1842−`alt`:
1892+[`DisplayMath (text)`]{#DisplayMath}
1843−: list of [Inlines]: alt text (or, for implicit figures,
1844− caption)
1845
1893
1846−`src`:
1894+: Creates a DisplayMath element (DEPRECATED).
1847−: string: path to the image file
1848
1895
1849−`title`:
1896+ Parameters:
1850−: string: title attribute
1851
1897
1852−`attr`:
1898+ `text`:
1853−: [Attr](#Attr): additional image attributes
1899+ : Math content
1854
1900
1855−Returns: Image element
1901+ Returns: Math element
1856
1902
1857−### LineBreak {#LineBreak}
1903+[`InlineMath (text)`]{#InlineMath}
1858
1904
1859−`LineBreak ()`
1905+: Creates an InlineMath inline element (DEPRECATED).
1860
1906
1861−Create a LineBreak inline element
1907+ Parameters:
1862
1908
1863−Returns: linebreak element
1909+ `text`:
1910+ : Math content
1864
1911
1865−### Link {#Link}
1912+ Returns: Math element
1866
1913
1867−`Link (content, target[, title[, attr]])`
1914+[`Note (content)`]{#Note}
1868
1915
1869−Creates a Link inline element
1916+: Creates a Note inline element
1870
1917
1871−Parameters:
1918+ Parameters:
1872
1919
1873−`content`:
1920+ `content`:
1874−: list of [Inlines]: the linked text
1921+ : footnote block content
1875
1922
1876−`target`:
1923+[`Quoted (quotetype, content)`]{#Quoted}
1877−: string: the link target
1878
1924
1879−`title`:
1925+: Creates a Quoted inline element given the quote type and
1880−: string: the title attribute
1926+ quoted content.
1881
1927
1882−`attr`:
1928+ Parameters:
1883−: [Attr](#Attr): additional link attributes
1884
1929
1885−Returns: image element
1930+ `quotetype`:
1931+ : type of quotes to be used
1886
1932
1887−### Math {#Math}
1933+ `content`:
1934+ : inline content
1888
1935
1889−`Math (mathtype, text)`
1936+ Returns: quoted element
1890
1937
1891−Creates a Math inline element, either inline or displayed.
1938+[`SingleQuoted (content)`]{#SingleQuoted}
1892
1939
1893−Parameters:
1940+: Creates a single-quoted inline element (DEPRECATED).
1894
1941
1895−`mathtype`:
1942+ Parameters:
1896−: either `pandoc.InlineMath` or `pandoc.DisplayMath`
1897
1943
1898−`text`:
1944+ `content`:
1899−: string: raw tex math
1945+ : inline content
1900
1946
1901−Returns: Math element
1947+ Returns: quoted element
1902
1948
1903−### DisplayMath {#DisplayMath}
1949+ See also: [Quoted](#Quoted)
1904
1950
1905−`DisplayMath (text)`
1951+[`DoubleQuoted (content)`]{#DoubleQuoted}
1906
1952
1907−Creates a DisplayMath element (DEPRECATED, use `Math`).
1953+: Creates a single-quoted inline element (DEPRECATED).
1908
1954
1909−Parameters:
1955+ Parameters:
1910
1956
1911−`text`:
1957+ `content`:
1912−: string: raw tex math
1958+ : inline content
1913
1959
1914−Returns: Math element
1960+ Returns: quoted element
1915
1961
1916−### InlineMath {#InlineMath}
1962+ See also: [Quoted](#Quoted)
1917
1963
1918−`InlineMath (text)`
1964+[`RawInline (format, text)`]{#RawInline}
1919
1965
1920−Creates an InlineMath inline element (DEPRECATED, use
1966+: Creates a RawInline inline element
1921−[Math]{#Math}).
1922
1967
1923−Parameters:
1968+ Parameters:
1924
1969
1925−`text`:
1970+ `format`:
1926−: string: raw tex math
1971+ : format of the contents
1927
1972
1928−Returns: Math element
1973+ `text`:
1974+ : string content
1929
1975
1930−### Note {#Note}
1976+ Returns: raw inline element
1931
1977
1932−`Note (content)`
1978+[`SmallCaps (content)`]{#SmallCaps}
1933
1979
1934−Creates a Note inline element
1980+: Creates text rendered in small caps
1935
1981
1936−Parameters:
1982+ Parameters:
1937
1983
1938−`content`:
1984+ `content`:
1939−: list of [Blocks] (content of footnote)
1985+ : inline content
1940
1986
1941−### Quoted {#Quoted}
1987+ Returns: smallcaps element
1942
1988
1943−`Quoted (quotetype, content)`
1989+[`SoftBreak ()`]{#SoftBreak}
1944
1990
1945−Creates a Quoted inline element
1991+: Creates a SoftBreak inline element.
1946
1992
1947−Parameters:
1993+ Returns: softbreak element
1948
1994
1949−`quotetype`:
1995+[`Space ()`]{#Space}
1950−: either `pandoc.DoubleQuote` or `pandoc.SingleQuote`
1951
1996
1952−`content`:
1997+: Create a Space inline element
1953−: list of [Inlines]
1954
1998
1955−Returns: Quoted element
1999+ Returns: space element
1956
2000
1957−### SingleQuoted {#SingleQuoted}
2001+[`Span (content[, attr])`]{#Span}
1958
2002
1959−`SingleQuoted (content)`
2003+: Creates a Span inline element
1960
2004
1961−Creates a single-quoted inline element (DEPRECATED, use [Quoted]{#Quoted}).
2005+ Parameters:
1962
2006
1963−Parameters:
2007+ `content`:
2008+ : inline content
1964
2009
1965−`content`:
2010+ `attr`:
1966−: list of [Inlines]
2011+ : additional attributes
1967
2012
1968−Returns: Quoted element
2013+ Returns: span element
1969
2014
1970−### DoubleQuoted {#DoubleQuoted}
2015+[`Str (text)`]{#Str}
1971
2016
1972−`DoubleQuoted (content)`
2017+: Creates a Str inline element
1973
2018
1974−Creates a double-quoted inline element (DEPRECATED, use [Quoted]{#Quoted}).
2019+ Parameters:
1975
2020
1976−Parameters:
2021+ `text`:
2022+ : content
1977
2023
1978−`content`:
2024+ Returns: string element
1979−: list of [Inlines]
1980
2025
1981−Returns: Quoted element
2026+[`Strikeout (content)`]{#Strikeout}
1982
2027
1983−### RawInline {#RawInline}
2028+: Creates text which is striked out.
1984
2029
1985−`RawInline (format, text)`
2030+ Parameters:
1986
2031
1987−Creates a RawInline inline element
2032+ `content`:
2033+ : inline content
1988
2034
1989−Parameters:
2035+ Returns: strikeout element
1990
2036
1991−`format`:
2037+[`Strong (content)`]{#Strong}
1992−: string (format of the contents)
1993
2038
1994−`text`:
2039+: Creates a Strong element, whose text is usually displayed in
1995−: string (content)
2040+ a bold font.
1996
2041
1997−Returns: RawInline element
2042+ Parameters:
1998
2043
1999−### Smallcaps {#SmallCaps}
2044+ `content`:
2045+ : inline content
2000
2046
2001−`SmallCaps (content)`
2047+ Returns: strong element
2002
2048
2003−Creates text rendered in small caps
2049+[`Subscript (content)`]{#Subscript}
2004
2050
2005−Parameters:
2051+: Creates a Subscript inline element
2006
2052
2007−`content`:
2053+ Parameters:
2008−: list of [Inlines]
2009
2054
2010−Returns: SmallCaps element
2055+ `content`:
2056+ : inline content
2011
2057
2012−### SoftBreak {#SoftBreak}
2058+ Returns: subscript element
2013
2059
2014−`SoftBreak ()`
2060+[`Superscript (content)`]{#Superscript}
2015
2061
2016−Creates a SoftBreak inline element.
2062+: Creates a Superscript inline element
2017
2063
2018−Returns: SoftBreak element
2064+ Parameters:
2019
2065
2020−### Space {#Space}
2066+ `content`:
2067+ : inline content
2021
2068
2022−`Space ()`
2069+ Returns: strong element
2023
2070
2024−Create a Space inline element
2071+## Element components {#element-components}
2025
2072
2026−Returns: Space element
2073+[`Attr ([identifier[, classes[, attributes]]])`]{#Attr}
2027
2074
2028−### Span {#Span}
2075+: Create a new set of attributes (Attr).
2029
2076
2030−`Span (content[, attr])`
2077+ Parameters:
2031
2078
2032−Creates a Span inline element
2079+ `identifier`:
2080+ : element identifier
2033
2081
2034−Parameters:
2082+ `classes`:
2083+ : element classes
2035
2084
2036−`content`:
2085+ `attributes`:
2037−: list of [Inlines]
2086+ : table containing string keys and values
2038
2087
2039−`attr`:
2040−: [Attr](#Attr): span attributes
2088+ Returns: element attributes
2041
2089
2042−Returns: Span element
2090+[`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`]{#Citation}
2043
2091
2044−### Str {#Str}
2092+: Creates a single citation.
2045
2093
2046−`Str (text)`
2094+ Parameters:
2047
2095
2048−Creates a Str inline element
2096+ `id`:
2097+ : citation identifier (like a bibtex key)
2049
2098
2050−Parameters:
2099+ `mode`:
2100+ : citation mode
2051
2101
2052−`text`:
2102+ `prefix`:
2053−: string
2103+ : citation prefix
2054
2104
2055−Returns: String element
2105+ `suffix`:
2106+ : citation suffix
2056
2107
2057−### Strikeout {#Strikeout}
2108+ `note_num`:
2109+ : note number
2058
2110
2059−`Strikeout (content)`
2111+ `hash`:
2112+ : hash number
2060
2113
2061−Creates a Strikeout inline element
2114+[`ListAttributes ([start[, style[, delimiter]]])`]{#ListAttributes}
2062
2115
2063−Parameters:
2116+: Creates a set of list attributes.
2064
2117
2065−`content`:
2118+ Parameters:
2066−: list of [Inlines]
2067
2119
2068−Returns: Strikeout element
2120+ `start`:
2121+ : number of the first list item
2069
2122
2070−### Strong {#Strong}
2123+ `style`:
2124+ : style used for list numbering
2071
2125
2072−`Strong (content)`
2126+ `delimiter`:
2127+ : delimiter of list numbers
2073
2128
2074−Creates a Strong inline element.
2129+ Returns: list attributes table
2075
2130
2076−Parameters:
2131+## Constants
2077
2132
2078−`content`:
2133+[`AuthorInText`]{#AuthorInText}
2079−: list of [Inlines]
2080
2134
2081−Returns: Strong element
2135+: Author name is mentioned in the text.
2082
2136
2083−### Subscript {#Subscript}
2137+ See also: [Citation](#Citation)
2084
2138
2085−`Subscript (content)`
2139+[`SuppressAuthor`]{#SuppressAuthor}
2086
2140
2087−Creates a Subscript inline element
2141+: Author name is suppressed.
2088
2142
2089−Parameters:
2143+ See also: [Citation](#Citation)
2090
2144
2091−`content`:
2145+[`NormalCitation`]{#NormalCitation}
2092−: list of [Inlines]
2093
2146
2094−Returns: Subscript element
2147+: Default citation style is used.
2095
2148
2096−### Superscript {#Superscript}
2149+ See also: [Citation](#Citation)
2097
2150
2098−`Superscript (content)`
2151+[`AlignLeft`]{#AlignLeft}
2099
2152
2100−Creates a Superscript inline element
2153+: Table cells aligned left.
2101
2154
2102−Parameters:
2155+ See also: [Table](#Table)
2103
2156
2104−`content`:
2157+[`AlignRight`]{#AlignRight}
2105−: list of [Inlines]
2106
2158
2107−Returns: Superscript element
2159+: Table cells right-aligned.
2108
2160
2109−## Element components
2161+ See also: [Table](#Table)
2110
2162
2111−### Attr {#Attr}
2163+[`AlignCenter`]{#AlignCenter}
2112
2164
2113−`Attr ([identifier[, classes[, attributes]]])`
2165+: Table cell content is centered.
2114
2166
2115−Create a new set of attributes (Attr).
2167+ See also: [Table](#Table)
2116
2168
2117−Parameters:
2169+[`AlignDefault`]{#AlignDefault}
2118
2170
2119−`identifier`:
2171+: Table cells are alignment is unaltered.
2120−: string: element identifier
2121
2172
2122−`classes`:
2173+ See also: [Table](#Table)
2123−: list of strings: classes
2124
2174
2125−`attributes`:
2175+[`DefaultDelim`]{#DefaultDelim}
2126−: table containing string keys and values
2127
2176
2128−Returns: Attr
2177+: Default list number delimiters are used.
2129
2178
2130−### Citation {#Citation}
2179+ See also: [OrderedList](#OrderedList)
2131
2180
2132−`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`
2181+[`Period`]{#Period}
2133
2182
2134−Creates a single Citation.
2183+: List numbers are delimited by a period.
2135
2184
2136−Parameters:
2185+ See also: [OrderedList](#OrderedList)
2137
2186
2138−`id`:
2187+[`OneParen`]{#OneParen}
2139−: string citation identifier (like a bibtex key)
2140
2188
2141−`mode`:
2189+: List numbers are delimited by a single parenthesis.
2142−: `pandoc.AuthorInText`, `pandoc.SuppressAuthor`, or
2143− `pandoc.NormalCitation`
2144
2190
2145−`prefix`:
2191+ See also: [OrderedList](#OrderedList)
2146−: list of [Inlines] for citation prefix
2147
2192
2148−`suffix`:
2193+[`TwoParens`]{#TwoParens}
2149−: list of [Inlines] for citation suffix
2150
2194
2151−`note_num`:
2195+: List numbers are delimited by a double parentheses.
2152−: int: note number
2153
2196
2154−`hash`:
2197+ See also: [OrderedList](#OrderedList)
2155−: int: hash number
2156
2198
2157−### ListAttributes {#ListAttributes}
2199+[`DefaultStyle`]{#DefaultStyle}
2158
2200
2159−`ListAttributes ([start[, style[, delimiter]]])`
2201+: List are numbered in the default style
2160
2202
2161−Creates a set of list attributes
2203+ See also: [OrderedList](#OrderedList)
2162
2204
2163−Parameters:
2205+[`Example`]{#Example}
2206+
2207+: List items are numbered as examples.
2208+
2209+ See also: [OrderedList](#OrderedList)
2210+
2211+[`Decimal`]{#Decimal}
2212+
2213+: List are numbered using decimal integers.
2214+
2215+ See also: [OrderedList](#OrderedList)
2216+
2217+[`LowerRoman`]{#LowerRoman}
2164
2218
2165−`start`:
2219+: List are numbered using lower-case roman numerals.
2166−: int: number of the first list item (default: 1)
2167
2220
2168−`style`:
2221+ See also: [OrderedList](#OrderedList)
2169−: `pandoc.DefaultStyle` (default), `pandoc.Decimal`,
2170− `pandoc.LowerRoman`, `pandoc.UpperRoman`, `pandoc.LowerAlpha`,
2171− or `pandoc.UpperAlpha`
2172
2222
2173−`delimiter`:
2223+[`UpperRoman`]{#UpperRoman}
2174−: `pandoc.DefaultDelim` (default), `pandoc.Period`,
2175− `pandoc.OneParen`, `pandoc.TwoParens`
2176
2224
2177−Returns: list attributes table
2225+: List are numbered using upper-case roman numerals
2226+
2227+ See also: [OrderedList](#OrderedList)
2228+
2229+[`LowerAlpha`]{#LowerAlpha}
2230+
2231+: List are numbered using lower-case alphabetic characters.
2232+
2233+ See also: [OrderedList](#OrderedList)
2234+
2235+[`UpperAlpha`]{#UpperAlpha}
2236+
2237+: List are numbered using upper-case alphabetic characters.
2238+
2239+ See also: [OrderedList](#OrderedList)
2240+
2241+[`sha1`]{#sha1}
2242+
2243+: Functions which have moved to different modules
2178
2244
2179## Helper functions
2245## Helper functions
2180
2246
2181−### pipe {#pipe}
2247+### pipe
2182
2248
2183`pipe (command, args, input)`
2249`pipe (command, args, input)`
2184
2250
2185−Runs command with arguments, passing it some input, and
2251+Runs command with arguments, passing it some input, and returns
2186−returns the output.
2252+the output.
2187
2253
2188Returns:
2254Returns:
2189
2255
@@ -2199,7 +2265,7 @@ Usage:
2199
2265
2200 local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
2266 local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
2201
2267
2202−### walk_block {#walk_block}
2268+### walk\_block
2203
2269
2204`walk_block (element, filter)`
2270`walk_block (element, filter)`
2205
2271
@@ -2211,17 +2277,16 @@ Parameters:
2211: the block element
2277: the block element
2212
2278
2213`filter`:
2279`filter`:
2214−: a lua filter (table of functions) to be applied within
2280+: a lua filter (table of functions) to be applied within the
2215− the block element
2281+ block element
2216
2282
2217Returns: the transformed block element
2283Returns: the transformed block element
2218
2284
2219−### walk_inline {#walk_inline}
2285+### walk\_inline
2220
2286
2221`walk_inline (element, filter)`
2287`walk_inline (element, filter)`
2222
2288
2223−Apply a filter inside an inline element, walking its
2289+Apply a filter inside an inline element, walking its contents.
2224−contents.
2225
2290
2226Parameters:
2291Parameters:
2227
2292
@@ -2229,12 +2294,12 @@ Parameters:
2229: the inline element
2294: the inline element
2230
2295
2231`filter`:
2296`filter`:
2232−: a lua filter (table of functions) to be applied within
2297+: a lua filter (table of functions) to be applied within the
2233− the inline element
2298+ inline element
2234
2299
2235Returns: the transformed inline element
2300Returns: the transformed inline element
2236
2301
2237−### read {#read}
2302+### read
2238
2303
2239`read (markup[, format])`
2304`read (markup[, format])`
2240
2305
@@ -2259,15 +2324,14 @@ Usage:
2259 -- The inline element in that block is an `Emph`
2324 -- The inline element in that block is an `Emph`
2260 assert(block.content[1].t == "Emph")
2325 assert(block.content[1].t == "Emph")
2261
2326
2262−
2263# Module pandoc.utils
2327# Module pandoc.utils
2264
2328
2265This module exposes internal pandoc functions and utility
2329This module exposes internal pandoc functions and utility
2266functions.
2330functions.
2267
2331
2268−The module is loaded as part of the `pandoc` module and available
2332+The module is loaded as part of the `pandoc` module and
2269−as `pandoc.utils`. In versions up-to and including pandoc 2.6,
2333+available as `pandoc.utils`. In versions up-to and including
2270−this module had to be loaded explicitly. Example:
2334+pandoc 2.6, this module had to be loaded explicitly. Example:
2271
2335
2272 local utils = require 'pandoc.utils'
2336 local utils = require 'pandoc.utils'
2273
2337
@@ -2282,16 +2346,16 @@ Squash a list of blocks into a list of inlines.
2282Parameters:
2346Parameters:
2283
2347
2284`blocks`:
2348`blocks`:
2285−: List of [Blocks] to be flattened.
2349+: List of [Blocks](#Blocks) to be flattened.
2286
2350
2287`sep`:
2351`sep`:
2288−: List of [Inlines] inserted as separator between two
2352+: List of [Inlines](#Inlines) inserted as separator between
2289− consecutive blocks; defaults to `{ pandoc.Space(),
2353+ two consecutive blocks; defaults to
2290− pandoc.Str'¶', pandoc.Space()}`.
2354+ `{ pandoc.Space(), pandoc.Str'¶', pandoc.Space()}`.
2291
2355
2292Returns:
2356Returns:
2293
2357
2294−- List of [Inlines]
2358+- List of [Inlines](#Inlines)
2295
2359
2296Usage:
2360Usage:
2297
2361
@@ -2319,30 +2383,26 @@ Parameters:
2319`element1`, `element2`:
2383`element1`, `element2`:
2320: Objects to be compared. Acceptable input types are
2384: Objects to be compared. Acceptable input types are
2321 [Pandoc](#type-ref-pandoc), [Meta](#type-ref-meta),
2385 [Pandoc](#type-ref-pandoc), [Meta](#type-ref-meta),
2322− [MetaValue](#type-ref-MetaValue),
2386+ [MetaValue](#type-ref-MetaValue), [Block](#type-ref-Block),
2323− [Block](#type-ref-Block), [Inline](#type-ref-Inline),
2324− [Attr](#type-ref-Attr),
2387+ [Inline](#type-ref-Inline), [Attr](#type-ref-Attr),
2325 [ListAttributes](#type-ref-ListAttributes), and
2388 [ListAttributes](#type-ref-ListAttributes), and
2326 [Citation](#type-ref-Citation).
2389 [Citation](#type-ref-Citation).
2327
2390
2328Returns:
2391Returns:
2329
2392
2330−- Whether the two objects represent the same element
2393+- Whether the two objects represent the same element (boolean)
2331− (boolean)
2332
2394
2333### hierarchicalize {#utils-hierarchicalize}
2395### hierarchicalize {#utils-hierarchicalize}
2334
2396
2335`hierarchicalize (blocks)`
2397`hierarchicalize (blocks)`
2336
2398
2337−Convert list of [Blocks] into an hierarchical list. An
2399+Convert list of [Blocks](#Blocks) into an hierarchical list. An
2338−hierarchical elements is either a normal block (but no
2400+hierarchical elements is either a normal block (but no Header),
2339−Header), or a `Sec` element. The latter has the following
2401+or a `Sec` element. The latter has the following fields:
2340−fields:
2341
2402
2342- level: level in the document hierarchy;
2403- level: level in the document hierarchy;
2343−- numbering: list of integers of length `level`,
2404+- numbering: list of integers of length `level`, specifying
2344− specifying the absolute position of the section in the
2405+ the absolute position of the section in the document;
2345− document;
2346- attr: section attributes (see [Attr](#Attr));
2406- attr: section attributes (see [Attr](#Attr));
2347- contents: nested list of hierarchical elements.
2407- contents: nested list of hierarchical elements.
2348
2408
@@ -2393,14 +2453,14 @@ Usage:
2393 )
2453 )
2394 some_blocks = sub_doc.blocks -- some blocks with bib
2454 some_blocks = sub_doc.blocks -- some blocks with bib
2395
2455
2396−### normalize_date {#utils-normalize_date}
2456+### normalize\_date {#utils-normalize_date}
2397
2457
2398`normalize_date (date_string)`
2458`normalize_date (date_string)`
2399
2459
2400−Parse a date and convert (if possible) to "YYYY-MM-DD"
2460+Parse a date and convert (if possible) to "YYYY-MM-DD" format.
2401−format. We limit years to the range 1601-9999 (ISO 8601
2461+We limit years to the range 1601-9999 (ISO 8601 accepts greater
2402−accepts greater than or equal to 1583, but MS Word only
2462+than or equal to 1583, but MS Word only accepts dates starting
2403−accepts dates starting 1601).
2463+1601).
2404
2464
2405Returns:
2465Returns:
2406
2466
@@ -2424,8 +2484,8 @@ Usage:
2424
2484
2425`stringify (element)`
2485`stringify (element)`
2426
2486
2427−Converts the given element (Pandoc, Meta, Block, or Inline)
2487+Converts the given element (Pandoc, Meta, Block, or Inline) into
2428−into a string with all formatting removed.
2488+a string with all formatting removed.
2429
2489
2430Returns:
2490Returns:
2431
2491
@@ -2459,9 +2519,9 @@ The `pandoc.mediabag` module allows accessing pandoc's media
2459storage. The "media bag" is used when pandoc is called with the
2519storage. The "media bag" is used when pandoc is called with the
2460`--extract-media` or `--standalone`/`-s` option.
2520`--extract-media` or `--standalone`/`-s` option.
2461
2521
2462−The module is loaded as part of module `pandoc` and can either be
2522+The module is loaded as part of module `pandoc` and can either
2463−accessed via the `pandoc.mediabag` field, or explicitly required,
2523+be accessed via the `pandoc.mediabag` field, or explicitly
2464−e.g.:
2524+required, e.g.:
2465
2525
2466 local mb = require 'pandoc.mediabag'
2526 local mb = require 'pandoc.mediabag'
2467
2527
@@ -2522,11 +2582,11 @@ including their contents, is required. For all other cases,
2522
2582
2523Returns:
2583Returns:
2524
2584
2525− - The iterator function; must be called with the iterator state
2585+- The iterator function; must be called with the iterator
2526− and the current iterator value.
2586+ state and the current iterator value.
2527− - Iterator state – an opaque value to be passed to the iterator
2587+- Iterator state -- an opaque value to be passed to the
2528− function.
2588+ iterator function.
2529− - Initial iterator value.
2589+- Initial iterator value.
2530
2590
2531Usage:
2591Usage:
2532
2592
@@ -2540,10 +2600,10 @@ Usage:
2540
2600
2541Get a summary of the current media bag contents.
2601Get a summary of the current media bag contents.
2542
2602
2543−Returns: A list of elements summarizing each entry in the
2603+Returns: A list of elements summarizing each entry in the media
2544−media bag. The summary item contains the keys `path`,
2604+bag. The summary item contains the keys `path`, `type`, and
2545−`type`, and `length`, giving the filepath, MIME type, and
2605+`length`, giving the filepath, MIME type, and length of contents
2546−length of contents in bytes, respectively.
2606+in bytes, respectively.
2547
2607
2548Usage:
2608Usage:
2549
2609
@@ -2581,9 +2641,9 @@ Usage:
2581
2641
2582`fetch (source, base_url)`
2642`fetch (source, base_url)`
2583
2643
2584−Fetches the given source from a URL or local file. Returns
2644+Fetches the given source from a URL or local file. Returns two
2585−two values: the contents of the file and the MIME type (or
2645+values: the contents of the file and the MIME type (or an empty
2586−an empty string).
2646+string).
2587
2647
2588Returns:
2648Returns:
2589
2649
@@ -2595,135 +2655,108 @@ Usage:
2595 local diagram_url = "https://pandoc.org/diagram.jpg"
2655 local diagram_url = "https://pandoc.org/diagram.jpg"
2596 local contents = pandoc.mediabag.fetch(diagram_url, ".")
2656 local contents = pandoc.mediabag.fetch(diagram_url, ".")
2597
2657
2598−
2599# Module pandoc.List
2658# Module pandoc.List
2600
2659
2601−Pandoc's List type and helper methods.
2660+Pandoc\'s List type and helper methods
2602−
2603−This module is loaded and available as `pandoc.List`. Older
2604−versions up-to and including pandoc 2.6 require the module to be
2605−loaded explicitly. Example:
2606−
2607− local List = require 'pandoc.List'
2608−
2609−The above remains the recommended method to use this module; it
2610−provides the List type under an idiomatic name and is fully
2611−backwards compatible.
2612
2661
2613## Metamethods
2662## Metamethods
2614
2663
2615−### concat {#pandoc.List:__concat}
2664+[`pandoc.List:__concat (list)`]{#pandoc.List:__concat}
2616
2665
2617−`pandoc.List:__concat (list)`
2666+: Concatenates two lists.
2618
2667
2619−Concatenates two lists.
2668+ Parameters:
2620
2669
2621−Parameters:
2670+ `list`:
2671+ : second list concatenated to the first
2622
2672
2623−`list`:
2624−: second list concatenated to the first
2625−
2626−Returns: a new list containing all elements from list1 and
2673+ Returns: a new list containing all elements from list1 and
2627−list2
2674+ list2
2628
2675
2629## Methods
2676## Methods
2630
2677
2631−### clone {#pandoc.List:clone}
2632−
2633−`pandoc.List:clone ()` {#pandoc.List:clone}
2678+[`pandoc.List:clone ()`]{#pandoc.List:clone}
2634
2679
2635−Returns a (shallow) copy of the list.
2680+: Returns a (shallow) copy of the list.
2636
2681
2637−### includes {#pandoc.List:includes}
2682+[`pandoc.List:includes (needle, init)`]{#pandoc.List:includes}
2638
2683
2639−`pandoc.List:includes (needle, init)`
2684+: Checks if the list has an item equal to the given needle.
2640
2685
2641−Checks if the list has an item equal to the given needle.
2642−
2643−Parameters:
2686+ Parameters:
2644
2687
2645−`needle`:
2688+ `needle`:
2646−: item to search for
2689+ : item to search for
2647
2690
2648−`init`:
2691+ `init`:
2649−: index at which the search is started
2692+ : index at which the search is started
2650
2693
2651−Returns: true if a list item is equal to the needle, false
2694+ Returns: true if a list item is equal to the needle, false
2652−otherwise
2695+ otherwise
2653
2696
2654−### find {#pandoc.List:find}
2697+[`pandoc.List:find (needle, init)`]{#pandoc.List:find}
2655
2698
2656−`pandoc.List:find (needle, init)`
2699+: Returns the value and index of the first occurrence of the
2700+ given item.
2657
2701
2658−Returns the value and index of the first occurrence of the
2702+ Parameters:
2659−given item.
2660
2703
2661−Parameters:
2704+ `needle`:
2705+ : item to search for
2662
2706
2663−`needle`:
2707+ `init`:
2664−: item to search for
2708+ : index at which the search is started
2665
2709
2666−`init`:
2710+ Returns: first item equal to the needle, or nil if no such
2667−: index at which the search is started
2711+ item exists.
2668
2712
2669−Returns: first item equal to the needle, or nil if no such
2713+[`pandoc.List:find_if (pred, init)`]{#pandoc.List:find_if}
2670−item exists.
2671
2714
2672−### find_if {#pandoc.List:find_if}
2715+: Returns the value and index of the first element for which
2716+ the predicate holds true.
2673
2717
2674−`pandoc.List:find_if (pred, init)`
2718+ Parameters:
2675
2719
2676−Returns the value and index of the first element for which
2720+ `pred`:
2677−the predicate holds true.
2721+ : the predicate function
2678
2722
2679−Parameters:
2723+ `init`:
2724+ : index at which the search is started
2680
2725
2681−`pred`:
2726+ Returns: first item for which \`test\` succeeds, or nil if
2682−: the predicate function
2727+ no such item exists.
2683
2728
2684−`init`:
2729+[`pandoc.List:extend (list)`]{#pandoc.List:extend}
2685−: index at which the search is started
2686
2730
2687−Returns: first item for which \`test\` succeeds, or nil if
2731+: Adds the given list to the end of this list.
2688−no such item exists.
2689
2732
2690−### extend {#pandoc.List:extend}
2733+ Parameters:
2691
2734
2692−`pandoc.List:extend (list)`
2735+ `list`:
2736+ : list to appended
2693
2737
2694−Adds the given list to the end of this list.
2738+[`pandoc.List:map (fn)`]{#pandoc.List:map}
2695
2739
2696−Parameters:
2740+: Returns a copy of the current list by applying the given
2741+ function to all elements.
2697
2742
2698−`list`:
2743+ Parameters:
2699−: list to appended
2700
2744
2701−### map {#pandoc.List:map}
2745+ `fn`:
2746+ : function which is applied to all list items.
2702
2747
2703−`pandoc.List:map (fn)`
2748+[`pandoc.List:filter (pred)`]{#pandoc.List:filter}
2704
2749
2705−Returns a copy of the current list by applying the given
2750+: Returns a new list containing all items satisfying a given
2706−function to all elements.
2751+ condition.
2707
2752
2708−Parameters:
2753+ Parameters:
2709
2754
2710−`fn`:
2755+ `pred`:
2711−: function which is applied to all list items.
2756+ : condition items must satisfy.
2712
2757
2713−### filter {#pandoc.List:filter}
2714−
2715−`pandoc.List:filter (pred)`
2716−
2717−Returns a new list containing all items satisfying a given
2718−condition.
2719−
2720−Parameters:
2721−
2722−`pred`:
2723−: condition items must satisfy.
2724−
2725−Returns: a new list containing all items for which \`test\`
2758+ Returns: a new list containing all items for which \`test\`
2726−was true.
2759+ was true.
2727
2760
2728# Module pandoc.system
2761# Module pandoc.system
2729
2762
@@ -2749,8 +2782,8 @@ Retrieve the entire environment as a string-indexed table.
2749
2782
2750Returns:
2783Returns:
2751
2784
2752−- A table mapping environment variables names to their string value
2785+- A table mapping environment variables names to their string
2753− (table).
2786+ value (table).
2754
2787
2755### get\_working\_directory {#system-get_working_directory}
2788### get\_working\_directory {#system-get_working_directory}
2756
2789
@@ -2760,7 +2793,7 @@ Obtain the current working directory as an absolute path.
2760
2793
2761Returns:
2794Returns:
2762
2795
2763−- The current working directory (string).
2796+- The current working directory (string).
2764
2797
2765### with\_environment {#system-with_environment}
2798### with\_environment {#system-with_environment}
2766
2799
@@ -2796,16 +2829,16 @@ The directory is deleted after the callback returns.
2796Parameters:
2829Parameters:
2797
2830
2798`parent_dir`
2831`parent_dir`
2799−: Parent directory to create the directory in (string). If this
2832+: Parent directory to create the directory in (string). If
2800− parameter is omitted, the system's canonical temporary
2833+ this parameter is omitted, the system's canonical temporary
2801 directory is used.
2834 directory is used.
2802
2835
2803`templ`
2836`templ`
2804: Directory name template (string).
2837: Directory name template (string).
2805
2838
2806`callback`
2839`callback`
2807−: Function which takes the name of the temporary directory as its
2840+: Function which takes the name of the temporary directory as
2808− first argument (function).
2841+ its first argument (function).
2809
2842
2810Returns:
2843Returns:
2811
2844
@@ -2833,7 +2866,6 @@ Returns:
2833
2866
2834- The result(s) of the call to `callback`
2867- The result(s) of the call to `callback`
2835
2868
2836−
2837# Module pandoc.types
2869# Module pandoc.types
2838
2870
2839Constructors for types which are not part of the pandoc AST.
2871Constructors for types which are not part of the pandoc AST.