注: 找到了一个可以增删改查文档属性的挂件, 感谢开发者 leolee9086❤
当我引用一个文档块时, 发现鼠标悬停在该引用上方弹出的预览面板中只能看到文档内容而无法看到文章的相关属性, 例如
- 文档标题
- 文档命名
- 文档别名
- 文档备注
- 文档 ID
- 文档所在路径
- 文档创建时间
- 文档修改时间
而我习惯将这些属性设置为如下内容
- 命名设置为中文全称, 用于在搜索时精确查找, 虚拟引用匹配等
- 别名设置为其他不常用的中文全称, 中文简称, 英文缩写等
- 备注设置为英文全称
但是显然悬浮预览面板无法查看这些内容, 因此我使用如下模板将这些内容以表格的形式插入
.action{$blocks := (queryBlocks "SELECT * FROM blocks WHERE type='d' AND id ='?'" .id)}
.action{$name := ""}
.action{$memo := ""}
.action{$hpath := ""}
.action{$created := ""}
.action{$updated := ""}
.action{range $i, $v := $blocks}
.action{$name = $v.Name}
.action{$memo = $v.Memo}
.action{$hpath = $v.HPath}
.action{$created = $v.Created}
.action{$updated = $v.Updated}
.action{end}
.action{$Title := ((((((((((((((((((((((((((((((((.title | replace "\\" "\\\\" ) | replace "`" "\\`" ) | replace "-" "\\-" ) | replace "=" "\\=" ) | replace "[" "\\[" ) | replace "]" "\\]" ) | replace ";" "\\;" ) | replace "'" "\\'" ) | replace "," "\\," ) | replace "." "\\." ) | replace "/" "\\/" ) | replace "~" "\\~" ) | replace "!" "\\!" ) | replace "@" "\\@" ) | replace "#" "\\#" ) | replace "$" "\\$" ) | replace "%" "\\%" ) | replace "^" "\\^" ) | replace "&" "\\&" ) | replace "*" "\\*" ) | replace "(" "\\(" ) | replace ")" "\\)" ) | replace "_" "\\_" ) | replace "+" "\\+" ) | replace "{" "\\{" ) | replace "}" "\\}" ) | replace "|" "\\|" ) | replace ":" "\\:" ) | replace "\"" "\\\"" ) | replace "<" "\\<" ) | replace ">" "\\>" ) | replace "?" "\\?" ) }
.action{$Name := (((((((((((((((((((((((((((((((($name | replace "\\" "\\\\" ) | replace "`" "\\`" ) | replace "-" "\\-" ) | replace "=" "\\=" ) | replace "[" "\\[" ) | replace "]" "\\]" ) | replace ";" "\\;" ) | replace "'" "\\'" ) | replace "," "\\," ) | replace "." "\\." ) | replace "/" "\\/" ) | replace "~" "\\~" ) | replace "!" "\\!" ) | replace "@" "\\@" ) | replace "#" "\\#" ) | replace "$" "\\$" ) | replace "%" "\\%" ) | replace "^" "\\^" ) | replace "&" "\\&" ) | replace "*" "\\*" ) | replace "(" "\\(" ) | replace ")" "\\)" ) | replace "_" "\\_" ) | replace "+" "\\+" ) | replace "{" "\\{" ) | replace "}" "\\}" ) | replace "|" "\\|" ) | replace ":" "\\:" ) | replace "\"" "\\\"" ) | replace "<" "\\<" ) | replace ">" "\\>" ) | replace "?" "\\?" ) }
.action{$Alias := ((((((((((((((((((((((((((((((((.alias | replace "\\" "\\\\" ) | replace "`" "\\`" ) | replace "-" "\\-" ) | replace "=" "\\=" ) | replace "[" "\\[" ) | replace "]" "\\]" ) | replace ";" "\\;" ) | replace "'" "\\'" ) | replace "." "\\." ) | replace "/" "\\/" ) | replace "~" "\\~" ) | replace "!" "\\!" ) | replace "@" "\\@" ) | replace "#" "\\#" ) | replace "$" "\\$" ) | replace "%" "\\%" ) | replace "^" "\\^" ) | replace "&" "\\&" ) | replace "*" "\\*" ) | replace "(" "\\(" ) | replace ")" "\\)" ) | replace "_" "\\_" ) | replace "+" "\\+" ) | replace "{" "\\{" ) | replace "}" "\\}" ) | replace "|" "\\|" ) | replace ":" "\\:" ) | replace "\"" "\\\"" ) | replace "<" "\\<" ) | replace ">" "\\>" ) | replace "?" "\\?" ) | replace "," "<br />")}
.action{$Memo := ((((((((((((((((((((((((((((((((($memo | replace "\\" "\\\\" ) | replace "`" "\\`" ) | replace "-" "\\-" ) | replace "=" "\\=" ) | replace "[" "\\[" ) | replace "]" "\\]" ) | replace ";" "\\;" ) | replace "'" "\\'" ) | replace "," "\\," ) | replace "." "\\." ) | replace "/" "\\/" ) | replace "~" "\\~" ) | replace "!" "\\!" ) | replace "@" "\\@" ) | replace "#" "\\#" ) | replace "$" "\\$" ) | replace "%" "\\%" ) | replace "^" "\\^" ) | replace "&" "\\&" ) | replace "*" "\\*" ) | replace "(" "\\(" ) | replace ")" "\\)" ) | replace "_" "\\_" ) | replace "+" "\\+" ) | replace "{" "\\{" ) | replace "}" "\\}" ) | replace "|" "\\|" ) | replace ":" "\\:" ) | replace "\"" "\\\"" ) | replace "<" "\\<" ) | replace ">" "\\>" ) | replace "?" "\\?" ) | replace "\n" "<br />")}
.action{$Hpath := (((((((((((((((((((((((((((((((($hpath | replace "\\" "\\\\" ) | replace "`" "\\`" ) | replace "-" "\\-" ) | replace "=" "\\=" ) | replace "[" "\\[" ) | replace "]" "\\]" ) | replace ";" "\\;" ) | replace "'" "\\'" ) | replace "," "\\," ) | replace "." "\\." ) | replace "/" "\\/" ) | replace "~" "\\~" ) | replace "!" "\\!" ) | replace "@" "\\@" ) | replace "#" "\\#" ) | replace "$" "\\$" ) | replace "%" "\\%" ) | replace "^" "\\^" ) | replace "&" "\\&" ) | replace "*" "\\*" ) | replace "(" "\\(" ) | replace ")" "\\)" ) | replace "_" "\\_" ) | replace "+" "\\+" ) | replace "{" "\\{" ) | replace "}" "\\}" ) | replace "|" "\\|" ) | replace ":" "\\:" ) | replace "\"" "\\\"" ) | replace "<" "\\<" ) | replace ">" "\\>" ) | replace "?" "\\?" ) }
.action{$Created := toDate "20060102150405" $created | date "2006-01-02 15:04:05"}
.action{$Updated := toDate "20060102150405" $updated | date "2006-01-02 15:04:05"}
| 标题 | .action{$Title} | ID | .action{.id} |
| :---: | :-------------- | :---: | :---------------- |
| 命名 | .action{$Name} | 路径 | .action{$Hpath} |
| 别名 | .action{$Alias} | 创建 | .action{$Created} |
| 备注 | .action{$Memo} | 更新 | .action{$Updated} |
- 该模板片段可以将别名以
,
分割并换行显示 - 该模板片段可以将备注换行显示
模板解析与渲染样式:
| 标题 | 外部网关协议 | ID | 20211227165822-lqn27nn |
| :---: | :------------------------------------------------------ | :---: | :---------------------------------- |
| 命名 | 外部网关协议 | 路径 | /计算机通信与网络/概念/外部网关协议 |
| 别名 | 外部路由器协议<br />EGP<br />ERP | 创建 | 2021-12-27 16:58:22 |
| 备注 | External Gateway Protocol<br />External Router Protocol | 更新 | 2021-12-28 02:24:05 |
标题 | 外部网关协议 | ID | 20211227165822-lqn27nn |
---|---|---|---|
命名 | 外部网关协议 | 路径 | /计算机通信与网络/概念/外部网关协议 |
别名 | 外部路由器协议 EGP ERP |
创建 | 2021-12-27 16:58:22 |
备注 | External Gateway Protocol External Router Protocol |
更新 | 2021-12-28 02:24:05 |
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于