-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path无格式混排版nunjucks
65 lines (56 loc) · 2.16 KB
/
无格式混排版nunjucks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
isbn: {{metaData.isbn}}
category: {{metaData.category}}
lastReadDate: {{metaData.lastReadDate}}
---
# {{metaData.title}}
`{{metaData.author}}`
{{metaData.intro}}
>[!abstract] [![cover|100]({{metaData.cover}})](<{{metaData.title}}细读>)
> - 作者:{{metaData.author}}
> - 出版时间:{{metaData.publishTime|replace("00:00:00","")}}
> - ISBN:{{metaData.isbn}}
> - 分类:{{metaData.category}}
> - 出版社:{{metaData.publisher}}
> - 划线数量:{{metaData.noteCount}}
> - 笔记数量:{{metaData.reviewCount}}
## 笔记
{%- set allNotes = [] -%}
{%- for highlightItem in chapterHighlights -%}
{%- for highlight in highlightItem.highlights -%}
{%- set allNotes = allNotes.concat({'type': 'highlight', 'data': highlight, 'range': highlight.range.split("-")[0] | int}) -%}
{%- endfor -%}
{%- endfor -%}
{%- for reviewitem in bookReview.chapterReviews -%}
{%- for review in reviewitem.reviews -%}
{%- set allNotes = allNotes.concat({'type': 'review', 'data': review,'range': review.range.split("-")[0] | int}) -%}
{%- endfor -%}
{%- for chapterReview in reviewitem.chapterReviews -%}
{%- set allNotes = allNotes.concat({'type': 'chapterReview', 'data': chapterReview}) -%}
{%- endfor -%}
{%- endfor -%}
{%- set allNotes = allNotes|sort(attribute='data.chapterUid')|groupby('data.chapterUid') -%}
{% for chapterUid, notes in allNotes %}
### {{ notes[0].data.chapterTitle }}
{%- for note in notes|sort(attribute='range') %}
{% if note.type == 'highlight' and not note.data.reviewContent %}
###### ▨高亮
- {{ note.data.markText | trim }} ^{{note.data.chapterUid}}-{{note.data.range}}
- {{note.data.createTime}}
{% elif note.type == 'review' %}
###### ◨评论
- {{ note.data.abstract | trim }}
- {{ note.data.content }} ^{{note.data.reviewId}}
- {{note.data.createTime}}
{% elif note.type == 'chapterReview' %}
###### ◰章节评论
- {{ note.data.content }} ^{{note.data.reviewId}}
- {{note.data.createTime}}
{%- endif %}
{%- endfor %}
{% endfor %}
{%- for bookReview in bookReview.bookReviews %} {% if bookReview.mdContent.length %}
## 书评
`写于{{bookReview.createTime}}`
{{bookReview.mdContent}} ^{{bookReview.reviewId}}
{% endif %} {% endfor %}