Open rbeezer opened 4 years ago
Long story, bad cut/paste job. Just edited-in a new first paragraph.
The script claims that "pre" is in the list of varbatim tags, which is supposed to mean that whitespace is not stripped.
I will investigate.
On Sat, 21 Nov 2020, Rob Beezer wrote:
Pretty-printing seems to be removing this. Reviewing sample article output from
ltol.py xml_pp mathbook/examples/sample-article/ .
- c leads to some long lines, but they are partly testing artifacts, all OK
- cd, w/ and w/out cline structure, look great. Indented consistent with surroundings.
- pre and pre/cline entirely flush left, both elements and multi-line bare text
- program/input entirely flush left (both elements, and code), indentation clobbered
- sage/input entirely flush left (both elements, and code), indentation clobbered
PreTeXt has a template to strip "common" leading whitespace from multi-line bare text. For pretty-printing purposes, I'd think you want to mimic most/all of this, and then add in the current indentation as whitespace? At least see documentation of effect:
https://github.com/rbeezer/mathbook/blob/512bf5d956f01262bf245f8cf45d8607e0f3a54e/xsl/pretext -common.xsl#L2660
Or maybe you know what current indentation is and believe source is respecting that for multi-line text and you can just work off the delta between author's indentation and destination/pretty-printed output.
I think AATA Sage code is still a bit of a mess from this. But mostly the code is one-liners so not too much had to be re-indented to run. But for an author with lots of Python/Sage, this would be a problem.
And I forgot about asymptote, sageplot, latex-image which could be entirely similar. Some of that, and some of this is on #23.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, orunsubscribe.[AABTULDLCL5UNORT3HOCKBLSRAS4NA5CNFSM4T6AOIWKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33N NVSW45C7NFSM4LEXEFKA.gif]
PreTeXt supports multi-line "verbatim" input, with the intent to respect indentation. For code that needs to actually needs to run (e.g. Python in a
program
for Runestaone use, Sage in asage
for the Sage cell). But also for purely visual uses, like apre
.Pretty-printing seems to be removing this. Reviewing sample article output from
c
leads to some long lines, but they are partly testing artifacts, all OKcd
, w/ and w/outcline
structure, look great. Indented consistent with surroundings.pre
andpre/cline
entirely flush left, both elements and multi-line bare textprogram/input
entirely flush left (both elements, and code), indentation clobberedsage/input
entirely flush left (both elements, and code), indentation clobberedPreTeXt has a template to strip "common" leading whitespace from multi-line bare text. For pretty-printing purposes, I'd think you want to mimic most/all of this, and then add in the current indentation as whitespace? At least see documentation of effect:
https://github.com/rbeezer/mathbook/blob/512bf5d956f01262bf245f8cf45d8607e0f3a54e/xsl/pretext-common.xsl#L2660
Or maybe you know what current indentation is and believe source is respecting that for multi-line text and you can just work off the delta between author's indentation and destination/pretty-printed output.
I think AATA Sage code is still a bit of a mess from this. But mostly the code is one-liners so not too much had to be re-indented to run. But for an author with lots of Python/Sage, this would be a problem.
And I forgot about
asymptote
,sageplot
,latex-image
which could be entirely similar. Some of that, and some of this is on #23.