-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.js
172 lines (170 loc) · 5.56 KB
/
macros.js
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
const macroMap = new Map();
module.exports.macroMap = macroMap;
macroMap.set('root', [
'(%pg-header%)+(%pg-main-content%)+(%pg-footer%)',
'(%pg-header%)+(%pg-blog-content%)+(%pg-footer%)'
]);
macroMap.set('pg-main-content', [
'(%section%)%+4,6%'
]);
macroMap.set('pg-blog-content', [
'(%blog-article%)%+4,6%'
]);
macroMap.set('pg-header', [
'%pg-header-content%',
'div%>div{1}%(%pg-header-content%)'
]);
macroMap.set('pg-header-content', [
'header%>div{1}%(%nav%)',
'header%>div{1}%(h1{__HEADING_SHORT__}+(%nav%))',
'header%>div{1}%div>(h1{__HEADING_SHORT__}+h2{__HEADING__})^(%nav%)',
'header%>div{1}%h1{__HEADING_SHORT__}+div>(%nav%)',
]);
macroMap.set('pg-footer', [
'%pg-footer-content%',
'div%>div{1}%(%pg-footer-content%)'
]);
macroMap.set('pg-footer-content', [
'footer%>div{1}%(%copyright%)',
'footer%>div{1}%nav>p%3,5%>a[href=page$.html]{page$}',
'footer%>div{1}%(nav>p%3,5%>a[href=page$.html]{page$})+(%copyright%)'
]);
macroMap.set('copyright', [
'p.copyright{©2023 Example}'
]);
macroMap.set('nav', [
'nav>ul>li%3,6%>a[href=#s$]{$}'
]);
macroMap.set('p-hypertext', [
'(p{__HYPERTEXT20X3__})%+3%',
])
macroMap.set('figure', [
'figure>figcaption{__MESSAGE__}+img[src=photo4x3_$.jpg alt=__PHRASE__]',
'figure>img[src=photo4x3_$.jpg alt=__PHRASE__]+figcaption{__MESSAGE__}'
]);
macroMap.set('thumbnail', [
'div>img[src=photo1x1_$.jpg alt=__PHRASE__]',
'div>img[src=photo4x3_$.jpg alt=__PHRASE__]',
'div>img[src=photo16x9_$.jpg alt=__PHRASE__]',
]);
macroMap.set('list', [
'ul>li%4,6%>(%link-icon%)',
'ul>li%4,6%{__MESSAGE__}',
'ol>li%4,6%{__MESSAGE__}',
'dl>(dt>{__PHRASE__}^dd>{__HYPERTEXT12X3__})%3,6%'
]);
macroMap.set('section', [
'section[id=s__SEQ_ID__]>(%section-inner%)',
'section[id=s__SEQ_ID__]%>div{1}%(%section-inner%)',
]);
macroMap.set('section-inner', [
'(%section-heading%)+(%section-body%)',
'(%section-heading%)+(%section-body%)+div>(%list%)',
'(%section-heading%)+(%section-body%)+div>(%table%)',
'(%section-heading%)+(%section-body%)+(%grid%)',
'(%section-heading%)+(%section-body%)+(%grid-repeat%)',
'(%section-heading%)+(%section-body%)+(%alternative%)'
]);
macroMap.set('section-heading', [
'h2{Section __SEQ_1__}',
'div>h2{Section __SEQ_1__}'
]);
macroMap.set('section-body', [
'(%ordered-block%)%+3%',
'(%float-block%)%+3%',
'(%ordered-block%)+(%float-block%)',
'(%float-block%)+(%ordered-block%)',
'(%ordered-block%)+(%float-block%)+(%ordered-block%)',
'(%float-block%)+(%ordered-block%)+(%float-block%)'
]);
macroMap.set('float-block', [
'div._x-float-img-right>(%photo%)+(%p-hypertext%)',
'div._x-float-img-left>(%photo%)+(%p-hypertext%)',
'div._x-float-img-right>(%photo%)+p{__HYPERTEXT12X3__}',
'div._x-float-img-left>(%photo%)+p{__HYPERTEXT12X3__}'
]);
macroMap.set('ordered-block', [
'div>(%p-hypertext%)+(%img-block%)',
'div>(%p-hypertext%)+(%img-block%)',
'div>(%img-block%)+(%p-hypertext%)',
'div>((%img-block%)+div>(%p-hypertext%))'
]);
macroMap.set('img-block', [
'%photo%',
'%photo-column%',
'%figure%',
]);
macroMap.set('photo', [
'div>img[src=photo4x3_$.jpg alt=__PHRASE__]',
'div>img[src=photo16x9_$.jpg alt=__PHRASE__]',
]);
macroMap.set('photo-column', [
'div>(%photo%)*2'
]);
macroMap.set('alternative', [
'div>div>figure>(blockquote>p{__HYPERTEXT12X3__})+(figcaption>{—__NAME__, }+cite{__HEADING_SHORT__})',
'div>div>details>(%summary-content%)'
]);
macroMap.set('summary-content', [
'summary{__HEADING_SHORT__}+{__HYPERTEXT12X3__}',
'summary{__HEADING_SHORT__}+ul>li%3,5%{__MESSAGE__}',
'summary{__HEADING_SHORT__}+ol>li%3,5%{__MESSAGE__}'
]);
macroMap.set('blog-article', [
'article>(%blog-header%)+(%blog-post%)+(%sns-button-list%)+(%blog-footer%)+(%blog-comment%)+'
]);
macroMap.set('blog-header', [
'h3{__HEADING__}'
]);
macroMap.set('blog-post', [
'section>h4{__HEADING__}+p{__MESSAGE__}+(%photo@0%)',
'section>h4{__HEADING__}+p%2,4%{__MESSAGE__}+(%photo@0%)'
]);
macroMap.set('blog-comment', [
'div>(%blog-comment-item%)%+2,5%'
]);
macroMap.set('blog-comment-item', [
'article>h6{__DIGEST__}+p{__COMMENT__}+(%blog-footer%)',
'article>h6{__DIGEST__}+p%2,4%{__COMMENT__}+(%blog-footer%)',
'article>h6{__DIGEST__}+p{__COMMENT__}+(%photo@0%)+(%blog-footer%)'
]);
macroMap.set('blog-footer', [
'footer>p>{Posted on}+(%time%)+{by __NAME__}'
]);
macroMap.set('time', [
'time[datetime=__DATETIME__]{__DATE__}',
]);
macroMap.set('table', [
'table>(thead>tr>th*3{item$})+(tbody>tr%3,5%>td*3>{__PHRASE__})',
'table>caption{__DIGEST__}+(thead>tr>th*4{item$})+(tbody>tr%3,5%>td*4>{__PHRASE__})'
]);
macroMap.set('grid', [
'div._x-grid-3>(%card%)%4,8%',
'div._x-grid-4>(%card%)%4,8%'
]);
macroMap.set('grid-repeat', [
'div>(div>h3{__PHRASE__}+(%grid%))%+2,3%'
]);
macroMap.set('card', [
'div>(%thumbnail%)+div>(h6{__PHRASE__}+p{__DIGEST__}+p{$99.99})',
'div>(%thumbnail%)+div>(h5{__HEADING__}+p{__MESSAGE__}+div>(%link-text%))',
'div>(%thumbnail%)+div>(h5{__HEADING__}+p>{__MESSAGE__ }+(%link-icon%))',
'div>(%thumbnail%)+p{__MESSAGE__}+div>(%link-text%)',
'div>(%thumbnail%)+p>{__MESSAGE__ }+(%link-icon%)',
'div>(%thumbnail%)+p{__MESSAGE__ }+div>(%time%)'
]);
macroMap.set('link-text', [
'a[href=page$.html]>{__PHRASE__}',
]);
macroMap.set('link-icon', [
'a._x-link[href=page$.html]>{__PHRASE__}',
'a._x-ext-link[href=page$.html]>{__PHRASE__}'
]);
macroMap.set('sns-button-list', [
'div>(%sns-button@0%)+(%sns-button@1%)+(%sns-button@2%)'
]);
macroMap.set('sns-button', [
'div>button[type=button]>i._x-like-icon+span{Like}',
'div>button[type=button]>i._x-comment-icon+span{Comment}',
'div>button[type=button]>i._x-share-icon+span{Share}'
]);