Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect indentation for multi-line verbatim text #28

Open
rbeezer opened this issue Nov 21, 2020 · 2 comments
Open

Respect indentation for multi-line verbatim text #28

rbeezer opened this issue Nov 21, 2020 · 2 comments

Comments

@rbeezer
Copy link
Contributor

rbeezer commented Nov 21, 2020

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 a sage for the Sage cell). But also for purely visual uses, like a pre.

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.

@rbeezer
Copy link
Contributor Author

rbeezer commented Nov 21, 2020

Long story, bad cut/paste job. Just edited-in a new first paragraph.

@davidfarmer
Copy link
Owner

davidfarmer commented Nov 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants