From 12700edb4e6d7b8d835c1d0849a6bb85ec1280a8 Mon Sep 17 00:00:00 2001 From: Andrew Scholer Date: Mon, 9 Dec 2024 15:18:27 -0800 Subject: [PATCH 1/3] Script: add strip-trailing-whitespace-line template --- xsl/pretext-text-utilities.xsl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xsl/pretext-text-utilities.xsl b/xsl/pretext-text-utilities.xsl index fb6de16cf..8ae975ae0 100644 --- a/xsl/pretext-text-utilities.xsl +++ b/xsl/pretext-text-utilities.xsl @@ -849,6 +849,30 @@ along with PreTeXt. If not, see . + + + + + + + + + + + + + + + + + + + + + + + + From 956687585a5c0f57c445ae45701add3e7bb20658 Mon Sep 17 00:00:00 2001 From: Andrew Scholer Date: Mon, 9 Dec 2024 15:20:01 -0800 Subject: [PATCH 2/3] HTML: handle program/code with no start/end newline --- xsl/pretext-html.xsl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xsl/pretext-html.xsl b/xsl/pretext-html.xsl index a913e36b8..6ce9f4989 100644 --- a/xsl/pretext-html.xsl +++ b/xsl/pretext-html.xsl @@ -9202,9 +9202,10 @@ along with MathBook XML. If not, see . - - - + + + + From 60ba1e7bb27232ad1e3d23833207a4b3a264d7cf Mon Sep 17 00:00:00 2001 From: Andrew Scholer Date: Mon, 9 Dec 2024 15:20:18 -0800 Subject: [PATCH 3/3] Samples: add program/code no newline test to sample-article --- examples/sample-article/sample-article.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/sample-article/sample-article.xml b/examples/sample-article/sample-article.xml index d31efa0fb..cce2bd170 100644 --- a/examples/sample-article/sample-article.xml +++ b/examples/sample-article/sample-article.xml @@ -10688,6 +10688,10 @@ along with MathBook XML. If not, see . +

Although a program should have a code element surrounding its code, we attempt to provide one when it is missing. This next sample tests that and intentionally has no leading or trailing newline inside the program.

+ + print("Hello world") +

If you are discussing algorithms in the abstract (or even concretely), you can set them off like a theorem, with a number, a title and a target for cross-references. Sometimes you claim an algorithm produces something in particular, or has certain properties, such as a theoretical run time, so a proof may be included. See the discussion just preceding about (limited) options for pseudo-code.