-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the new 'simpleFigure' builder function in the readers. #7364
Conversation
9648414
to
c3aa2de
Compare
37d6e10
to
7f19e7f
Compare
33fa95f
to
3e2ab7a
Compare
63da432
to
8fe4216
Compare
461382c
to
d2b01ca
Compare
Hi @jgm, GSoC is over. I'm interested about what you think about this. |
d2b01ca
to
56d4537
Compare
Great! I will look at it when I have a chance.
Then I can have a look. |
dd4fa65
to
6dc0e1f
Compare
* It provides a specific representation for figures in the pandoc's AST. * It uses the `SimpleFigure` pattern synonym to replace the previous construction: [Para [Image ("",[],[]) [Str "CAP2"] ("../media/rId25.jpg","fig:")]]
I've squashed the commits while re-basing to current master. CI works now. Please, let me know what you think. |
I'd love to see this merged. I've got a use case where I want to include a description of a figure in the caption but supply a figure title that will be shown next to the figure number and used for the TOC/LOF. |
Yes, this was all merged as part of 909ced5. |
Reading input with figures
Reading figures is now supported for two formats natively and one format through a Lua filter. This functionality has to be enabled with a new pandoc extension:
native_figures
.The choice of an extension was made to introduce the new behavior with minimal disruption of the old one.
Reading HTML 5 figures
This version of pandoc can now read figures from HTML into its internal representation:
Now
The difference with the old handling is that, now, elements inside a figure are not limited to only one image:
Before
Notice the missing
ITEM
. Handling of attributes and classes has also become more granular and accurate. Notice the missingimportant
class above.Reading LaTeX figures
It can also read LaTeX figures:
Now
It respects the figure and sub figure hierarchies, labels and captions accurately.
Before
Figures with sub-figures where flattened into a list of figures using the construction mentioned in the original figure handling section. Some captions and labels are lost.
Markdown figures
Handling of markdown figures was implemented through a Lua filter. We opted for this approach because there is yet no agreed-upon syntax for figures in markdown (for example commonmark). Pandoc has its own markdown flavor but we have also opted to propose our syntax by implementing it as a filter. The code of the filter has been submitted in the lua-filters pull request.
I've written two filters that represent two possible markdown syntax extensions to represent figures. Both use pandoc's markdown
div
sytax with special classes.The explcit caption syntax
In this syntax a figure is a pandoc div with a
figure
class and the caption,if present, is a div with a
caption
class.Here is an example that converts this to HTML
The implicit caption syntax
This, more concise, syntax uses the last paragraph inside the div as the caption for the figure.
Generating output with figures.
Once figures can be described in pandoc's internal representation, it is the
Writers
that translate them into various output formats. Not all output formats can represent figures, and for those that can, we have decided to focus on the ones that would make the least intrusive modifications first.Next, I'll briefly enumerate the output resulting from the
Figure
constructor in various formats.HTML
Figures are represented as
<figure>
tags.Org mode format
Emac's org mode adds an anchor to the content of the figure.
Textile
The textile format constructs an HTML5 figure.
Texinfo
GNU Info's figures.
RST
Figures are represented as containers.
Markdown
Figures are represented as a pandoc div ith the
.figure
class.MediaWiki
Figures are represented as a div with the
figure
class.Jats
Figures are represented with the
boxed-text
tag in JATS.XWiki
Figures are represented as groups.
Ohter formats
All other formats handle figures like they handle pandoc's divs.
Testing
To test these formats the command line testing can now be done in a particular folder:
Readers
alt-text
tag in figures and test.VimWikiDokuWikiIpynbDocxODTWriters
Muse. It works directly onInline
TEI. Code is commented. Seems like it's fixable. Figure descriptions have a 'fig:' prefix in the output.