mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-17 18:07:02 +00:00
manual: use modified "haddock.theme" for nicer syntax highlighting;
use `tcolorbox` instead of `framed` for latex code blocks, works much better, especially as now when using a background colour; reduce gap after figures and force footnotes to bottom of page; move most symbology figures to after some text to lessen chance of subsection headers being orphaned on their own at end of page: required a number of rewordings; use named barcodes in example commands, rather than numbered; fix "lua-crossrefs" filter to allow parentheses around references; various other fixes and rephrasings
This commit is contained in:
13
docs/lua-crossrefs/.luacheckrc
Normal file
13
docs/lua-crossrefs/.luacheckrc
Normal file
@@ -0,0 +1,13 @@
|
||||
stds.pandoc = {
|
||||
read_globals = {
|
||||
'FORMAT',
|
||||
'pandoc',
|
||||
'PANDOC_VERSION',
|
||||
},
|
||||
|
||||
globals = {
|
||||
'Pandoc',
|
||||
},
|
||||
}
|
||||
|
||||
std = 'lua54+pandoc'
|
||||
@@ -5,12 +5,14 @@
|
||||
-- © 2025 R. N. West. Released under the GPL version 2 or greater.
|
||||
-- SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
PANDOC_VERSION:must_be_at_least '3.8.2'
|
||||
|
||||
-- Hacked from "pandoc-lua-crossrefs/init.lua"
|
||||
|
||||
-- Table of Ids and corresponding cross-referenceable elements. To be populated
|
||||
-- by various element numbering functions.
|
||||
---@type table<string, {type: ('fig'|'tbl'), number: string, caption: string}>
|
||||
IDs = {}
|
||||
local IDs = {}
|
||||
|
||||
-- Hacked from "pandoc-lua-crossrefs/lib/crossrefs.lua"
|
||||
|
||||
@@ -26,8 +28,8 @@ end
|
||||
---@param str Str
|
||||
---@return Inline[] | nil
|
||||
local _parse_crossref = function(str)
|
||||
local opening_bracket, prefix_suppressor, id, closing_bracket1, punctuation, closing_bracket2 =
|
||||
str.text:match('^(%[?)(%-?)#([%a%d-_:%.]-)(%]?)([\\%.!:?,;)]-)(%]?)$')
|
||||
local opening_paren, opening_bracket, prefix_suppressor, id, closing_bracket1, punctuation, closing_bracket2 =
|
||||
str.text:match('^(%(?)(%[?)(%-?)#([%a%d-_:%.]-)(%]?)([\\%.!:?,;)]-)(%]?)$')
|
||||
if not id or id == '' then return end
|
||||
local only_internal_punctuation = id:find('^[%a%d]+[%a%d%-_:%.]*[%a%d]+$') or id:find('^[%a%d]+$')
|
||||
if not only_internal_punctuation then return end
|
||||
@@ -37,6 +39,7 @@ local _parse_crossref = function(str)
|
||||
if prefix_suppressor == '-' then crossref.attributes['reference-type'] = 'ref' end
|
||||
local elts = pandoc.List { crossref }
|
||||
if opening_bracket == '[' then elts:insert(1, pandoc.Str('[')) end
|
||||
if opening_paren == '(' then elts:insert(1, pandoc.Str('(')) end
|
||||
if closing_bracket1 == ']' then elts:insert(pandoc.Str(']')) end
|
||||
if punctuation ~= '' then elts:insert(pandoc.Str(punctuation)) end
|
||||
if closing_bracket2 == ']' then elts:insert(pandoc.Str(']')) end
|
||||
|
||||
Reference in New Issue
Block a user