File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,7 @@ def auto_anchor(content)
16
16
## No match, pass item through unchanged
17
17
string
18
18
else
19
- ## Remove double-quotes from titles before attempting to slugify
20
- title . gsub! ( '"' , '' )
21
- ## Use Liquid/Jekyll slugify filter to choose our id
22
- slug = "\# {{ \" #{ title } \" | slugify: 'latin' }}"
19
+ slug = generate_slug ( title )
23
20
id_prefix = "- {:#{ slug } .anchor-list} <a href=\" #{ slug } \" class=\" anchor-list-link\" >●</a>"
24
21
string . sub! ( /-/ , id_prefix )
25
22
end
Original file line number Diff line number Diff line change
1
+ def generate_slug ( title )
2
+ ## Remove double-quotes from titles before attempting to slugify
3
+ title . gsub! ( '"' , '' )
4
+ ## Use Liquid/Jekyll slugify filter to choose our id
5
+ liquid_string = "\# {{ \" #{ title } \" | slugify: 'latin' }}"
6
+ slug = Liquid ::Template . parse ( liquid_string )
7
+ # An empty context is used here because we only need to parse the liquid
8
+ # string and don't require any additional variables or data.
9
+ slug . render ( Liquid ::Context . new )
10
+ end
Original file line number Diff line number Diff line change @@ -30,17 +30,6 @@ def generate(site)
30
30
end
31
31
end
32
32
33
- def generate_slug ( title )
34
- ## Remove double-quotes from titles before attempting to slugify
35
- title . gsub! ( '"' , '' )
36
- ## Use Liquid/Jekyll slugify filter to choose our id
37
- liquid_string = "\# {{ \" #{ title } \" | slugify: 'latin' }}"
38
- slug = Liquid ::Template . parse ( liquid_string )
39
- # An empty context is used here because we only need to parse the liquid
40
- # string and don't require any additional variables or data.
41
- slug . render ( Liquid ::Context . new )
42
- end
43
-
44
33
def find_title ( string , in_list = true , slugify = true )
45
34
# this conditional prefix is for the special case of the review club section
46
35
# which is not a list item (no dash (-) at the start of the line)
You can’t perform that action at this time.
0 commit comments