Introduce spans for wrapping long strings

This commit is contained in:
Ben Edgington
2025-06-16 12:33:51 +01:00
parent 895a266f98
commit 387e1b0a16
3 changed files with 24 additions and 0 deletions

View File

@@ -15,3 +15,17 @@ function RawInline (el)
end
return el
end
-- We now support <span class="wrap">...</span>
-- These spans must contain only raw text (or backquoted code), with no nested elements
function Span (span)
if span.classes:includes('wrap') then
if (span.content[1].t == 'Str') then
return pandoc.RawInline('latex', '\\seqsplit{' .. span.content[1].text .. '}')
end
if (span.content[1].t == 'Code') then
return pandoc.RawInline('latex', '\\texttt{\\seqsplit{' .. span.content[1].text .. '}}')
end
end
return span
end

View File

@@ -154,3 +154,8 @@
\let\prevsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\prevsubparagraph{#1}\nopagebreak}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Used by linebreaks.lua to split long hexadecimal strings
\usepackage{seqsplit}

View File

@@ -86,6 +86,11 @@ code {
font-size: 95%;
}
/*** Wrapping long lines of hex ***/
span.wrap {
word-break: break-all;
}
/*** Constant line heights ***/
sup, sub {