daimon-markdown 0.2.3 → 0.2.4

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: ae2b9dff7997d143c95688d83ff1a686cfe450e8
4
- data.tar.gz: 5b4fdadec971299edc9c05f21086f3f18c3369ef
3
+ metadata.gz: aff20c01e34584946a115276b997d78505820a88
4
+ data.tar.gz: c7d557edcc62ec6ebde33bfa669be2033e0c9053
5
5
  SHA512:
6
- metadata.gz: b071d5ace5504e2aecc999e3e0f4c7c119cb5a04c88ed5cf50b353425955e197c294c91ac702eb8a5b5a4211bbd53ed9d695a6b91ce1de0cdf73173c91b99d1f
7
- data.tar.gz: 5e0eb9b3cdf96ad696586d3c6add8634e6b50578fbff2332f6bad5f47ddfe9c68d239e4257dbc71e41278e2614826f242b5977b354c8cb9e9028d171ed49af8d
6
+ metadata.gz: 2f1e21e1cd6ebadef92dcfdfb11b1baefb92da4c8e20208ae74f90e801722dbf771a4ee6332063e24559adfc083284595ccc6a139c3298d7319e5b2f33c8e381
7
+ data.tar.gz: 8fbe830c68dfd476b6f8e9d1479a7c3eef613e9743fc82f117553e63dc83795f9fa2c518835f4dcb6432b55da1a20531b01f209c5f577c3b8d2a8a003bc029db
data/.rubocop.yml CHANGED
@@ -29,6 +29,8 @@ Style/FrozenStringLiteralComment:
29
29
  Enabled: false
30
30
  Style/StringLiterals:
31
31
  EnforcedStyle: double_quotes
32
+ Style/IfUnlessModifier:
33
+ Enabled: false
32
34
  Style/TrailingCommaInLiteral:
33
35
  Enabled: false
34
36
  Style/TrailingCommaInArguments:
@@ -6,6 +6,7 @@ module Daimon
6
6
  class Plugin < ::HTML::Pipeline::Filter
7
7
  def call
8
8
  doc.search(".//text()").each do |node|
9
+ next if node.parent.name == "code" # skip code block
9
10
  result[:plugins] = []
10
11
  node.to_s.scan(/{{(.+?)}}/m) do |str|
11
12
  parser = Daimon::Markdown::Parser.new(str[0])
@@ -1,3 +1,4 @@
1
+ require "rouge"
1
2
  require "rouge/plugins/redcarpet"
2
3
 
3
4
  module Daimon
@@ -12,12 +13,21 @@ module Daimon
12
13
  end
13
14
 
14
15
  def preprocess(full_document)
15
- full_document.scan(/{{.+?}}/m) do |m|
16
- @plugins << m
16
+ scanner = StringScanner.new(full_document)
17
+ loop do
18
+ break if scanner.eos?
19
+ if scanner.match?(/{{.+?}}/m)
20
+ @plugins << scanner.matched
21
+ scanner.pos += scanner.matched_size
22
+ else
23
+ scanner.getch
24
+ end
17
25
  end
26
+ full_document
18
27
  end
19
28
 
20
29
  def postprocess(full_document)
30
+ return full_document if @plugins.empty?
21
31
  document = ""
22
32
  scanner = StringScanner.new(full_document)
23
33
  loop do
@@ -1,5 +1,5 @@
1
1
  module Daimon
2
2
  module Markdown
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daimon-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - daimon developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline