Skip to content

Commit

Permalink
v0.6.4 Fix to =cal
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPacker committed May 16, 2022
1 parent 88ecb7b commit 0afd4cd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
4 changes: 4 additions & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,10 @@
.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>
<h3 id="v064-16-may-2022">v0.6.4 - 16 May, 2022<a class="headerlink" href="#v064-16-may-2022" title="Permanent link"></a></h3>
<ul>
<li><strong>FIXED</strong> <code>=cal</code> needed 7 cells for all rows.</li>
</ul>
<h3 id="v063-5-may-2022">v0.6.3 - 5 May, 2022<a class="headerlink" href="#v063-5-may-2022" title="Permanent link"></a></h3>
<ul>
<li><strong>ENHANCED</strong> Added <code>=rowspan</code> - to allow easy colouring of text of table rows in a <code>=csv</code> / <code>=endcsv</code> bracket.</li>
Expand Down
17 changes: 9 additions & 8 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

mdpre Markdown Preprocessor v0.6.3 (5 May, 2022)
================================================
mdpre Markdown Preprocessor v0.6.4 (16 May, 2022)
=================================================
- opened <stdout> for writing
Def mdpre_date = 5 May, 2022
Def mdpre_level = 0.6.3
Def mdpre_date = 16 May, 2022
Def mdpre_level = 0.6.4
Def userid = martinpacker
Def time = 19&colon;59
Def date = 5 May&comma; 2022
Def time = 16&colon;39
Def date = 16 May&comma; 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
Expand All @@ -27,7 +28,7 @@ Table Of Contents - spec '2 2 Releases'
..... ..... v0.2 - 26 March, 2018
..... ..... v0.1 - 17 March, 2018
..... ..... v0.0 - 12 March, 2018
------------------------------------------------
-------------------------------------------------
- Processing completed.
------------------------------------------------
-------------------------------------------------

4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
### Releases


### v0.6.4 - 16 May, 2022

* **FIXED** `=cal` needed 7 cells for all rows.

### v0.6.3 - 5 May, 2022

* **ENHANCED** Added `=rowspan` - to allow easy colouring of text of table rows in a `=csv` / `=endcsv` bracket.
Expand Down
4 changes: 4 additions & 0 deletions changelog.mdp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

=toc 2 2 Releases

### v0.6.4 - 16 May, 2022

* **FIXED** `=cal` needed 7 cells for all rows.

### v0.6.3 - 5 May, 2022

* **ENHANCED** Added `=rowspan` - to allow easy colouring of text of table rows in a `=csv` / `=endcsv` bracket.
Expand Down
22 changes: 13 additions & 9 deletions mdpre
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ from enum import Enum
import calendar


mdpre_level = "0.6.3"
mdpre_date = "5 May, 2022"
mdpre_level = "0.6.4"
mdpre_date = "16 May, 2022"
banner = "mdpre Markdown Preprocessor v" + mdpre_level + " (" + mdpre_date + ")"

log = partial(print, file=sys.stderr) # | create log to stderr
Expand Down Expand Up @@ -172,22 +172,26 @@ class Output(object):
# Get a calendar month in a 2-dimensional array
cal_year, cal_month, cal_cellHeight = cal_date
c = calendar.TextCalendar(calendar.MONDAY)
daysAndNumbers = c.formatmonth(cal_year, cal_month).split("\n")[1:]
daysAndNumbers = c.formatmonth(cal_year, cal_month).split("\n")[1: -1]


# Process the rows into day names and actual day numbers
weeks = []
for row in range(len(daysAndNumbers) - 1):
rawCells = [
daysAndNumbers[row][i : i + 3].lstrip().rstrip()
for i in range(0, len(daysAndNumbers[row]), 3)
]
if row == 0:

for rowNumber, row in enumerate(daysAndNumbers):
rawCells = []
row = row.ljust(21)
for d in range(7):
rawCells.append(str(row[d * 3 : d * 3 +3]).lstrip().rstrip())

if rowNumber == 0:
dayNames = rawCells
else:
weeks.append(rawCells)

# Write month line
self.write("|" + monthNames[cal_month - 1] + " " + str(cal_year) + "|||||||")

# Write the table heading
self.write(("|:-:") * 7 + "|")

Expand Down

0 comments on commit 0afd4cd

Please sign in to comment.