Use the new 'simpleFigure' builder function in the readers. - #7364
Closed
argent0 wants to merge 3 commits into
Closed
Use the new 'simpleFigure' builder function in the readers.#7364argent0 wants to merge 3 commits into
argent0 wants to merge 3 commits into
Conversation
argent0
marked this pull request as draft
June 9, 2021 13:14
argent0
force-pushed
the
figures-gsoc
branch
5 times, most recently
from
June 17, 2021 13:24
9648414 to
c3aa2de
Compare
argent0
force-pushed
the
figures-gsoc
branch
4 times, most recently
from
June 22, 2021 15:46
37d6e10 to
7f19e7f
Compare
argent0
marked this pull request as ready for review
June 22, 2021 16:44
argent0
force-pushed
the
figures-gsoc
branch
5 times, most recently
from
June 29, 2021 09:37
33fa95f to
3e2ab7a
Compare
argent0
force-pushed
the
figures-gsoc
branch
3 times, most recently
from
August 19, 2021 12:31
63da432 to
8fe4216
Compare
argent0
force-pushed
the
figures-gsoc
branch
3 times, most recently
from
August 25, 2021 17:16
461382c to
d2b01ca
Compare
Contributor
Author
|
Hi @jgm, GSoC is over. I'm interested about what you think about this. |
argent0
force-pushed
the
figures-gsoc
branch
from
September 1, 2021 23:06
d2b01ca to
56d4537
Compare
Owner
|
Great! I will look at it when I have a chance.
Then I can have a look. |
argent0
force-pushed
the
figures-gsoc
branch
3 times, most recently
from
September 9, 2021 22:12
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:")]]
Contributor
Author
|
I've squashed the commits while re-basing to current master. CI works now. Please, let me know what you think. |
This was referenced Nov 20, 2021
|
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. |
Owner
Collaborator
|
Yes, this was all merged as part of 909ced5. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 missingimportantclass 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
divsytax with special classes.The explcit caption syntax
::: { .figure } content. :::: {.caption } caption :::: :::In this syntax a figure is a pandoc div with a
figureclass and the caption,if present, is a div with a
captionclass.Here is an example that converts this to HTML
The implicit caption syntax
::: { .figure } figure content figure caption. :::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
Writersthat 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
Figureconstructor 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
::: {#fig-id .figure}  :::Figures are represented as a pandoc div ith the
.figureclass.MediaWiki
Figures are represented as a div with the
figureclass.Jats
Figures are represented with the
boxed-texttag 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-texttag in figures and test.VimWikiDokuWikiIpynbDocxODTWriters
Muse. It works directly onInlineTEI. Code is commented. Seems like it's fixable. Figure descriptions have a 'fig:' prefix in the output.