Add the SimpleFigure bidirectional pattern synonym. #93
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.
Technically not API-Change ?
The first change part of #90
To address some of the issues with the previous handling of figures, we introduced, along with some helper functions, the
SimpleFigure
pattern synonymThis is very much like adding a new constructor to the
Block
type but with some differences.Some benefits of this approach are:
It is backward compatible with the previous construction.
It formalizes, without enforcing, the roles for the construction's elements.
It makes it easier to find where are figures handled in the code for both
Readers
andWriters
.Here is an example diff from the RST
Reader
in the pandoc pull request:Of course, there are also some limitations:
It doesn't enforce the construction on new code, as an actual constructor would do. For example, code with non-exhaustive patterns matches won't rise a warning if
SimpleFigure
is not handled.It lacks an explicit
alt-text
field. This can be included using attributes, but I would have liked to give it more importance.I believe this is a modest improvement of the previous code. It provides an explicit representation for figures. It could go a little further with an explicit constructor; but keeping the behavior backward compatible prevents breaking some workflows down the line, for example someone using a
lua-filter
.