html-pipeline-linuxfr 0.14.20 → 0.14.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 112b5a5d5a6d826dc3ce062a9172d977871f12e9
4
- data.tar.gz: 52340f219a59dfd5cce96d2ff5b986be8459778a
3
+ metadata.gz: 73401549a3b0fe54fe2e05bec94d4bd169dcb3d4
4
+ data.tar.gz: 70b04dea06fcb0af6066fd4e6589dfe8f8f4314d
5
5
  SHA512:
6
- metadata.gz: 1d001eba677e4040fb8004e336bcd27d4c32a2921a606a8572e3f5a065d896c040baccc7efdd69b025f8682567246c3ef6249079114c5eb93124a7099d9bc643
7
- data.tar.gz: 8d994ee410b2abb22555b95a75ac01925000e9f634645c5edcfeb6a6317c26d36065b045f7ea96e95c94700afb17f10b33464ef15fd9a2fde4ad2d631617df79
6
+ metadata.gz: cc19dbac013e43698d510d93f7374a814aa3a8d5bbf4d341d2d10477dda0ed8a8641ec588ab4a25e9bb2df27e6262b99aaba7d61b044565c921b13c49b39f981
7
+ data.tar.gz: 83da5ac6c1b502399dcaaeacd92dd67f0ba13351101d85aa849e0017145c392ea43a0cd10997a7b7efc36d688b149b88426ebd7dede789459fb7d752532fedf0
@@ -8,6 +8,12 @@ module HTML
8
8
  class SVGTeX
9
9
 
10
10
  class PreFilter < TextFilter
11
+ BLOCK_SVGTEX = /^\$\$([^$]+)\$\$\s*$/
12
+ INLINE_SVGTEX = /(?<!\p{Word})\$([^$\n]+)\$(?!\p{Word})/
13
+ INDENTED_CODE = /(\A|\n\r?\n)(((\t|\s{4}).*(\n|\Z))+)(\r?\n|\Z)/
14
+ FENCED_CODE = /^``` ?(.*?)\r?\n(.+?)\r?\n```\r?$/m
15
+ INLINE_CODE = /`(.*)`/
16
+
11
17
  def initialize(text, context = nil, result = nil)
12
18
  super text, context, result
13
19
  @text = @text.gsub "\r", ''
@@ -18,12 +24,12 @@ module HTML
18
24
  def call
19
25
  extract_fenced_code!
20
26
  extract_indented_code!
21
- @text.gsub!(/^\$\$([^$]+)\$\$\s*$/) do
27
+ @text.gsub!(BLOCK_SVGTEX) do
22
28
  "\n\n```mathjax\n\\displaystyle{#{$1.gsub "\\", "\\\\\\\\"}}\n```\n\n"
23
29
  end
24
30
  extract_fenced_code!
25
31
  extract_inline_code!
26
- @text.gsub!(/\b\$([^$\n]+)\$\b/) do
32
+ @text.gsub!(INLINE_SVGTEX) do
27
33
  "`{mathjax} #{$1}`"
28
34
  end
29
35
  reinsert_code!
@@ -31,7 +37,7 @@ module HTML
31
37
  end
32
38
 
33
39
  def extract_inline_code!
34
- @text.gsub!(/`(.*)`/) do
40
+ @text.gsub!(INLINE_CODE) do
35
41
  id = Digest::SHA1.hexdigest($1)
36
42
  @inline[id] = $1
37
43
  id
@@ -39,7 +45,7 @@ module HTML
39
45
  end
40
46
 
41
47
  def extract_indented_code!
42
- @text.gsub!(/(\A|\n\r?\n)(((\t|\s{4}).*(\n|\Z))+)(\r?\n|\Z)/) do
48
+ @text.gsub!(INDENTED_CODE) do
43
49
  code = $2.gsub(/^(\t|\s{4})/, '').sub(/\r?\n\Z/, '')
44
50
  id = Digest::SHA1.hexdigest(code)
45
51
  @codemap[id] = { :code => code }
@@ -49,7 +55,7 @@ module HTML
49
55
 
50
56
  # Code taken from gollum (http://github.com/github/gollum)
51
57
  def extract_fenced_code!
52
- @text.gsub!(/^``` ?(.*?)\r?\n(.+?)\r?\n```\r?$/m) do
58
+ @text.gsub!(FENCED_CODE) do
53
59
  id = Digest::SHA1.hexdigest($2)
54
60
  @codemap[id] = { :lang => $1, :code => $2 }
55
61
  id
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class Pipeline
3
- VERSION = "0.14.20"
3
+ VERSION = "0.14.21"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-linuxfr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.20
4
+ version: 0.14.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko