第一次使用思源笔记,感觉社区中相关的模板还是比较少,然后在大佬给出的模板基础上,进行了一些修改,于是有了本文。(由于参考了直接导出,相关 id 没有删除,可以自行处理,但是不删也不影响)
还有一个问题:在周和月导出的时候会出现几个不知名“}}}”,但是在笔记页面的显示是正常的,目前还不知原因。
使用方法:将代码保存到 md 文件中,然后放入到模板文件夹就可以调用了。
吐槽一下:笔记导出的模板并不能很好的支持时间等动态设置,其实这一块可以进行对应设计(大部分都是时间要求,导出时加上固定模板和变量名即可),但是导出是静态的。【希望大家多多支持社区发展!!!】
这是在其他大佬项目下自己做的一个针对性修改,欢迎给大佬 star:https://github.com/Achuan-2/siyuan-note-templates
Update:有大佬加入了天气功能,并提供了相关下载,详情见评论区!!!
日模板:
.action{ $anchorSunday := "2022-12-25" }
.action{ $yearStartDate := now.Year | printf "%d-01-01" | toDate "2006-01-02" }
.action{ $ysDateDuration := div ($yearStartDate.Sub (toDate "2006-01-02" $anchorSunday)).Hours 24 }
.action{ $ysWeekDay := mod $ysDateDuration 7 }
.action{ $yearStartWeek := add (div (sub $ysDateDuration 1) 7) 1 }
.action{ if or (eq $ysWeekDay 0) (gt $ysWeekDay 4) }
.action{ $yearStartWeek := add $yearStartWeek 1 }
.action{ end }
.action{ $nowWeek := add (div (div (now.Sub (toDate "2006-01-02" $anchorSunday)).Hours 24) 7) 1 }
.action{ $week := add (sub $nowWeek $yearStartWeek) 1 }
.action{$today:= (now | date "2006-01")}
.action{$weeks:= (list $today "Week" $week| join " ")}
.action{ $nextYear := now.Year | add 1 }
.action{ $nextYearStart := $nextYear | printf "%d-01-01" | toDate "2006-01-02" }
.action{ $dayleft := (div (($nextYearStart).Sub now).Hours 24) }
.action{$week := add (mod (div ((toDate "2006-01-02" "2100-12-27").Sub now).Hours 24) 7) 1}
.action{ $anchorDate := toDate "2006-01-02" $anchorSunday }
.action{ $daysSinceAnchor := div (now.Sub $anchorDate).Hours 24 }
.action{ $weekIndex := mod (add $daysSinceAnchor 7) 7 }
.action{ $weekDays := list "星期天" "星期一" "星期二" "星期三" "星期四" "星期五" "星期六" }
.action{ $currentWeekDay := index $weekDays $weekIndex }
{{{col
{{{row
🕐 创建时间:.action{now | date "2006-01-02 15:04"} .action{$currentWeekDay}
}}}
{{{row
距离 `.action{ $nextYearStart.Year }-01-01` 还剩 `.action{$dayleft}` 天,Power!
}}}
{: style="color: var(--b3-card-info-color); background-color: var(--b3-card-info-background);"}
}}}
<br/>
{{{row
## 🎯Schedule
{: name=".action{now | date "2006-01-02"}" style="background-color: var(--b3-font-background11); --b3-parent-background: var(--b3-font-background11);"}
{{{col
{{{row
### ⏰今日目标
---
- [ ]
}}}
{{{row
### ⛱相关资源
---
*
}}}
{{{row
### 🧠其他收获
---
*
}}}
}}}
{: name="" fold="0"}
.action{/*s上面设置命名为空和不折叠,为了防止超级块内部的属性错位,被超级块获取*/}
}}}
<br/>
---
## <span data-type="strong">✏️工作记录</span>
{: id="20241216161447-5xs9g5h" style="background-color: var(--b3-font-background5); --b3-parent-background: var(--b3-font-background5);"}
@Aim:
{: custom-docinfo="@aim" }
@Point:
{: custom-docinfo="@point"}
###### Main:
<br/>
---
{{{row
## ✍每日总结
{: alias=".action{$weeks}" name=".action{now | date "2006-01-02"}" style="background-color: var(--b3-font-background12); --b3-parent-background: var(--b3-font-background12);"}
*
<br/>
}}}
{: name="" fold="0"}
.action{/*s上面设置命名为空和不折叠,为了防止超级块内部的属性错位,被超级块获取*/}
---
## 🤨新的问题
{: id="20241216161048-9bcmrl5" style="background-color: var(--b3-font-background1); --b3-parent-background: var(--b3-font-background1);"}
* {: id="20241216163341-tzjytgu"}
{: id="20241216163341-sapefqz"}
{: id="20241216161048-l036r1d"}
{: id="20241216163337-grbzksp"}
---
{: id="20241216161048-beu85nf"}
## <span data-type="text">📂</span>{: style="background-color: var(--b3-font-background8); color: var(--b3-card-success-color);"}<span data-type="text">知识补充&资源记录</span>{: style="background-color: var(--b3-font-background8);"}
{: id="20241216161826-hc10ke6" style="background-color: var(--b3-font-background8); --b3-parent-background: var(--b3-font-background8);"}
* {: id="20241216161826-sjo55jx"}📂<span data-type="strong">Project</span>
{: id="20241216161826-n8jfixd"}
* {: id="20241216161826-misoirf"}📂<span data-type="strong">Resources</span>
{: id="20241216161826-xdiudv6"}
{: id="20241216161826-gqcm5z7"}
{: id="20241216161021-yyxcsay" title="未命名文档" type="doc"}
周模板:
.action{ $anchorSunday := "2022-12-25" }
.action{ $yearStartDate := now.Year | printf "%d-01-01" | toDate "2006-01-02" }
.action{ $ysDateDuration := div ($yearStartDate.Sub (toDate "2006-01-02" $anchorSunday)).Hours 24 }
.action{ $ysWeekDay := mod $ysDateDuration 7 }
.action{ $yearStartWeek := add (div (sub $ysDateDuration 1) 7) 1 }
.action{ if or (eq $ysWeekDay 0) (gt $ysWeekDay 4) }
.action{ $yearStartWeek := add $yearStartWeek 1 }
.action{ end }
.action{ $nowWeek := add (div (div (now.Sub (toDate "2006-01-02" $anchorSunday)).Hours 24) 7) 1 }
.action{ $week := add (sub $nowWeek $yearStartWeek) 1 }
.action{$today:= (now | date "2006-01")}
.action{$weekResult:= (list $today "Week" $week| join " ")}
.action{$curYear := now.Year}
.action{$weeks:= (list $curYear "Week" $week| join " ")}
## 📅.action{$weekResult}
.action{/*今天距离周一有几天*/}
.action{$ng_week := (mod (div ((toDate "2006-01-02" "2021-06-28").Sub now).Hours 24) 7) }
.action{/*用于range循环,表示循环7次, 没什么实际意义*/}
.action{$days := list "星期六" "星期五" "星期四" "星期三" "星期二" "星期一" "星期天"}
.action{/*循环生成星期列表*/}
.action{/*生成周一日期所需要修正的时长*/}
.action{$monday:= mul 24 $ng_week}
{{{col
.action{range $index,$day:=$days}
.action{/*布局*/}
.action{$setColum:= mod (add $index 1) 3 }
.action{if eq $setColum 1}
{{{
.action{end}
.action{/*迭代 每次增加24*/}
.action{$after := mul 24 $index}
.action{/*在周一的基础上,附加的时间*/}
.action{$realdate:= add $monday $after}
.action{/*生成以 h 为单位的 字符串*/}
.action{$result:=(list $realdate "h" | join "")}
.action{/*获取列表项*/}
.action{$days_list := now | date_modify $result | date "2006-01-02"}
### .action{$days_list} .action{last (slice (list "星期一" "星期二" "星期三" "星期四" "星期五" "星期六" "星期日") 0 (add 1 $index ) )}
{{select * from blocks where name=".action{$days_list}" and content="🎯Schedule" }}
<br/>
.action{/*布局*/}
.action{$setColum:= mod (add $index 1) 1 }
.action{if eq $setColum 2}
}}}
.action{else if eq $index 3}
}}}
.action{end}
.action{$index := add $index 2}
.action{end}
### 日总结汇总
{{SELECT * from blocks where type='h' and content = '✍每日总结' and alias='.action{$weekResult}' }}
<br/>
---
### 一周总结
{: alias=".action{$weeks}" style="background-color: var(--b3-font-background10); --b3-parent-background: var(--b3-font-background10);"}
<br/>
月模板:
.action{$currentYear := now.Year}
.action{$currentMonth := now.Month | printf "%02d"}
.action{$currentMonthYear := list $currentYear $currentMonth | join "年" | printf "%s月"}
## 📅 .action{$currentMonthYear}
---
.action{$anchorSunday := "2022-12-25"}
.action{$yearStartDate := $currentYear | printf "%d-01-01" | toDate "2006-01-02"}
.action{$ysDateDuration := div ($yearStartDate.Sub (toDate "2006-01-02" $anchorSunday)).Hours 24}
.action{$ysWeekDay := mod $ysDateDuration 7}
.action{$yearStartWeek := add (div (sub $ysDateDuration 1) 7) 1}
.action{if or (eq $ysWeekDay 0) (gt $ysWeekDay 4)}
.action{$yearStartWeek := add $yearStartWeek 1}
.action{end}
.action{$nowWeek := add (div (div (now.Sub (toDate "2006-01-02" $anchorSunday)).Hours 24) 7) 1}
.action{$week := add (sub $nowWeek $yearStartWeek) 1}
.action{$weeksToDisplay := list 0 1 2 3}
.action{range $weekIndex := $weeksToDisplay}
## 第.action{add $week $weekIndex}周
.action{$aliasValue := printf "%d Week %d" $currentYear (add $week $weekIndex)}
{{select * from blocks where alias=".action{$aliasValue}"}}
<br/>
.action{end}
---
### 月总结
{: alias=".action{$currentYear} Month .action{$currentMonth}" style="background-color: var(--b3-font-background11); --b3-parent-background: var(--b3-font-background11);"}
-
<br/>
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于