build_a_blog: fix duped output

This commit is contained in:
Collin Lefeber 2024-06-19 16:24:04 -04:00
parent 906a5e04ea
commit 4b39494e82
2 changed files with 10 additions and 10 deletions

View file

@ -38,7 +38,7 @@ def render_post(fpath):
if meta.get('draft'): if meta.get('draft'):
draft = True draft = True
title_out, _ = convert(text) title_out, _ = convert('# ' + title)
out = title_out + out out = title_out + out
logging.info("writing to %s", destpath) logging.info("writing to %s", destpath)

View file

@ -812,7 +812,7 @@ So here is the diff to make that happen:
```diff ```diff
diff --git a/main.py b/main.py diff --git a/main.py b/main.py
index 52ce57b..a3d92d1 100644 index 52ce57b..2ea80cb 100644
--- a/main.py --- a/main.py
+++ b/main.py +++ b/main.py
@@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
@ -860,7 +860,7 @@ index 52ce57b..a3d92d1 100644
draft = True draft = True
- out = convert('# ' + title) + out - out = convert('# ' + title) + out
+ title_out, _ = convert(text) + title_out, _ = convert('# ' + title)
+ out = title_out + out + out = title_out + out
logging.info("writing to %s", destpath) logging.info("writing to %s", destpath)
@ -905,9 +905,9 @@ INFO: removing old __bench files
INFO: number of *.md files 102 INFO: number of *.md files 102
INFO: number of *.html files 2 INFO: number of *.html files 2
INFO: running INFO: running
real 0.45 real 0.31
user 4.21 user 2.44
sys 0.32 sys 0.28
INFO: number of *.html files 102 INFO: number of *.html files 102
INFO: cleanup __bench files INFO: cleanup __bench files
@ -916,14 +916,14 @@ INFO: removing old __bench files
INFO: number of *.md files 1002 INFO: number of *.md files 1002
INFO: number of *.html files 2 INFO: number of *.html files 2
INFO: running INFO: running
real 2.52 real 1.34
user 35.69 user 18.09
sys 0.96 sys 0.47
INFO: number of *.html files 1002 INFO: number of *.html files 1002
INFO: cleanup __bench files INFO: cleanup __bench files
``` ```
So that's down to 2.5s for 1000 posts. Not a bad start! So that's down to ~1.5s for 1000 posts. Not a bad start!
[1]: https://crystal-lang.org/ [1]: https://crystal-lang.org/
[2]: https://github.com/crystal-lang/crystal/releases/tag/0.31.0 [2]: https://github.com/crystal-lang/crystal/releases/tag/0.31.0