Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-03-08 16:45:10 +08:00
commit a18f1c6261
5 changed files with 1230 additions and 51 deletions

View file

@ -6,7 +6,7 @@
"id": "20201204184532-3qm9l8n",
"title": "Template snippet",
"type": "doc",
"updated": "20230820185644"
"updated": "20240308162730"
},
"Children": [
{
@ -214,7 +214,7 @@
"ListData": {},
"Properties": {
"id": "20210104091444-mwbvc9m",
"updated": "20211213121210"
"updated": "20240308162730"
},
"Children": [
{
@ -236,6 +236,10 @@
"updated": "20210502205126"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -243,7 +247,7 @@
},
{
"Type": "NodeText",
"Data": ": Use this variable to insert the current document name. For example, if the template content is "
"Data": ": Use this variable to insert the current document name. For example, if the template content is "
},
{
"Type": "NodeTextMark",
@ -252,7 +256,7 @@
},
{
"Type": "NodeText",
"Data": ", it will be inserted into the current document content with the first-level heading syntax after invoking"
"Data": ", it will be inserted into the current document content with the first-level heading syntax after invoking"
}
]
}
@ -277,6 +281,10 @@
"updated": "20210428223500"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -284,7 +292,7 @@
},
{
"Type": "NodeText",
"Data": "Use this variable to insert the current document id"
"Data": "Use this variable to insert the current document id"
}
]
}
@ -309,6 +317,10 @@
"updated": "20211213121022"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -316,7 +328,7 @@
},
{
"Type": "NodeText",
"Data": ": Use this variable to insert the current document name"
"Data": ": Use this variable to insert the current document name"
}
]
}
@ -341,6 +353,10 @@
"updated": "20211213121038"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -348,7 +364,7 @@
},
{
"Type": "NodeText",
"Data": "Use this variable to insert the current document alias"
"Data": "Use this variable to insert the current document alias"
}
]
}
@ -373,6 +389,10 @@
"updated": "20210504093006"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -380,12 +400,40 @@
},
{
"Type": "NodeText",
"Data": ": This function is used to query the database, and the return value is a list of blocks, and the parameter is a SQL statement: "
"Data": ": This function is used to query the "
},
{
"Type": "NodeText",
"Data": "database"
},
{
"Type": "NodeText",
"Data": ", and the return value is "
},
{
"Type": "NodeText",
"Data": "a"
},
{
"Type": "NodeText",
"Data": " list of blocks, and the parameter is "
},
{
"Type": "NodeText",
"Data": "a"
},
{
"Type": "NodeText",
"Data": " SQL statement: "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{sql \"SELECT * FROM blocks LIMIT 7\"}"
"TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM blocks LIMIT 7\u0026quot;}"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
@ -410,6 +458,10 @@
"updated": "20210504093302"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -417,12 +469,40 @@
},
{
"Type": "NodeText",
"Data": ": This function is used to query the database, and the return value is a list of spans, and the parameter is a SQL statement: "
"Data": ": This function is used to query the "
},
{
"Type": "NodeText",
"Data": "database"
},
{
"Type": "NodeText",
"Data": ", and the return value is "
},
{
"Type": "NodeText",
"Data": "a"
},
{
"Type": "NodeText",
"Data": " list of spans, and the parameter is "
},
{
"Type": "NodeText",
"Data": "a"
},
{
"Type": "NodeText",
"Data": " SQL statement: "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{sql \"SELECT * FROM spans LIMIT 7\"}"
"TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM spans LIMIT 7\u0026quot;}"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
@ -448,6 +528,10 @@
"updated": "20211213121210"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -455,7 +539,23 @@
},
{
"Type": "NodeText",
"Data": ": This function is used to parse a string in time format into a "
"Data": ": This function is used to parse "
},
{
"Type": "NodeText",
"Data": "a"
},
{
"Type": "NodeText",
"Data": " string in time format into "
},
{
"Type": "NodeText",
"Data": "a"
},
{
"Type": "NodeText",
"Data": " "
},
{
"Type": "NodeTextMark",
@ -464,7 +564,330 @@
},
{
"Type": "NodeText",
"Data": " type so that more formatting methods can be used to render the time"
"Data": " type so that more formatting methods can be used to render the time"
}
]
}
]
},
{
"ID": "20240308162632-h7vi1dh",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-h7vi1dh",
"updated": "20240308162632"
},
"Children": [
{
"ID": "20240308162632-en6g3fm",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-en6g3fm",
"updated": "20240308162632"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Weekday"
},
{
"Type": "NodeText",
"Data": ": This function is used to return the day of the week "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=0, Monday=1, ..., Saturday=6"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162632-s5ipztw",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-s5ipztw",
"updated": "20240308162652"
},
"Children": [
{
"ID": "20240308162632-r20wx9o",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-r20wx9o",
"updated": "20240308162652"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "WeekdayCN"
},
{
"Type": "NodeText",
"Data": ": This function is used to return the day of the week "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=日, Monday=一, ..., Saturday=六"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162632-9e9ytoj",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-9e9ytoj",
"updated": "20240308162700"
},
"Children": [
{
"ID": "20240308162632-dhivcod",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-dhivcod",
"updated": "20240308162700"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "WeekdayCN2"
},
{
"Type": "NodeText",
"Data": ": This function is used to return the day of the week "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=天, Monday=一, ..., Saturday=六"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162632-3ec0qtk",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-3ec0qtk",
"updated": "20240308162632"
},
"Children": [
{
"ID": "20240308162632-akk8sxn",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-akk8sxn",
"updated": "20240308162632"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeek"
},
{
"Type": "NodeText",
"Data": ": This function is used to return the week"
}
]
}
]
},
{
"ID": "20240308162632-essiuhv",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-essiuhv",
"updated": "20240308162717"
},
"Children": [
{
"ID": "20240308162632-usz39m7",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-usz39m7",
"updated": "20240308162717"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "pow"
},
{
"Type": "NodeText",
"Data": ": Exponential calculation, return an integer"
}
]
}
]
},
{
"ID": "20240308162632-iekhm3w",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-iekhm3w",
"updated": "20240308162721"
},
"Children": [
{
"ID": "20240308162632-rxfovte",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-rxfovte",
"updated": "20240308162721"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "powf"
},
{
"Type": "NodeText",
"Data": ": Exponential calculation, return a floating point number"
}
]
}
]
},
{
"ID": "20240308162632-v8vhchs",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-v8vhchs",
"updated": "20240308162730"
},
"Children": [
{
"ID": "20240308162632-2lzssxv",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-2lzssxv",
"updated": "20240308162730"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "log"
},
{
"Type": "NodeText",
"Data": ": Logarithmic calculation, returns an integer"
}
]
}
]
},
{
"ID": "20240308162632-4wa3g3n",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162632-4wa3g3n",
"updated": "20240308162724"
},
"Children": [
{
"ID": "20240308162632-27ni8cf",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162632-27ni8cf",
"updated": "20240308162724"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "logf"
},
{
"Type": "NodeText",
"Data": ": Logarithmic calculation, return a floating point number"
}
]
}

View file

@ -6,7 +6,7 @@
"id": "20201204181006-7bkppue",
"title": "模板片段",
"type": "doc",
"updated": "20230820185615"
"updated": "20240308162603"
},
"Children": [
{
@ -128,7 +128,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20210104091309-mvyh081",
"updated": "20230820185615"
"updated": "20240308161634"
},
"Children": [
{
@ -152,7 +152,17 @@
},
{
"Type": "NodeText",
"Data": "。"
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://docs.siyuan-note.club/zh-Hans/reference/template/sprig/",
"TextMarkTextContent": "中文版"
},
{
"Type": "NodeText",
"Data": ")。"
}
]
},
@ -226,7 +236,7 @@
"ListData": {},
"Properties": {
"id": "20210104091309-gjkg3u5",
"updated": "20220605170311"
"updated": "20240308162603"
},
"Children": [
{
@ -248,6 +258,10 @@
"updated": "20210502204955"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -255,7 +269,7 @@
},
{
"Type": "NodeText",
"Data": ":该变量用于插入当前文档名。比如模板内容为 "
"Data": ":该变量用于插入当前文档名。比如模板内容为 "
},
{
"Type": "NodeTextMark",
@ -264,7 +278,7 @@
},
{
"Type": "NodeText",
"Data": ",则调用后会以一级标题语法插入到当前文档内容中"
"Data": ",则调用后会以一级标题语法插入到当前文档内容中"
}
]
}
@ -289,6 +303,10 @@
"updated": "20210428223457"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -296,7 +314,7 @@
},
{
"Type": "NodeText",
"Data": ":该变量用于插入当前文档 ID"
"Data": ":该变量用于插入当前文档 ID"
}
]
}
@ -321,6 +339,10 @@
"updated": "20211213120746"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -328,7 +350,7 @@
},
{
"Type": "NodeText",
"Data": ":该变量用于插入当前文档命名"
"Data": ":该变量用于插入当前文档命名"
}
]
}
@ -354,6 +376,10 @@
"updated": "20220605170311"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -361,7 +387,7 @@
},
{
"Type": "NodeText",
"Data": ":该变量用于插入当前文档别名"
"Data": ":该变量用于插入当前文档别名"
}
]
}
@ -386,6 +412,10 @@
"updated": "20210504092933"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -393,12 +423,24 @@
},
{
"Type": "NodeText",
"Data": ":该函数用于查询数据库,返回值为 blocks 列表,参数为 SQL 语句:"
"Data": "​:该函数用于查询"
},
{
"Type": "NodeText",
"Data": "数据库"
},
{
"Type": "NodeText",
"Data": ",返回值为 blocks 列表,参数为 SQL 语句:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{sql \"SELECT * FROM blocks LIMIT 7\"}"
"TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM blocks LIMIT 7\u0026quot;}"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
@ -423,6 +465,10 @@
"updated": "20210504093332"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -430,12 +476,24 @@
},
{
"Type": "NodeText",
"Data": ":该函数用于查询数据库,返回值为 spans 列表,参数为 SQL 语句:"
"Data": "​:该函数用于查询"
},
{
"Type": "NodeText",
"Data": "数据库"
},
{
"Type": "NodeText",
"Data": ",返回值为 spans 列表,参数为 SQL 语句:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{sql \"SELECT * FROM spans LIMIT 7\"}"
"TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM spans LIMIT 7\u0026quot;}"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
@ -461,6 +519,10 @@
"updated": "20211213121154"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -468,7 +530,7 @@
},
{
"Type": "NodeText",
"Data": ":该函数用于将时间格式的字符串解析为 "
"Data": ":该函数用于将时间格式的字符串解析为 "
},
{
"Type": "NodeTextMark",
@ -477,7 +539,323 @@
},
{
"Type": "NodeText",
"Data": " 类型,以便使用更多格式化方法渲染该时间"
"Data": " 类型,以便使用更多格式化方法渲染该时间"
}
]
}
]
},
{
"ID": "20240308161717-xkgiour",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308161717-xkgiour"
},
"Children": [
{
"ID": "20240308161717-ja8a2qw",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308161717-ja8a2qw",
"updated": "20240308162050"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Weekday"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回周几 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=0, Monday=1, ..., Saturday=6"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162051-g575lg1",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162051-g575lg1"
},
"Children": [
{
"ID": "20240308162051-qdxgndg",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162051-qdxgndg",
"updated": "20240308162108"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "WeekdayCN"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回周几 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=日, Monday=一, ..., Saturday=六"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162109-paei265",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162109-paei265"
},
"Children": [
{
"ID": "20240308162109-6s8psxm",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162109-6s8psxm",
"updated": "20240308162125"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "WeekdayCN2"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回周几 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=天, Monday=一, ..., Saturday=六"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162139-yt96e2z",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162139-yt96e2z"
},
"Children": [
{
"ID": "20240308162139-x4evb04",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162139-x4evb04",
"updated": "20240308162153"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeek"
},
{
"Type": "NodeText",
"Data": "​:该函数用于返回第几周"
}
]
}
]
},
{
"ID": "20240308162209-vls60yh",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162209-vls60yh"
},
"Children": [
{
"ID": "20240308162209-hheoq88",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162209-hheoq88",
"updated": "20240308162504"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "pow"
},
{
"Type": "NodeText",
"Data": "​:指数计算,返回整数"
}
]
}
]
},
{
"ID": "20240308162455-c15kzsv",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162455-c15kzsv"
},
"Children": [
{
"ID": "20240308162455-eqm57bk",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162455-eqm57bk",
"updated": "20240308162515"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "powf"
},
{
"Type": "NodeText",
"Data": "​:指数计算,返回浮点数"
}
]
}
]
},
{
"ID": "20240308162518-1ouvecu",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162518-1ouvecu"
},
"Children": [
{
"ID": "20240308162518-c71ndzq",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162518-c71ndzq",
"updated": "20240308162549"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "log"
},
{
"Type": "NodeText",
"Data": "​:对数计算,返回整数"
}
]
}
]
},
{
"ID": "20240308162549-jyktdek",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162549-jyktdek",
"updated": "20240308162603"
},
"Children": [
{
"ID": "20240308162549-2z3s09v",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162549-2z3s09v",
"updated": "20240308162603"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "logf"
},
{
"Type": "NodeText",
"Data": "​:对数计算,返回浮点数"
}
]
}

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20211226123004-dplpw0o",
"title": "範本片段",
"updated": "20230820185634"
"updated": "20220605170337"
},
"Children": [
{
@ -230,6 +230,10 @@
"updated": "20211228104250"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -237,7 +241,7 @@
},
{
"Type": "NodeText",
"Data": ":該變量用於插入當前文檔名。比如範本內容為 "
"Data": ":該變量用於插入當前文檔名。比如範本內容為 "
},
{
"Type": "NodeTextMark",
@ -246,7 +250,7 @@
},
{
"Type": "NodeText",
"Data": ",則調用後會以一級標題語法插入到當前文檔內容中"
"Data": ",則調用後會以一級標題語法插入到當前文檔內容中"
}
]
}
@ -270,6 +274,10 @@
"id": "20211226123024-vy2z5oq"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -277,7 +285,7 @@
},
{
"Type": "NodeText",
"Data": ":該變量用於插入當前文檔 ID"
"Data": ":該變量用於插入當前文檔 ID"
}
]
}
@ -301,6 +309,10 @@
"id": "20211226123024-xx9l8ku"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -308,7 +320,7 @@
},
{
"Type": "NodeText",
"Data": ":該變量用於插入當前文檔命名"
"Data": ":該變量用於插入當前文檔命名"
}
]
}
@ -334,6 +346,10 @@
"updated": "20220605170337"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -341,7 +357,7 @@
},
{
"Type": "NodeText",
"Data": ":該變量用於插入當前文檔別名"
"Data": ":該變量用於插入當前文檔別名"
}
]
}
@ -367,6 +383,10 @@
"updated": "20211228141606"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -374,12 +394,24 @@
},
{
"Type": "NodeText",
"Data": ":該函數用於查詢資料庫,返回值為 blocks 列表,參數為 SQL 語句:"
"Data": "​:該函數用於查詢"
},
{
"Type": "NodeText",
"Data": "資料庫"
},
{
"Type": "NodeText",
"Data": ",返回值為 blocks 列表,參數為 SQL 語句:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{sql \"SELECT * FROM blocks LIMIT 7\"}"
"TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM blocks LIMIT 7\u0026quot;}"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
@ -405,6 +437,10 @@
"updated": "20211228141602"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -412,12 +448,24 @@
},
{
"Type": "NodeText",
"Data": ":該函數用於查詢資料庫,返回值為 spans 列表,參數為 SQL 語句:"
"Data": "​:該函數用於查詢"
},
{
"Type": "NodeText",
"Data": "資料庫"
},
{
"Type": "NodeText",
"Data": ",返回值為 spans 列表,參數為 SQL 語句:"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": ".action{sql \"SELECT * FROM spans LIMIT 7\"}"
"TextMarkTextContent": ".action{sql \u0026quot;SELECT * FROM spans LIMIT 7\u0026quot;}"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
@ -441,6 +489,10 @@
"id": "20211226123024-8esfka7"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -448,7 +500,7 @@
},
{
"Type": "NodeText",
"Data": ":該函數用於將時間格式的字符串解析為 "
"Data": ":該函數用於將時間格式的字符串解析為 "
},
{
"Type": "NodeTextMark",
@ -457,7 +509,330 @@
},
{
"Type": "NodeText",
"Data": " 類型,以便使用更多格式化方法渲染該時間"
"Data": " 類型,以便使用更多格式化方法渲染該時間"
}
]
}
]
},
{
"ID": "20240308162753-8almw0o",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-8almw0o",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-l18r65o",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-l18r65o",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Weekday"
},
{
"Type": "NodeText",
"Data": "​:函數用來傳回週幾 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=0, Monday=1, ..., Saturday=6"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162753-2qy7ko8",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-2qy7ko8",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-6u90ynh",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-6u90ynh",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "WeekdayCN"
},
{
"Type": "NodeText",
"Data": "​:函數用來傳回週幾 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=日, Monday=一, ..., Saturday=六"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162753-a8vapod",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-a8vapod",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-a18gx3m",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-a18gx3m",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "WeekdayCN2"
},
{
"Type": "NodeText",
"Data": "​:函數用來傳回週幾 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "Sunday=天, Monday=一, ..., Saturday=六"
},
{
"Type": "NodeText",
"Data": ""
}
]
}
]
},
{
"ID": "20240308162753-qs51tmz",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-qs51tmz",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-tde2ifs",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-tde2ifs",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "ISOWeek"
},
{
"Type": "NodeText",
"Data": "​:此函數用於傳回第幾週"
}
]
}
]
},
{
"ID": "20240308162753-zazpf8n",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-zazpf8n",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-zp3uf3c",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-zp3uf3c",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "pow"
},
{
"Type": "NodeText",
"Data": "​:指數計算,傳回整數"
}
]
}
]
},
{
"ID": "20240308162753-623n608",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-623n608",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-y7455e1",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-y7455e1",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "powf"
},
{
"Type": "NodeText",
"Data": "​:指數計算,傳回浮點數"
}
]
}
]
},
{
"ID": "20240308162753-bilwjys",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-bilwjys",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-m1h6rni",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-m1h6rni",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "log"
},
{
"Type": "NodeText",
"Data": "​:對數計算,傳回整數"
}
]
}
]
},
{
"ID": "20240308162753-m9aebtw",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20240308162753-m9aebtw",
"updated": "20240308162753"
},
"Children": [
{
"ID": "20240308162753-ly9t8ym",
"Type": "NodeParagraph",
"Properties": {
"id": "20240308162753-ly9t8ym",
"updated": "20240308162753"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "logf"
},
{
"Type": "NodeText",
"Data": "​:對數計算,傳回浮點數"
}
]
}

View file

@ -20,14 +20,12 @@ import (
"bytes"
"errors"
"fmt"
"github.com/araddon/dateparse"
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"text/template"
"time"
"github.com/88250/gulu"
"github.com/88250/lute/ast"
@ -413,13 +411,4 @@ func SQLTemplateFuncs(templateFuncMap *template.FuncMap) {
retSpans = sql.SelectSpansRawStmt(stmt, 512)
return
}
(*templateFuncMap)["parseTime"] = func(dateStr string) time.Time {
now := time.Now()
retTime, err := dateparse.ParseIn(dateStr, now.Location())
if nil != err {
logging.LogWarnf("parse date [%s] failed [%s], return current time instead", dateStr, err)
return now
}
return retTime
}
}

View file

@ -18,9 +18,12 @@ package util
import (
"github.com/Masterminds/sprig/v3"
"github.com/araddon/dateparse"
"github.com/siyuan-note/logging"
"github.com/spf13/cast"
"math"
"text/template"
"time"
)
func BuiltInTemplateFuncs() (ret template.FuncMap) {
@ -33,6 +36,7 @@ func BuiltInTemplateFuncs() (ret template.FuncMap) {
ret["powf"] = powf
ret["log"] = log
ret["logf"] = logf
ret["parseTime"] = parseTime
return
}
@ -42,3 +46,13 @@ func log(a, b interface{}) int64 {
return int64(math.Log(cast.ToFloat64(a)) / math.Log(cast.ToFloat64(b)))
}
func logf(a, b interface{}) float64 { return math.Log(cast.ToFloat64(a)) / math.Log(cast.ToFloat64(b)) }
func parseTime(dateStr string) time.Time {
now := time.Now()
retTime, err := dateparse.ParseIn(dateStr, now.Location())
if nil != err {
logging.LogWarnf("parse date [%s] failed [%s], return current time instead", dateStr, err)
return now
}
return retTime
}