daimon-markdown 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/lib/daimon/markdown/filter/plugin.rb +1 -0
- data/lib/daimon/markdown/redcarpet/html_renderer.rb +12 -2
- data/lib/daimon/markdown/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff20c01e34584946a115276b997d78505820a88
|
4
|
+
data.tar.gz: c7d557edcc62ec6ebde33bfa669be2033e0c9053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1e21e1cd6ebadef92dcfdfb11b1baefb92da4c8e20208ae74f90e801722dbf771a4ee6332063e24559adfc083284595ccc6a139c3298d7319e5b2f33c8e381
|
7
|
+
data.tar.gz: 8fbe830c68dfd476b6f8e9d1479a7c3eef613e9743fc82f117553e63dc83795f9fa2c518835f4dcb6432b55da1a20531b01f209c5f577c3b8d2a8a003bc029db
|
data/.rubocop.yml
CHANGED
@@ -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
|
-
|
16
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|