-
Notifications
You must be signed in to change notification settings - Fork 391
Open
Labels
crossrefenhancementNew feature or requestNew feature or requestluaIssues related to the lua codebase, filter chain, etcIssues related to the lua codebase, filter chain, etcmaintenanceperformancetablesIssues with Tables including the gt integrationIssues with Tables including the gt integration
Description
I just noticed this while reading code.
For raw LaTeX Table, we do process table patterns, only when found
quarto-cli/src/resources/filters/quarto-pre/table-captions.lua
Lines 171 to 181 in b42543e
| elseif hasRawLatexTable(raw) then | |
| for i,pattern in ipairs(_quarto.patterns.latexTablePatterns) do | |
| local match_fun = _quarto.modules.patterns.match_all_in_table(pattern) | |
| if match_fun(raw.text) then | |
| local combined_pattern = _quarto.modules.patterns.combine_patterns(pattern) | |
| raw.text = applyLatexTableCaption(raw.text, tblCaptions[idx], tblLabels[idx], combined_pattern) | |
| break | |
| end | |
| end | |
| idx = idx + 1 | |
| elseif hasPagedHtmlTable(raw) then |
though we also do the exact same inside the function call
quarto-cli/src/resources/filters/quarto-pre/table-captions.lua
Lines 202 to 221 in b42543e
| function applyLatexTableCaption(latex, tblCaption, tblLabel, tablePattern) | |
| local latexCaptionPattern = _quarto.patterns.latexCaptionPattern | |
| local latex_caption_match = _quarto.modules.patterns.match_all_in_table(latexCaptionPattern) | |
| -- insert caption if there is none | |
| local beginCaption, caption = latex_caption_match(latex) | |
| if not beginCaption then | |
| latex = latex:gsub(tablePattern, "%1" .. "\n\\caption{ }\\tabularnewline\n" .. "%2%3", 1) | |
| end | |
| -- apply table caption and label | |
| local beginCaption, captionText, endCaption = latex_caption_match(latex) | |
| if #tblCaption > 0 then | |
| captionText = stringEscape(tblCaption, "latex") | |
| end | |
| if #tblLabel > 0 then | |
| captionText = captionText .. " {#" .. tblLabel .. "}" | |
| end | |
| assert(captionText) | |
| latex = latex:gsub(_quarto.modules.patterns.combine_patterns(latexCaptionPattern), "%1" .. captionText:gsub("%%", "%%%%") .. "%3", 1) | |
| return latex | |
| end |
As those string matching were already a problem related to perf (#9733), maybe this is worth simplifying here to avoid the duplicate treatment
Metadata
Metadata
Assignees
Labels
crossrefenhancementNew feature or requestNew feature or requestluaIssues related to the lua codebase, filter chain, etcIssues related to the lua codebase, filter chain, etcmaintenanceperformancetablesIssues with Tables including the gt integrationIssues with Tables including the gt integration