summaryrefslogtreecommitdiff
path: root/templates/macros.html
diff options
context:
space:
mode:
authoreatradish <[email protected]>2022-04-09 19:34:05 +0800
committereatradish <[email protected]>2022-04-09 19:34:05 +0800
commit4165b2c0d86d1e3f47a7caf9a086798e51315f3b (patch)
tree095511e33c1eeab5a7888f73a41e06de1155478f /templates/macros.html
downloadSeje2-4165b2c0d86d1e3f47a7caf9a086798e51315f3b.tar.gz
Seje2-4165b2c0d86d1e3f47a7caf9a086798e51315f3b.tar.bz2
Seje2-4165b2c0d86d1e3f47a7caf9a086798e51315f3b.zip
init
Diffstat (limited to 'templates/macros.html')
-rw-r--r--templates/macros.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/templates/macros.html b/templates/macros.html
new file mode 100644
index 0000000..7379b1b
--- /dev/null
+++ b/templates/macros.html
@@ -0,0 +1,16 @@
+{% macro format_chinese_date(year, month, day) %}
+{% set lut1 = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"] %}
+{% set lut2 = [
+ '一', '二', '三', '四',
+ '五', '六', '七', '八',
+ '九', '十', '十一', '十二',
+ '十三', '十四', '十五', '十六',
+ '十七', '十八', '十九', '二十',
+ '廿一', '廿二', '廿三', '廿四',
+ '廿五', '廿六', '廿七', '廿八',
+ '廿九', '三十', '三十一'] %}
+{% for c in year | as_str %}
+ {{ lut1 | nth(n=c | int) }}
+{% endfor %}
+年{{ lut2 | nth(n=month-1)}}月{{ lut2 | nth(n=day-1) }}日
+{% endmacro %}