@@ -16,7 +16,7 @@ import (
16
16
var multipleSpacesR = regexp .MustCompile (` +` )
17
17
18
18
var commonmark = []Rule {
19
- Rule {
19
+ {
20
20
Filter : []string {"ul" , "ol" },
21
21
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
22
22
parent := selec .Parent ()
@@ -42,7 +42,7 @@ var commonmark = []Rule{
42
42
return & content
43
43
},
44
44
},
45
- Rule {
45
+ {
46
46
Filter : []string {"li" },
47
47
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
48
48
if strings .TrimSpace (content ) == "" {
@@ -68,7 +68,7 @@ var commonmark = []Rule{
68
68
return String (prefix + content + "\n " )
69
69
},
70
70
},
71
- Rule {
71
+ {
72
72
Filter : []string {"#text" },
73
73
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
74
74
text := selec .Text ()
@@ -85,7 +85,7 @@ var commonmark = []Rule{
85
85
return & text
86
86
},
87
87
},
88
- Rule {
88
+ {
89
89
Filter : []string {"p" , "div" },
90
90
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
91
91
parent := goquery .NodeName (selec .Parent ())
@@ -101,7 +101,7 @@ var commonmark = []Rule{
101
101
return & content
102
102
},
103
103
},
104
- Rule {
104
+ {
105
105
Filter : []string {"h1" , "h2" , "h3" , "h4" , "h5" , "h6" },
106
106
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
107
107
if strings .TrimSpace (content ) == "" {
@@ -141,7 +141,7 @@ var commonmark = []Rule{
141
141
return & text
142
142
},
143
143
},
144
- Rule {
144
+ {
145
145
Filter : []string {"strong" , "b" },
146
146
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
147
147
// only use one bold tag if they are nested
@@ -162,7 +162,7 @@ var commonmark = []Rule{
162
162
return & trimmed
163
163
},
164
164
},
165
- Rule {
165
+ {
166
166
Filter : []string {"i" , "em" },
167
167
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
168
168
// only use one italic tag if they are nested
@@ -183,7 +183,7 @@ var commonmark = []Rule{
183
183
return & trimmed
184
184
},
185
185
},
186
- Rule {
186
+ {
187
187
Filter : []string {"img" },
188
188
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
189
189
alt := selec .AttrOr ("alt" , "" )
@@ -209,7 +209,7 @@ var commonmark = []Rule{
209
209
return & text
210
210
},
211
211
},
212
- Rule {
212
+ {
213
213
Filter : []string {"a" },
214
214
AdvancedReplacement : func (content string , selec * goquery.Selection , opt * Options ) (AdvancedResult , bool ) {
215
215
// if there is no href, no link is used. So just return the content inside the link
@@ -270,7 +270,7 @@ var commonmark = []Rule{
270
270
return AdvancedResult {Markdown : replacement , Footer : reference }, false
271
271
},
272
272
},
273
- Rule {
273
+ {
274
274
Filter : []string {"code" },
275
275
Replacement : func (_ string , selec * goquery.Selection , opt * Options ) * string {
276
276
content := selec .Text ()
@@ -280,7 +280,7 @@ var commonmark = []Rule{
280
280
return & text
281
281
},
282
282
},
283
- Rule {
283
+ {
284
284
Filter : []string {"pre" },
285
285
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
286
286
codeElement := selec .Find ("code" )
@@ -301,20 +301,20 @@ var commonmark = []Rule{
301
301
return & text
302
302
},
303
303
},
304
- Rule {
304
+ {
305
305
Filter : []string {"hr" },
306
306
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
307
307
text := "\n \n " + opt .HorizontalRule + "\n \n "
308
308
return & text
309
309
},
310
310
},
311
- Rule {
311
+ {
312
312
Filter : []string {"br" },
313
313
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
314
314
return String ("\n \n " )
315
315
},
316
316
},
317
- Rule {
317
+ {
318
318
Filter : []string {"blockquote" },
319
319
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
320
320
content = strings .TrimSpace (content )
@@ -331,7 +331,7 @@ var commonmark = []Rule{
331
331
return & text
332
332
},
333
333
},
334
- Rule {
334
+ {
335
335
Filter : []string {"noscript" },
336
336
Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
337
337
// for now remove the contents of noscript. But in the future we could
0 commit comments