📝 New template functions ISOYear, ISOMonth and ISOWeekDate https://github.com/siyuan-note/siyuan/issues/15679

This commit is contained in:
Daniel 2025-08-28 15:54:31 +08:00
parent 0f087bf1e4
commit 810ea23bfd
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 682 additions and 34 deletions

View file

@ -6,7 +6,7 @@
"id": "20201204184532-3qm9l8n", "id": "20201204184532-3qm9l8n",
"title": "Template snippet", "title": "Template snippet",
"type": "doc", "type": "doc",
"updated": "20250801152837" "updated": "20250828155251"
}, },
"Children": [ "Children": [
{ {
@ -57,7 +57,7 @@
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20210104091444-jy56z0p", "id": "20210104091444-jy56z0p",
"updated": "20250801152821" "updated": "20250828155251"
}, },
"Children": [ "Children": [
{ {
@ -215,7 +215,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20210104091444-mwbvc9m", "id": "20210104091444-mwbvc9m",
"updated": "20250801152821" "updated": "20250828155251"
}, },
"Children": [ "Children": [
{ {
@ -1190,7 +1190,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20240308162632-akk8sxn", "id": "20240308162632-akk8sxn",
"updated": "20240308162632" "updated": "20250828155241"
}, },
"Children": [ "Children": [
{ {
@ -1204,7 +1204,136 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": This function is used to return the week" "Data": ": This function returns the current week"
}
]
}
]
},
{
"ID": "20250828155216-zn0i9zg",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828155216-zn0i9zg",
"updated": "20250828155216"
},
"Children": [
{
"ID": "20250828155216-p5tgk3f",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828155216-p5tgk3f",
"updated": "20250828155232"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOMonth"
},
{
"Type": "NodeText",
"Data": ": This function returns the current month"
}
]
}
]
},
{
"ID": "20250828155242-k9x8rc7",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828155242-k9x8rc7",
"updated": "20250828155242"
},
"Children": [
{
"ID": "20250828155242-zwalrdw",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828155242-zwalrdw",
"updated": "20250828155246"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOYear"
},
{
"Type": "NodeText",
"Data": ": This function returns the current year"
}
]
}
]
},
{
"ID": "20250828155247-992wou3",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828155247-992wou3",
"updated": "20250828155251"
},
"Children": [
{
"ID": "20250828155247-ow57gpr",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828155247-ow57gpr",
"updated": "20250828155251"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeekDate"
},
{
"Type": "NodeText",
"Data": ": This function returns the date of a specified day of the week using "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "time.Time"
},
{
"Type": "NodeText",
"Data": ". For example, "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ now | ISOWeekDate 4 | date \"2006-01-02\" }"
},
{
"Type": "NodeText",
"Data": " returns the date of this Thursday"
} }
] ]
} }

View file

@ -6,7 +6,7 @@
"id": "20201204181006-7bkppue", "id": "20201204181006-7bkppue",
"title": "模板片段", "title": "模板片段",
"type": "doc", "type": "doc",
"updated": "20250801152724" "updated": "20250828154937"
}, },
"Children": [ "Children": [
{ {
@ -69,7 +69,7 @@
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20210104091309-fhb549c", "id": "20210104091309-fhb549c",
"updated": "20250801152510" "updated": "20250828154937"
}, },
"Children": [ "Children": [
{ {
@ -237,7 +237,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20210104091309-gjkg3u5", "id": "20210104091309-gjkg3u5",
"updated": "20250801152510" "updated": "20250828154937"
}, },
"Children": [ "Children": [
{ {
@ -271,7 +271,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该变量用于插入当前文档名。比如模板内容为 " "Data": "​:该变量用于插入当前文档名。比如"
},
{
"Type": "NodeText",
"Data": "模板"
},
{
"Type": "NodeText",
"Data": "内容为 "
}, },
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
@ -391,7 +399,11 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该变量用于插入当前文档别名" "Data": "​:该变量用于插入当前"
},
{
"Type": "NodeText",
"Data": "文档别名"
} }
] ]
} }
@ -465,7 +477,19 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于查询数据库,返回值为 blocks 列表" "Data": "​:该函数用于查询"
},
{
"Type": "NodeText",
"Data": "数据库"
},
{
"Type": "NodeText",
"Data": ",返回值为 blocks "
},
{
"Type": "NodeText",
"Data": "列表"
} }
] ]
}, },
@ -530,7 +554,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于根据块 ID 查询数据库,返回值为 block" "Data": "​:该函数用于根据块 ID 查询"
},
{
"Type": "NodeText",
"Data": "数据库"
},
{
"Type": "NodeText",
"Data": ",返回值为 block"
} }
] ]
}, },
@ -594,7 +626,19 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于查询数据库,返回值为 spans 列表" "Data": "​:该函数用于查询"
},
{
"Type": "NodeText",
"Data": "数据库"
},
{
"Type": "NodeText",
"Data": ",返回值为 spans "
},
{
"Type": "NodeText",
"Data": "列表"
} }
] ]
}, },
@ -659,7 +703,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于查询数据库,返回值为结果集" "Data": "​:该函数用于查询"
},
{
"Type": "NodeText",
"Data": "数据库"
},
{
"Type": "NodeText",
"Data": ",返回值为结果集"
} }
] ]
}, },
@ -1204,7 +1256,7 @@
}, },
"Properties": { "Properties": {
"id": "20240308162139-yt96e2z", "id": "20240308162139-yt96e2z",
"updated": "20240308162139" "updated": "20250828154937"
}, },
"Children": [ "Children": [
{ {
@ -1212,7 +1264,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20240308162139-x4evb04", "id": "20240308162139-x4evb04",
"updated": "20240308162153" "updated": "20250828154937"
}, },
"Children": [ "Children": [
{ {
@ -1226,7 +1278,136 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:该函数用于返回第几周" "Data": "​:该函数用于返回当前周"
}
]
}
]
},
{
"ID": "20250828154237-r8vhx3a",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828154237-r8vhx3a",
"updated": "20250828154248"
},
"Children": [
{
"ID": "20250828154237-2kgeyrr",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828154237-2kgeyrr",
"updated": "20250828154248"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOMonth"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回当前月份"
}
]
}
]
},
{
"ID": "20250828154157-thdko4b",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828154157-thdko4b",
"updated": "20250828154157"
},
"Children": [
{
"ID": "20250828154157-s8wsy4j",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828154157-s8wsy4j",
"updated": "20250828154231"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOYear"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回当前年份"
}
]
}
]
},
{
"ID": "20250828154232-7ryi07m",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828154232-7ryi07m",
"updated": "20250828154731"
},
"Children": [
{
"ID": "20250828154232-97gwy4i",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828154232-97gwy4i",
"updated": "20250828154731"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeekDate"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回指定周几的日期 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "time.Time"
},
{
"Type": "NodeText",
"Data": "​,例如返回本周四的日期 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ now | ISOWeekDate 4 | date \"2006-01-02\" }"
},
{
"Type": "NodeText",
"Data": ""
} }
] ]
} }

View file

@ -6,7 +6,7 @@
"id": "20211226123004-dplpw0o", "id": "20211226123004-dplpw0o",
"title": "範本片段", "title": "範本片段",
"type": "doc", "type": "doc",
"updated": "20250801152721" "updated": "20250828155154"
}, },
"Children": [ "Children": [
{ {
@ -53,7 +53,7 @@
"HeadingLevel": 2, "HeadingLevel": 2,
"Properties": { "Properties": {
"id": "20211226123024-eyagqur", "id": "20211226123024-eyagqur",
"updated": "20250801152602" "updated": "20250828155154"
}, },
"Children": [ "Children": [
{ {
@ -208,7 +208,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20211226123024-pjvw31z", "id": "20211226123024-pjvw31z",
"updated": "20250801152602" "updated": "20250828155154"
}, },
"Children": [ "Children": [
{ {
@ -436,7 +436,19 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:該函數用於查詢資料庫,返回值為 blocks 列表" "Data": "​:該函數用於查詢"
},
{
"Type": "NodeText",
"Data": "資料庫"
},
{
"Type": "NodeText",
"Data": ",返回值為 blocks "
},
{
"Type": "NodeText",
"Data": "列表"
} }
] ]
}, },
@ -501,7 +513,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:函數用於根據塊 ID 查詢資料庫,傳回值為 block" "Data": "​:函數用於根據塊 ID 查詢"
},
{
"Type": "NodeText",
"Data": "資料庫"
},
{
"Type": "NodeText",
"Data": ",傳回值為 block"
} }
] ]
}, },
@ -565,7 +585,19 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:該函數用於查詢資料庫,返回值為 spans 列表" "Data": "​:該函數用於查詢"
},
{
"Type": "NodeText",
"Data": "資料庫"
},
{
"Type": "NodeText",
"Data": ",返回值為 spans "
},
{
"Type": "NodeText",
"Data": "列表"
} }
] ]
}, },
@ -630,7 +662,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:函數用於查詢資料庫,傳回值為結果集" "Data": "​:函數用於查詢"
},
{
"Type": "NodeText",
"Data": "資料庫"
},
{
"Type": "NodeText",
"Data": ",傳回值為結果集"
} }
] ]
}, },
@ -1183,7 +1223,7 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20240308162753-tde2ifs", "id": "20240308162753-tde2ifs",
"updated": "20240308162753" "updated": "20250828154943"
}, },
"Children": [ "Children": [
{ {
@ -1197,7 +1237,136 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": "​:此函數用於傳回第幾週" "Data": "​:此函數用於傳回目前週"
}
]
}
]
},
{
"ID": "20250828154909-wxnydc5",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828154909-wxnydc5",
"updated": "20250828154909"
},
"Children": [
{
"ID": "20250828154909-3grwety",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828154909-3grwety",
"updated": "20250828154910"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOMonth"
},
{
"Type": "NodeText",
"Data": "​:此函數用於傳回目前月份"
}
]
}
]
},
{
"ID": "20250828154911-8n67tvc",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828154911-8n67tvc",
"updated": "20250828154911"
},
"Children": [
{
"ID": "20250828154911-bb7z59o",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828154911-bb7z59o",
"updated": "20250828154916"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOYear"
},
{
"Type": "NodeText",
"Data": "​:此函數用於傳回目前年份"
}
]
}
]
},
{
"ID": "20250828154949-xhbwn4e",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828154949-xhbwn4e",
"updated": "20250828155154"
},
"Children": [
{
"ID": "20250828154949-5lcfpbs",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828154949-5lcfpbs",
"updated": "20250828155154"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeekDate"
},
{
"Type": "NodeText",
"Data": "​:此函數用於傳回指定週幾的日期 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "time.Time"
},
{
"Type": "NodeText",
"Data": "​,例如傳回本週四的日期 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{ now | ISOWeekDate 4 | date \"2006-01-02\" }"
},
{
"Type": "NodeText",
"Data": ""
} }
] ]
} }

View file

@ -7,7 +7,7 @@
"id": "20240530101000-6x9ivi7", "id": "20240530101000-6x9ivi7",
"title": "テンプレートスニペット", "title": "テンプレートスニペット",
"type": "doc", "type": "doc",
"updated": "20250801152939" "updated": "20250828155138"
}, },
"Children": [ "Children": [
{ {
@ -66,7 +66,7 @@
"Properties": { "Properties": {
"ID": "20240530101000-5nvn9ad", "ID": "20240530101000-5nvn9ad",
"id": "20240530101000-pi05yzt", "id": "20240530101000-pi05yzt",
"updated": "20250801152922" "updated": "20250828155138"
}, },
"Children": [ "Children": [
{ {
@ -226,7 +226,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20240530101000-by5hqnb", "id": "20240530101000-by5hqnb",
"updated": "20250801152922" "updated": "20250828155138"
}, },
"Children": [ "Children": [
{ {
@ -260,7 +260,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この変数は現在のドキュメント名を挿入します。たとえば、テンプレートの内容が " "Data": ": この変数は現在のドキュメント名を挿入します。たとえば、"
},
{
"Type": "NodeText",
"Data": "テンプレート"
},
{
"Type": "NodeText",
"Data": "の内容が "
}, },
{ {
"Type": "NodeTextMark", "Type": "NodeTextMark",
@ -454,7 +462,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この関数はデータベースをクエリしてブロックのリストを返します" "Data": ": この関数は"
},
{
"Type": "NodeText",
"Data": "データベース"
},
{
"Type": "NodeText",
"Data": "をクエリしてブロックのリストを返します"
} }
] ]
}, },
@ -519,7 +535,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この関数はブロックIDに基づいてデータベースを照会するために使用され、戻り値はブロックです" "Data": ": この関数はブロックIDに基づいて"
},
{
"Type": "NodeText",
"Data": "データベース"
},
{
"Type": "NodeText",
"Data": "を照会するために使用され、戻り値はブロックです"
} }
] ]
}, },
@ -583,7 +607,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この関数はデータベースをクエリしてスパンのリストを返します" "Data": ": この関数は"
},
{
"Type": "NodeText",
"Data": "データベース"
},
{
"Type": "NodeText",
"Data": "をクエリしてスパンのリストを返します"
} }
] ]
}, },
@ -648,7 +680,15 @@
}, },
{ {
"Type": "NodeText", "Type": "NodeText",
"Data": ": この関数はデータベースへのクエリに使用され、戻り値は結果セットです" "Data": ": この関数は"
},
{
"Type": "NodeText",
"Data": "データベース"
},
{
"Type": "NodeText",
"Data": "へのクエリに使用され、戻り値は結果セットです"
} }
] ]
}, },
@ -1221,6 +1261,135 @@
} }
] ]
}, },
{
"ID": "20250828155049-69k1o8n",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828155049-69k1o8n",
"updated": "20250828155049"
},
"Children": [
{
"ID": "20250828155049-vbcmh76",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828155049-vbcmh76",
"updated": "20250828155051"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOMonth"
},
{
"Type": "NodeText",
"Data": ": この関数は現在の月を返します"
}
]
}
]
},
{
"ID": "20250828155051-8r71644",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828155051-8r71644",
"updated": "20250828155051"
},
"Children": [
{
"ID": "20250828155051-d8e3faa",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828155051-d8e3faa",
"updated": "20250828155057"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOYear"
},
{
"Type": "NodeText",
"Data": ": この関数は現在の年を返します"
}
]
}
]
},
{
"ID": "20250828155057-hqlahyc",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20250828155057-hqlahyc",
"updated": "20250828155138"
},
"Children": [
{
"ID": "20250828155057-s2ugs9d",
"Type": "NodeParagraph",
"Properties": {
"id": "20250828155057-s2ugs9d",
"updated": "20250828155138"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeekDate"
},
{
"Type": "NodeText",
"Data": ": この関数は、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "time.Time"
},
{
"Type": "NodeText",
"Data": " を使用して指定された曜日の日付を返します。例えば、"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{now | ISOWeekDate 4 | date \"2006-01-02\" }"
},
{
"Type": "NodeText",
"Data": " は今週の木曜日の日付を返します"
}
]
}
]
},
{ {
"ID": "20240530101000-q2rf0ys", "ID": "20240530101000-q2rf0ys",
"Type": "NodeListItem", "Type": "NodeListItem",