jekyll-antex 0.2.1 → 0.2.2

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: 553f4c0d44882189f00df7ae6fb95e0827704911
4
- data.tar.gz: 8d0cffbad462c99b0a4ad4f7584fab40447d3c8a
3
+ metadata.gz: a1cc97e98e01d13964af2cbe1a631ea2be276310
4
+ data.tar.gz: 5e35ad685f11471225ec8d312c35ee5b90a511d7
5
5
  SHA512:
6
- metadata.gz: 69f518f1a6cfc6fefc5116c78bd648bd7ae2c225f758a7907723f94814e23a616464e220c68610eed5fbe985641b1c25b6dcf854bd5c1f3548df3581e3026f14
7
- data.tar.gz: 14522ee88531da366891a6a3386f6eb0435f5415ed5ecbe5ada60496b4cb4c8a9a234ac8371553b044340b46158eb54c9edfd4e5f00e8ccba58074088900a446
6
+ metadata.gz: 78342e277b2b021777af53d0ed3ed6cf82f4ab3ec3ba956a7693d8a69f1b5f51a5640e1563812ec8ceb2a75a6f51e5a53c6b89014d6074c835ce904d0bda6732
7
+ data.tar.gz: 763468d9eb428a6294a0fef1a73b43eb1ae913604e7215cfc51283e1f6052d5b94559bd20b95a13c572957799affffe1412fbf4c4a78f2602cc59935df27503c
@@ -7,17 +7,27 @@ module Jekyll
7
7
  class Alias
8
8
  class InvalidRegexp < Error; end
9
9
 
10
- attr_reader :priority, :regexp, :options
10
+ attr_reader :priority, :regexp, :multiline, :options
11
11
 
12
- def initialize(priority:, regexp:, options: {})
12
+ def initialize(priority:, options: {},
13
+ regexp:, multiline: false, extended: true)
13
14
  @priority = priority.to_i
14
- @regexp = Regexp.new regexp
15
+ @regexp = build_regexp source: regexp,
16
+ extended: extended,
17
+ multiline: multiline
15
18
  validate_regexp!
16
19
  @options = options.to_h
17
20
  end
18
21
 
19
22
  private
20
23
 
24
+ def build_regexp(source:, extended:, multiline:)
25
+ options = 0
26
+ options |= Regexp::EXTENDED if extended
27
+ options |= Regexp::MULTILINE if multiline
28
+ Regexp.new source, options
29
+ end
30
+
21
31
  def validate_regexp!
22
32
  return if @regexp.names.include? 'code'
23
33
  raise InvalidRegexp, <<~MESSAGE
@@ -78,19 +78,28 @@ aliases:
78
78
  # it is the liquid tag all other aliases are rendered to.
79
79
  internal:
80
80
  priority: 1000
81
- regexp: !ruby/regexp
82
- /{%\s*antex\s*(?<markup>.*?)%}(?<code>.*?){%\s*endantex\s*%}/m
81
+ multiline: true
82
+ regexp: >
83
+ {%\s*antex\s*(?<markup>.*?)%}
84
+ (?<code>.*?)
85
+ {%\s*endantex\s*%}
83
86
  # 'default' is the standard generic purpose alias.
84
87
  # Since it can contain tikz pictures,
85
88
  # it must have higher priority than 'tikzpicture' alias.
86
89
  default:
87
90
  priority: 100
88
- regexp: !ruby/regexp
89
- /{%\s*tex\s*(?<markup>.*?)%}(?<code>.*?){%\s*endtex\s*%}/m
91
+ multiline: true
92
+ regexp: >
93
+ {%\s*tex\s*(?<markup>.*?)%}
94
+ (?<code>.*?)
95
+ {%\s*endtex\s*%}
90
96
  tikzpicture:
91
97
  priority: 90
92
- regexp: !ruby/regexp
93
- /{%\s*tikz\s*(?<markup>.*?)%}(?<code>.*?){%\s*endtikz\s*%}/m
98
+ multiline: true
99
+ regexp: >
100
+ {%\s*tikz\s*(?<markup>.*?)%}
101
+ (?<code>.*?)
102
+ {%\s*endtikz\s*%}
94
103
  options:
95
104
  prepend: '\\begin{tikzpicture}'
96
105
  append: '\\end{tikzpicture}'
@@ -99,14 +108,19 @@ aliases:
99
108
  # since the respective deliniters are double and single dollars.
100
109
  display_math:
101
110
  priority: 20
102
- regexp: !ruby/regexp /\$\$(?<code>.*?)\$\$/m
111
+ multiline: true
112
+ regexp: >
113
+ \$\$
114
+ (?<code>.*?)
115
+ \$\$
103
116
  options:
104
117
  prepend: '$\\displaystyle'
105
118
  append: $
106
119
  classes: [antex, display]
107
120
  inline_math:
108
121
  priority: 10
109
- regexp: !ruby/regexp /\$(?<code>.*?)\$/
122
+ regexp: >
123
+ \$(?<code>.*?)\$
110
124
  options:
111
125
  prepend: $
112
126
  append: $
@@ -115,6 +129,7 @@ aliases:
115
129
  # to avoid interference with others aliases.
116
130
  inline_macro:
117
131
  priority: 0
118
- regexp: !ruby/regexp /(?<code>\\[A-z]+)/
132
+ regexp: >
133
+ (?<code>\\[A-z]+)
119
134
  options:
120
135
  classes: [antex, inline]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Antex
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-antex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Brasolin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-01 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll