diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-01-13 18:01:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-13 18:01:34 +0000 |
commit | 49722fd14a26ca6a751932949491a87afe592d0d (patch) | |
tree | 39ef79595d5b0e4c5cafb3fd7f73e95cd3500d66 /doc | |
parent | 54cb39a3f5cd6a1b1138ec8dcc90ffaf7e8f0927 (diff) | |
parent | befc83905c965adfd33e5cae49acb0351f6e0404 (diff) | |
download | nixlib-49722fd14a26ca6a751932949491a87afe592d0d.tar nixlib-49722fd14a26ca6a751932949491a87afe592d0d.tar.gz nixlib-49722fd14a26ca6a751932949491a87afe592d0d.tar.bz2 nixlib-49722fd14a26ca6a751932949491a87afe592d0d.tar.lz nixlib-49722fd14a26ca6a751932949491a87afe592d0d.tar.xz nixlib-49722fd14a26ca6a751932949491a87afe592d0d.tar.zst nixlib-49722fd14a26ca6a751932949491a87afe592d0d.zip |
Merge master into staging-next
Diffstat (limited to 'doc')
-rw-r--r-- | doc/build-aux/pandoc-filters/myst-reader/roles.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/doc/build-aux/pandoc-filters/myst-reader/roles.lua b/doc/build-aux/pandoc-filters/myst-reader/roles.lua index c33a688eeba7..f4ef6d390b40 100644 --- a/doc/build-aux/pandoc-filters/myst-reader/roles.lua +++ b/doc/build-aux/pandoc-filters/myst-reader/roles.lua @@ -17,9 +17,16 @@ function Inlines(inlines) if correct_tags then -- docutils supports alphanumeric strings separated by [-._:] -- We are slightly more liberal for simplicity. - local role = first.text:match('^{([-._+:%w]+)}$') - if role ~= nil then - inlines:remove(i) + -- Allow preceding punctuation (eg '('), otherwise '({file}`...`)' + -- does not match. Also allow anything followed by a non-breaking space + -- since pandoc emits those after certain abbreviations (e.g. e.g.). + local prefix, role = first.text:match('^(.*){([-._+:%w]+)}$') + if role ~= nil and (prefix == '' or prefix:match("^.*[%p ]$") ~= nil) then + if prefix == '' then + inlines:remove(i) + else + first.text = prefix + end second.attributes['role'] = role second.classes:insert('interpreted-text') end |