-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenDocument writer: Allow references for internal links
This commit adds two extensions to the OpenDocument writer, `references_over_links` and `number_prefix_references`. The first extension, `references_over_links`, substitutes document internal links for references to headers, figures and tables. Text in references is kept consistent with the referenced header, table or figure which is an improvement if the document is edited after being generated by pandoc. The second extension `number_prefix_references` will prefix the header references with the number according to the style of the referenced heading in the final document. As noted in the MANUAL.txt the document will need to have indexes updated for these numbers to be generated - similarly to table of contents in OpenDocument. Figure and table references are not number prefixed as the numbers for those are inline in the caption.
- Loading branch information
Showing
4 changed files
with
142 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
``` | ||
% pandoc -f native -t opendocument --quiet | ||
[Header 1 ("chapter1",[],[]) [Str "The",Space,Str "Chapter"] | ||
,Para [Str "Chapter",Space,Str "1",Space,Str "references",Space,Link ("",[],[]) [Str "The",Space,Str "Chapter"] ("#chapter1","")]] | ||
^D | ||
<text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="chapter1" />The | ||
Chapter<text:bookmark-end text:name="chapter1" /></text:h> | ||
<text:p text:style-name="First_20_paragraph">Chapter 1 references | ||
<text:a xlink:type="simple" xlink:href="#chapter1" office:name=""><text:span text:style-name="Definition">The | ||
Chapter</text:span></text:a></text:p> | ||
``` | ||
``` | ||
% pandoc -f native -t opendocument+references_over_links --quiet | ||
[Header 1 ("chapter1",[],[]) [Str "The",Space,Str "Chapter"] | ||
,Para [Str "Chapter",Space,Str "1",Space,Str "references",Space,Link ("",[],[]) [Str "The",Space,Str "Chapter"] ("#chapter1","")] | ||
,Para [Image ("lalune",[],[]) [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")] | ||
,Para [Str "Image",Space,Str "1",Space,Str "references",Space,Link ("",[],[]) [Str "La",Space,Str "Lune"] ("#lalune","")]] | ||
^D | ||
<text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="chapter1" />The | ||
Chapter<text:bookmark-end text:name="chapter1" /></text:h> | ||
<text:p text:style-name="First_20_paragraph">Chapter 1 references | ||
<text:bookmark-ref text:reference-format="text" text:ref-name="chapter1">The | ||
Chapter</text:bookmark-ref></text:p> | ||
<text:p text:style-name="FigureWithCaption"><draw:frame draw:name="img1"><draw:image xlink:href="lalune.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame></text:p> | ||
<text:p text:style-name="FigureCaption">lalune</text:p> | ||
<text:p text:style-name="Text_20_body">Image 1 references | ||
<text:sequence-ref text:reference-format="text" text:ref-name="lalune">La | ||
Lune</text:sequence-ref></text:p> | ||
``` | ||
``` | ||
% pandoc -f native -t opendocument+references_over_links+number_prefix_references --quiet | ||
[Header 1 ("chapter1",[],[]) [Str "The",Space,Str "Chapter"] | ||
,Para [Str "Chapter",Space,Str "1",Space,Str "references",Space,Link ("",[],[]) [Str "The",Space,Str "Chapter"] ("#chapter1","")]] | ||
^D | ||
<text:h text:style-name="Heading_20_1" text:outline-level="1"><text:bookmark-start text:name="chapter1" />The | ||
Chapter<text:bookmark-end text:name="chapter1" /></text:h> | ||
<text:p text:style-name="First_20_paragraph">Chapter 1 references | ||
<text:bookmark-ref text:reference-format="number" text:ref-name="chapter1"></text:bookmark-ref><text:s /><text:bookmark-ref text:reference-format="text" text:ref-name="chapter1">The | ||
Chapter</text:bookmark-ref></text:p> | ||
``` |