Skip to content

Commit

Permalink
Minor bug in Markdown to HTML rendering fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Apr 4, 2024
1 parent e9dc676 commit 0854be5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Inweb 7.2.1

[Version](notes/versioning.md): 7.2.1-beta+1B60 'Escape to Danger' (14 March 2024)
[Version](notes/versioning.md): 7.2.1-beta+1B61 'Escape to Danger' (4 April 2024)

## About Inweb

Expand Down
4 changes: 2 additions & 2 deletions build.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Prerelease: beta
Build Date: 14 March 2024
Build Number: 1B60
Build Date: 4 April 2024
Build Number: 1B61
25 changes: 15 additions & 10 deletions docs/foundation-module/5-im.html
Original file line number Diff line number Diff line change
Expand Up @@ -1084,19 +1084,24 @@ <h1><a href="../index.html">
<span class="plain-syntax"> </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"blockquote"</span><span class="plain-syntax">, </span><span class="string-syntax">"class=\"extract-inform7\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">GENERAL_POINTER_IS_NULL</span><span class="plain-syntax">(</span><span class="identifier-syntax">md</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">user_state</span><span class="plain-syntax">) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">markdown_item</span><span class="plain-syntax"> *</span><span class="identifier-syntax">first</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_markdown_item</span><span class="plain-syntax">(</span><span class="identifier-syntax">md</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">user_state</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">markdown_item</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">md</span><span class="plain-syntax">; </span><span class="identifier-syntax">ch</span><span class="plain-syntax">; </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type</span><span class="plain-syntax"> == </span><span class="constant-syntax">CODE_BLOCK_MIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">GENERAL_POINTER_IS_NULL</span><span class="plain-syntax">(</span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">user_state</span><span class="plain-syntax">) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">markdown_item</span><span class="plain-syntax"> *</span><span class="identifier-syntax">latest</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_markdown_item</span><span class="plain-syntax">(</span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">user_state</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first</span><span class="plain-syntax"> == </span><span class="identifier-syntax">latest</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">, </span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stashed</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first</span><span class="plain-syntax"> == </span><span class="identifier-syntax">md</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">markdown_item</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">first</span><span class="plain-syntax">; </span><span class="identifier-syntax">ch</span><span class="plain-syntax">; </span><span class="identifier-syntax">ch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">type</span><span class="plain-syntax"> == </span><span class="constant-syntax">CODE_BLOCK_MIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">GENERAL_POINTER_IS_NULL</span><span class="plain-syntax">(</span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">user_state</span><span class="plain-syntax">) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">markdown_item</span><span class="plain-syntax"> *</span><span class="identifier-syntax">latest</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_markdown_item</span><span class="plain-syntax">(</span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">user_state</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first</span><span class="plain-syntax"> == </span><span class="identifier-syntax">latest</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ch</span><span class="plain-syntax"> != </span><span class="identifier-syntax">first</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">, </span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">, </span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ch</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stashed</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">HTML_MODULE</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">PasteButtons::paste_text_new_style</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">HTML_MODULE</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">PasteButtons::paste_text_new_style</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">accumulated</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">colouring</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">programming_language</span><span class="plain-syntax"> *</span><span class="identifier-syntax">default_language</span><span class="plain-syntax"> = </span><a href="9-pl.html#SP2" class="function-link"><span class="function-syntax">Languages::find_by_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">);</span>
Expand Down
Binary file modified docs/goldbach/goldbach.pdf
Binary file not shown.
25 changes: 15 additions & 10 deletions foundation-module/Chapter 5/Inform-Flavoured Markdown.w
Original file line number Diff line number Diff line change
Expand Up @@ -940,19 +940,24 @@ use "transcript" instead.
HTML_OPEN_WITH("blockquote", "class=\"extract-inform7\"");
if (GENERAL_POINTER_IS_NULL(md->user_state) == FALSE) {
markdown_item *first = RETRIEVE_POINTER_markdown_item(md->user_state);
TEMPORARY_TEXT(accumulated)
for (markdown_item *ch = md; ch; ch = ch->next) {
if (ch->type == CODE_BLOCK_MIT) {
if (GENERAL_POINTER_IS_NULL(ch->user_state) == FALSE) {
markdown_item *latest = RETRIEVE_POINTER_markdown_item(ch->user_state);
if (first == latest) WRITE_TO(accumulated, "%S", ch->stashed);
if (first == md) {
TEMPORARY_TEXT(accumulated)
for (markdown_item *ch = first; ch; ch = ch->next) {
if (ch->type == CODE_BLOCK_MIT) {
if (GENERAL_POINTER_IS_NULL(ch->user_state) == FALSE) {
markdown_item *latest = RETRIEVE_POINTER_markdown_item(ch->user_state);
if (first == latest) {
if (ch != first) WRITE_TO(accumulated, "\n");
WRITE_TO(accumulated, "%S", ch->stashed);
}
}
}
}
#ifdef HTML_MODULE
PasteButtons::paste_text_new_style(OUT, accumulated);
#endif
DISCARD_TEXT(accumulated)
}
#ifdef HTML_MODULE
PasteButtons::paste_text_new_style(OUT, accumulated);
#endif
DISCARD_TEXT(accumulated)
}
TEMPORARY_TEXT(colouring)
programming_language *default_language = Languages::find_by_name(I"Inform", NULL, FALSE);
Expand Down

0 comments on commit 0854be5

Please sign in to comment.