Skip to content

Commit 0ff9685

Browse files
committed
auto add date
1 parent 4eca325 commit 0ff9685

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

.github/workflows/publish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: quarto-dev/quarto-actions/setup@v2
1818
- run:
19+
python auto_add_date.py posts/*.ipynb
1920
quarto render
2021
- uses: actions/upload-pages-artifact@v3
2122
with:

auto_add_date.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sys
2+
import nbformat
3+
import subprocess as subp
4+
5+
for fn in sys.argv[1:]:
6+
with open(fn) as f:
7+
nb = nbformat.read(f, as_version=4)
8+
9+
r = subp.run(
10+
["git", "log", "--follow", "--format=%ad", "--date=short", fn], stdout=subp.PIPE
11+
)
12+
dates = [x for x in r.stdout.decode().split("\n") if x]
13+
date = dates[-1]
14+
15+
if nb.cells and nb.cells[0].cell_type != "raw":
16+
front_matter = f"""
17+
---
18+
date: {date}
19+
---
20+
"""
21+
print(f"adding frontmatter to {fn}\n{front_matter}")
22+
23+
nb.cells = [nbformat.v4.new_raw_cell(front_matter)] + nb.cells
24+
25+
with open(fn, "w") as f:
26+
nbformat.write(nb, f)

index.qmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ listing:
44
sort: "date desc"
55
type: default
66
categories: false
7-
sort-ui: false
8-
filter-ui: false
7+
sort-ui: true
8+
filter-ui: true
99
page-layout: full
1010
title-block-banner: true
1111
---

posts/exceptions.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
date : 2020-04-05
3+
---
4+
15
# C++ exceptions in high-performance code
26

37
Here is a collection of advice on using exceptions in high-performance libraries. There has been a lot of discussion in the Boost community about exceptions lately, since [some people want to](http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0709r0.pdf) [improve error reporting in C++](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1095r0.pdf), which led to the development of [Boost.Outcome](https://www.boost.org/doc/libs/1_72_0/libs/outcome/doc/html/index.html) and similar libraries. Here we deal with classic C++ exceptions.

0 commit comments

Comments
 (0)