Skip to content
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

Add default renderers for unnumbered sections in LaTeX #430

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## 3.5.0

Default Renderer Prototypes:

- Add default renderers for unnumbered sections in LaTeX.
(#401, istqborg/istqb_product_base#23, #430, reported by @felinecrp,
sponsored by @istqborg)

## 3.4.3

Fixes:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Acknowledgements
| [<img width="150" src="https://www.fi.muni.cz/images/fi-logo.png">][fimu] | I gratefully acknowledge the funding from the [Faculty of Informatics][fimu] at the [Masaryk University][mu] in Brno, Czech Republic, for the development of the Markdown package in projects [MUNI/33/12/2015][], [MUNI/33/1784/2020][], [MUNI/33/0776/2021][], [MUNI/33/1654/2022][], and [MUNI/33/1658/2022][]. |
| [<img width="150" src="https://cdn.overleaf.com/img/ol-brand/overleaf_og_logo.png">][overleaf] | Extensive user documentation for the Markdown package was kindly written by [Lian Tze Lim][liantze] and published by [Overleaf][]. |
| [<img width="150" src="https://pbs.twimg.com/profile_images/1004769879319334912/6Bh1UthD.jpg">][omedym] | Support for content slicing (Lua options [`shiftHeadings`][option-shift-headings] and [`slice`][option-slice]) and pipe tables (Lua options [`pipeTables`][option-pipe-tables] and [`tableCaptions`][option-table-captions]) was graciously sponsored by [David Vins][dvins] and [Omedym][]. |
| [<img width="150" src="https://www.istqb.org/static/istqb-logo-1b043e800a580724ad223567f9ea57c0.png">][istqb] | Fixes for issues [#359][issue-359], [#368][issue-368], and [#424][issue-424] were graciously sponsored by the [International Software Testing Qualifications Board (ISTQB)][istqb]. |
| [<img width="150" src="https://www.istqb.org/static/istqb-logo-1b043e800a580724ad223567f9ea57c0.png">][istqb] | Fixes for issues [#359][issue-359], [#368][issue-368], [#401][issue-401], and [#424][issue-424] were graciously sponsored by the [International Software Testing Qualifications Board (ISTQB)][istqb]. |

[dvins]: https://github.com/dvins "David Vins"
[fimu]: https://www.fi.muni.cz/index.html.en "Faculty of Informatics, Masaryk University"
Expand All @@ -284,6 +284,7 @@ Acknowledgements

[issue-359]: https://github.com/witiko/markdown/issues/359 "First item of a fancy list forms a separate list"
[issue-368]: https://github.com/witiko/markdown/issues/368 "Tables nested in list items have empty lines"
[issue-401]: https://github.com/witiko/markdown/issues/401 "Create an unnumbered section"
[issue-424]: https://github.com/witiko/markdown/issues/424 "E-mail addresses are incorrectly interpreted as bracketed citations"

[option-pipe-tables]: https://mirrors.ctan.org/macros/generic/markdown/markdown.html#pipe-tables "Markdown Package User Manual"
Expand Down
82 changes: 60 additions & 22 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -34677,35 +34677,73 @@ end
% \par
% \begin{markdown}
%
% If identifier attributes appear at the beginning of a section, we make them
% produce the `\label` macro.
% If identifier attributes appear after a heading, we make them produce
% `\label` macros. If the `.unnumbered` class name (or the `{-}` shorthand)
% appears after a heading the heading and all its subheadings will be
% unnumbered.
%
% \end{markdown}
% \begin{macrocode}
\ExplSyntaxOn
\seq_new:N \l_@@_header_identifiers_seq
\markdownSetup{
rendererPrototypes = {
headerAttributeContextBegin = {
\seq_clear:N \l_@@_header_identifiers_seq
\markdownSetup
{
renderers = {
attributeIdentifier = {
\seq_put_right:Nn
\l_@@_header_identifiers_seq
{ ##1 }
\bool_new:N \l_@@_header_unnumbered_bool
\markdownSetup
{
rendererPrototypes = {
headerAttributeContextBegin = {
\seq_clear:N \l_@@_header_identifiers_seq
\markdownSetup
{
rendererPrototypes = {
attributeIdentifier = {
\seq_put_right:Nn
\l_@@_header_identifiers_seq
{ ##1 }
},
attributeClassName = {
\bool_if:nT
{
\str_if_eq_p:nn
{ ##1 }
{ unnumbered } &&
! \l_@@_header_unnumbered_bool
}
{
\group_begin:
\bool_set_true:N
\l_@@_header_unnumbered_bool
\c@secnumdepth = 0
% \end{macrocode}
% \begin{markdown}
%
% Count the number of nested sections, so that we only start numbering sections
% again when the top-level unnumbered section has ended.
%
% \end{markdown}
% \begin{macrocode}
\markdownSetup
{
rendererPrototypes = {
sectionBegin = {
\group_begin:
},
sectionEnd = {
\group_end:
},
},
}
}
},
},
},
}
},
headerAttributeContextEnd = {
\seq_map_inline:Nn
\l_@@_header_identifiers_seq
{ \label { ##1 } }
}
},
headerAttributeContextEnd = {
\seq_map_inline:Nn
\l_@@_header_identifiers_seq
{ \label { ##1 } }
},
},
},
}
}
\ExplSyntaxOff
\markdownSetup{rendererPrototypes={
superscript = {\textsuperscript{#1}},
Expand Down
Loading