From e754dd3f96762c2d4c692dba04533c7360fc51fd Mon Sep 17 00:00:00 2001 From: MartinPacker Date: Fri, 17 Feb 2023 16:01:05 +0000 Subject: [PATCH] v0.6.5 =ifdef fix --- changelog.html | 1173 ++++-------------------------------------------- changelog.log | 33 +- changelog.md | 5 + changelog.mdp | 5 + mdpre | 17 +- 5 files changed, 104 insertions(+), 1129 deletions(-) diff --git a/changelog.html b/changelog.html index 6ec512e..57f456e 100644 --- a/changelog.html +++ b/changelog.html @@ -1,1154 +1,133 @@ -changelog

This Is The Change Log For mdpre Markdown Preprocessor

-

Releases

-

v0.6.4 - 16 May, 2022

-

v0.6.3 - 5 May, 2022

+ +

v0.6.3 - 5 May, 2022

+ -

v0.6.2 - 19 March, 2022

+ +

v0.6.2 - 19 March, 2022

+ -

v0.6.1 - 17 March, 2022

+ +

v0.6.1 - 17 March, 2022

+ -

v0.6 - 16 March, 2022

+ +

v0.6 - 16 March, 2022

+ -

v0.5 - 27 November, 2021

+ +

v0.5 - 27 November, 2021

+ -

v0.4.7 - 21 November, 2021

+ +

v0.4.7 - 21 November, 2021

+ -

v0.4.6 - 19 October, 2020

+ +

v0.4.6 - 19 October, 2020

+ -

v0.4.5 - 14 October, 2020

+ +

v0.4.5 - 14 October, 2020

+ -

v0.4.4 - 7 January, 2020

-

v0.4.3 - 10 March, 2019

+ +

v0.4.4 - 7 January, 2020

+ +

v0.4.3 - 10 March, 2019

+ -

v0.4.2 - 20 January, 2019

+ +

v0.4.2 - 20 January, 2019

+ -

v0.4.1 - 12 January, 2019

+ +

v0.4.1 - 12 January, 2019

+ -

v0.4 - 21 October, 2018

+ +

v0.4 - 21 October, 2018

+ -

v0.3 - 1 April, 2018

+ +

v0.3 - 1 April, 2018

+ -

v0.2 - 26 March, 2018

+ +

v0.2 - 26 March, 2018

+ -

v0.1 - 17 March, 2018

+ +

v0.1 - 17 March, 2018

+ -

v0.0 - 12 March, 2018

+ +

v0.0 - 12 March, 2018

+
\ No newline at end of file + + + + \ No newline at end of file diff --git a/changelog.log b/changelog.log index 66a7005..64b8e96 100644 --- a/changelog.log +++ b/changelog.log @@ -1,34 +1,9 @@ -mdpre Markdown Preprocessor v0.6.4 (16 May, 2022) -================================================= +mdpre Markdown Preprocessor v0.6.5 (17 February, 2023) +====================================================== - opened for writing -Def mdpre_date = 16 May, 2022 -Def mdpre_level = 0.6.4 -Def userid = martinpacker -Def time = 16:39 -Def date = 16 May, 2022 -This Is The Change Log For mdpre Markdown Preprocessor -Table Of Contents - spec '2 2 Releases' 2 2 Releases -..... ..... v0.6.4 - 16 May, 2022 -..... ..... v0.6.3 - 5 May, 2022 -..... ..... v0.6.2 - 19 March, 2022 -..... ..... v0.6.1 - 17 March, 2022 -..... ..... v0.6 - 16 March, 2022 -..... ..... v0.5 - 27 November, 2021 -..... ..... v0.4.7 - 21 November, 2021 -..... ..... v0.4.6 - 19 October, 2020 -..... ..... v0.4.5 - 14 October, 2020 -..... ..... v0.4.4 - 7 January, 2020 -..... ..... v0.4.3 - 10 March, 2019 -..... ..... v0.4.2 - 20 January, 2019 -..... ..... v0.4.1 - 12 January, 2019 -..... ..... v0.4 - 21 October, 2018 -..... ..... v0.3 - 1 April, 2018 -..... ..... v0.2 - 26 March, 2018 -..... ..... v0.1 - 17 March, 2018 -..... ..... v0.0 - 12 March, 2018 -------------------------------------------------- +------------------------------------------------------ - Processing completed. -------------------------------------------------- +------------------------------------------------------ diff --git a/changelog.md b/changelog.md index 0a31aef..ae69958 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,11 @@ ### Releases +### v0.6.5 - 17 February, 2023 + +* **FIXED** Crash with `=ifdef` where the variable **isn't** defined. +* **ENHANCED** Added message if there are too few `=endif`s at the end of the run. + ### v0.6.4 - 16 May, 2022 * **FIXED** `=cal` needed 7 cells for all rows. diff --git a/changelog.mdp b/changelog.mdp index 0d0b135..624574f 100644 --- a/changelog.mdp +++ b/changelog.mdp @@ -2,6 +2,11 @@ =toc 2 2 Releases +### v0.6.5 - 17 February, 2023 + +* **FIXED** Crash with `=ifdef` where the variable **isn't** defined. +* **ENHANCED** Added message if there are too few `=endif`s at the end of the run. + ### v0.6.4 - 16 May, 2022 * **FIXED** `=cal` needed 7 cells for all rows. diff --git a/mdpre b/mdpre index 27f29bb..81b42f0 100755 --- a/mdpre +++ b/mdpre @@ -33,8 +33,8 @@ from enum import Enum import calendar -mdpre_level = "0.6.4+" -mdpre_date = "20 June, 2022" +mdpre_level = "0.6.5" +mdpre_date = "17 February, 2023" banner = "mdpre Markdown Preprocessor v" + mdpre_level + " (" + mdpre_date + ")" log = partial(print, file=sys.stderr) # | create log to stderr @@ -513,7 +513,7 @@ def handle_ifdef(ifdefString): if wantVerbose is True: verbosity = "" - return [ifStack, verbosity] + return verbosity # =ifndef encountered @@ -532,6 +532,7 @@ def handle_ifndef(ifndefString): return verbosity # Variable is undefined + ifStack.append(True) if wantVerbose is True: verbosity = "" @@ -965,8 +966,10 @@ def handle_linejoins(input_file): input_file2 = [] output_line = "" pending = False + for line in input_file: output_line += line + if line.endswith("\\\n"): # Next line should be concatenated to this one output_line = output_line[:-2] @@ -1539,6 +1542,14 @@ for line in input_file: # NOTE: toFile.close() is handled in the new exits function # NOTE: ! this message will self destruct during the pull request +# Issue a warning if 1 or more =endif statements are missing +if (l := len(ifStack)) > 1: + if l == 2: + sys.stderr.write(f'Warning 1 =endif statement missing.') + else: + sys.stderr.write(f'Warning {str(l - 1)} =endif statements missing.') + +# Optionally zip into TextPack format if wantTextPack is True: if wantVerbose is True: print("Archiving " + realpath + " to " + zippath + ".zip")