File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 4
4
5
5
{% capture imageURL %}{{ page.image_base }}{{ item.file }}.png{% endcapture %}
6
6
{% capture imageURLRetina %}{{ page.image_base }}{{ item.file }}@2x.png{% endcapture %}
7
- {% capture captionText %}{{ item.caption | markdownify }}{% endcapture %}
7
+ {% capture captionText %}{{ item.caption | no_runts | markdownify }}{% endcapture %}
8
8
9
9
{% include picture.html
10
10
image = imageURL
Original file line number Diff line number Diff line change 1
1
module Jekyll
2
2
module RuntFilter
3
3
def no_runts ( title )
4
- if title . strip . count ( " " ) >= 2
5
- firstPart = title . split [ 0 ...-1 ] . join ( " " )
6
- lastOpen = firstPart . rindex ( "<" )
4
+ if ( title )
5
+ if title . strip . count ( " " ) >= 2
6
+ firstPart = title . split [ 0 ...-1 ] . join ( " " )
7
+ lastOpen = firstPart . rindex ( "<" )
7
8
8
- if lastOpen
9
- title . strip
9
+ if lastOpen
10
+ title . strip
11
+ else
12
+ title . split [ 0 ...-1 ] . join ( " " ) + " #{ title . split [ -1 ] } "
13
+ end
10
14
else
11
- title . split [ 0 ...- 1 ] . join ( " " ) + " #{ title . split [ - 1 ] } "
15
+ title . strip
12
16
end
13
17
else
14
- title . strip
18
+ title
15
19
end
16
20
end
17
21
end
You can’t perform that action at this time.
0 commit comments