-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBook Macros.tid
118 lines (99 loc) · 2.3 KB
/
Book Macros.tid
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
tags: $:/tags/Macro
title: $:/plugins/OokTech/TiddlyLivre/Book Macros
type: text/vnd.tiddlywiki
\define ChapterTitleThingy() [[$(Chapter)$]]
\define BookTitleThingy() [[$(Book)$]]
\define OpenChapter(Chapter)
<$vars
Chapter="""$Chapter$"""
>
<$list
filter="""[[$Chapter$]get[book]]"""
variable=Book
>
<<InnerOpenChapter>>
<$action-navigate
$to=<<Book>>
/>
</$list>
</$vars>
\end
\define InnerOpenChapter()
<$action-setfield
$tiddler='$:/settings/TiddlyLivre'
book=<<Book>>
/>
<$action-setfield
$tiddler='$:/settings/TiddlyLivre'
chapter=<<Chapter>>
/>
<$action-setfield
$tiddler='$:/StoryList'
list=''
/>
<$action-listops
$tiddler='$:/StoryList'
$subfilter='+[append<BookTitleThingy>]'
/>
<$action-listops
$tiddler='$:/StoryList'
$subfilter='+[append<ChapterTitleThingy>]'
/>
<$set
name=ParagraphList
filter='[book<Book>chapter<Chapter>tag[Paragraph]nsort[order]]'
>
<$action-listops
$tiddler='$:/StoryList'
$subfilter='+[append<ParagraphList>]'
/>
</$set>
\end
\define OpenParagraph(Paragraph)
<$list
filter="""[[$Paragraph$]get[book]]"""
variable=Book
>
<$list
filter="""[[$Paragraph$]get[chapter]]"""
variable=Chapter
>
<<InnerOpenChapter>>
<$action-navigate
$to="""$Paragraph$"""
/>
</$list>
</$list>
\end
\define OpenBook(Book)
<$vars
Book="""$Book$"""
>
<$list
filter='[book<Book>tag[Chapter]nsort[order]first[]]'
variable=Chapter
>
<<InnerOpenChapter>>
</$list>
<$action-navigate
$to="""$Book$"""
/>
</$vars>
\end
!Macros:
Each macro can be put inside a button to open a book to a specific location
!!`OpenBook`
This macro opens up a book to its first chapter
Usage: `<<OpenBook Book>>`
|!Parameter |!Description |
|Book |The title of the book you want to open |
!!`OpenChapter`
This macro opens a book to the given chapter
Usage: `<<OpenChapter Chapter>>`
|!Parameter |!Description |
|Chapter |The title of the tiddler for the chapter you want to open |
!!`OpenParagraph`
This macro opens a book to a specific paragarph
Usage: `<<OpenParagraph Paragraph>>`
|!Parameter |!Description |
|Paragraph | The title of the paragraph tiddler you want to navigate to |