Skip to content

Commit

Permalink
v0.6.7 Issue 24 line breaks without backslashes
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPacker committed Dec 17, 2023
1 parent f63dfb0 commit 746ed90
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 17 deletions.
6 changes: 5 additions & 1 deletion changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,11 @@
.highlight .il{color:#009999}
.highlight .gc{color:#999;background-color:#EAF2F5}
</style><title>changelog</title></head><body><article class="markdown-body"><h1 id="this-is-the-change-log-for-mdpre-markdown-preprocessor">This Is The Change Log For mdpre Markdown Preprocessor<a class="headerlink" href="#this-is-the-change-log-for-mdpre-markdown-preprocessor" title="Permanent link"></a></h1>
<h3 id="releases">Releases<a class="headerlink" href="#releases" title="Permanent link"></a></h3>
<p>=toc 2 2 Releases</p>
<h3 id="v067-17-december-2023">v0.6.7 - 17 December, 2023<a class="headerlink" href="#v067-17-december-2023" title="Permanent link"></a></h3>
<ul>
<li><strong>ENHANCED</strong> Any line beginning with <code>&lt;br/&gt;</code> is concatenated to the previous line.</li>
</ul>
<h3 id="v066-30-november-2023">v0.6.6 - 30 November, 2023<a class="headerlink" href="#v066-30-november-2023" title="Permanent link"></a></h3>
<ul>
<li><strong>FIXED</strong> <code>=cal</code> was not rendering empty calendar cells properly. Now uses <code>&amp;nbsp;</code>.</li>
Expand Down
11 changes: 6 additions & 5 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

mdpre Markdown Preprocessor v0.6.6 (30 November, 2023)
mdpre Markdown Preprocessor v0.6.7 (17 December, 2023)
======================================================
- opened <stdout> for writing
Def mdpre_date = 30 November, 2023
Def mdpre_level = 0.6.6
Def mdpre_date = 17 December, 2023
Def mdpre_level = 0.6.7
Def userid = martinpacker
Def time = 16&colon;32
Def date = 30 November&comma; 2023
Def time = 13&colon;51
Def date = 17 December&comma; 2023
This Is The Change Log For mdpre Markdown Preprocessor
Table Of Contents - spec '2 2 Releases'
2 2 Releases
..... ..... v0.6.7 - 17 December, 2023
..... ..... v0.6.6 - 30 November, 2023
..... ..... v0.6.5 - 17 February, 2023
..... ..... v0.6.4 - 16 May, 2022
Expand Down
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# This Is The Change Log For mdpre Markdown Preprocessor

### Releases
=toc 2 2 Releases


### v0.6.7 - 17 December, 2023

* **ENHANCED** Any line beginning with `<br/>` is concatenated to the previous line.

### v0.6.6 - 30 November, 2023

Expand Down
4 changes: 4 additions & 0 deletions changelog.mdp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
=toc 2 2 Releases


### v0.6.7 - 17 December, 2023

* **ENHANCED** Any line beginning with `<br/>` is concatenated to the previous line.

### v0.6.6 - 30 November, 2023

* **FIXED** `=cal` was not rendering empty calendar cells properly. Now uses `&nbsp;`.
Expand Down
17 changes: 14 additions & 3 deletions mdpre
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ from enum import Enum
import calendar


mdpre_level = "0.6.6"
mdpre_date = "30 November, 2023"
mdpre_level = "0.6.7"
mdpre_date = "17 December, 2023"
banner = "mdpre Markdown Preprocessor v" + mdpre_level + " (" + mdpre_date + ")"

log = partial(print, file=sys.stderr) # | create log to stderr
Expand Down Expand Up @@ -970,14 +970,25 @@ def handle_linejoins(input_file):
input_file2 = []
output_line = ""
pending = False
line_count = len(input_file)

for line in input_file:
for line_number, line in enumerate(input_file):
output_line += line

if line_number < line_count - 1:
next_line = input_file[line_number + 1]
else:
next_line = ""

if line.endswith("\\\n"):
# Next line should be concatenated to this one
output_line = output_line[:-2]
pending = True

elif next_line.startswith("<br/>"):
output_line = output_line[:-1]
pending = True

else:
# Next line shouldn't be concatenated to this one
input_file2.append(output_line)
Expand Down
3 changes: 2 additions & 1 deletion user-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@
<h1 id="markdown-preprocessor-user-guide">Markdown Preprocessor User Guide<a class="headerlink" href="#markdown-preprocessor-user-guide" title="Permanent link"></a></h1>
<p>This document describes the mdpre Markdown preprocessor.</p>
<p>In this document we&rsquo;ll refer to it as &ldquo;mdpre&rdquo;, pronounced &ldquo;em dee pree&rdquo;.</p>
<p>This document was converted to HTML at 16&colon;33 on 30 November&comma; 2023.</p>
<p>This document was converted to HTML at 14&colon;26 on 17 December&comma; 2023.</p>
<h3 id="table-of-contents">Table Of Contents<a class="headerlink" href="#table-of-contents" title="Permanent link"></a></h3>
<ul>
<li><a href="#why-a-preprocessor">Why A Preprocessor?</a></li>
Expand Down Expand Up @@ -1748,6 +1748,7 @@ <h3 id="concatenating-lines-with">Concatenating Lines With <code>\</code><a clas
Indeed this paragraph was written that way.
</code></pre>
<p>Terminating a line with a <code>\</code> does not cause a space to be inserted between the two lines of text. In the above example a space was coded before the <code>\</code> each time it was used.</p>
<p>You might want to cause vertical spacing with <code>&lt;br/&gt;</code>. Just above it might be a bulleted list, say. If you are adding items to the list you probably don&rsquo;t want to add a <code>\</code> to the last item in the list - because you might add other items after it. If you code a line starting with <code>&lt;br/&gt;</code> it will be concatenated to the previous line, whether that previous line ended with a <code>\</code> or not. You can, of course, code multiple <code>&lt;br/&gt;</code>s on the same line.</p>
<h3 id="generating-a-table-of-contents-with-toc">Generating A Table Of Contents With <code>=toc</code><a class="headerlink" href="#generating-a-table-of-contents-with-toc" title="Permanent link"></a></h3>
<p>You can generate a Table Of Contents with <code>=toc</code>. At its simplest you can simply code</p>
<pre><code>=toc
Expand Down
10 changes: 5 additions & 5 deletions user-guide.log
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

mdpre Markdown Preprocessor v0.6.6 (30 November, 2023)
mdpre Markdown Preprocessor v0.6.7 (17 December, 2023)
======================================================
- opened <stdout> for writing
Def mdpre_date = 30 November, 2023
Def mdpre_level = 0.6.6
Def mdpre_date = 17 December, 2023
Def mdpre_level = 0.6.7
Def userid = martinpacker
Def time = 16&colon;33
Def date = 30 November&comma; 2023
Def time = 14&colon;26
Def date = 17 December&comma; 2023
Def TOC = Table Of Contents
Markdown Preprocessor User Guide
Table Of Contents - spec '2 * Table Of Contents'
Expand Down
4 changes: 3 additions & 1 deletion user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ This document describes the mdpre Markdown preprocessor.

In this document we'll refer to it as "mdpre", pronounced "em dee pree".

This document was converted to HTML at 16&colon;33 on 30 November&comma; 2023.
This document was converted to HTML at 14&colon;26 on 17 December&comma; 2023.

### Table Of Contents

Expand Down Expand Up @@ -639,6 +639,8 @@ If you terminate a line with a `\` (backslash) character the following line will

Terminating a line with a `\` does not cause a space to be inserted between the two lines of text. In the above example a space was coded before the `\` each time it was used.

You might want to cause vertical spacing with `<br/>`. Just above it might be a bulleted list, say. If you are adding items to the list you probably don't want to add a `\` to the last item in the list - because you might add other items after it. If you code a line starting with `<br/>` it will be concatenated to the previous line, whether that previous line ended with a `\` or not. You can, of course, code multiple `<br/>`s on the same line.

### Generating A Table Of Contents With `=toc`

You can generate a Table Of Contents with `=toc`. At its simplest you can simply code
Expand Down
5 changes: 5 additions & 0 deletions user-guide.mdp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,11 @@ If you terminate a line with a `\` (backslash) character the following line will
Terminating a line with a `\` does not cause a space to be inserted between the two lines of text. \
In the above example a space was coded before the `\` each time it was used.

You might want to cause vertical spacing with `<br/>`. Just above it might be a bulleted list, say. \
If you are adding items to the list you probably don't want to add a `\` to the last item in the list - because you might add other items after it. \
If you code a line starting with `<br/>` it will be concatenated to the previous line, whether that previous line ended with a `\` or not. \
You can, of course, code multiple `<br/>`s on the same line.

### Generating A &TOC; With `=toc`

You can generate a &TOC; with `=toc`. \
Expand Down

0 comments on commit 746ed90

Please sign in to comment.