minisyntax 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minisyntax/highlighter/html.rb +6 -4
- data/lib/minisyntax/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: b11bc636bb88bb2f95c420592024180796f6c56b
|
4
|
+
data.tar.gz: e865299aa26679412d45a6fa92f4692a82d0c8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d922d6192ab16639a6d81644cb089eab7e1265e2a62af1e3e0b83c7bbf12af55d2e5b9b084045ca6371f724244a33885351bdb284a0b3a64779851637e0b4c8
|
7
|
+
data.tar.gz: b7d2eada5a89ee6143cc934e81e4f16d1d972e063b947e25f59a9d6b873e67004d6026627730b762c168d83a11c7ca2e206421b2641b0670f02a9a9d8942ebd1
|
@@ -2,13 +2,14 @@ module MiniSyntax
|
|
2
2
|
module Highlighter
|
3
3
|
module HTML
|
4
4
|
def self.highlight(code)
|
5
|
+
code = "#{code}"
|
5
6
|
code.gsub! %r((<script( [a-z\-]+(=("|'|\w).*?\4)?)*>)(.*?)(</script>))m do
|
6
7
|
%Q(#{$1}#{MiniSyntax.highlight($5, :javascript)}#{$6})
|
7
8
|
end
|
8
|
-
code.gsub! %r(<([a-z\-]+[1-6]?)(( [a-z\-]+(=".*?")?)*)( /)?>)m do
|
9
|
+
code.gsub! %r(<([a-z\-]+[1-6]?)(( [a-z\-]+(=("|").*?("|"))?)*)( /)?>)m do
|
9
10
|
tag = $1
|
10
|
-
xml_close_tag = $
|
11
|
-
attributes = $2.gsub %r( ([a-z\-]+)(=(")(.*?)("))?)m do
|
11
|
+
xml_close_tag = $7
|
12
|
+
attributes = $2.gsub %r( ([a-z\-]+)(=("|")(.*?)("|"))?)m do
|
12
13
|
if %(onload onclick onmouseover onmousemove onmouseout onfocus onblur onkeyup onkeydown onkeypress).include?($1)
|
13
14
|
%Q( <b>#{$1}</b>=#{$3}#{MiniSyntax.highlight($4, :javascript)}#{$3})
|
14
15
|
else
|
@@ -18,7 +19,8 @@ module MiniSyntax
|
|
18
19
|
%Q(<b><<em>#{tag}</em></b>#{attributes}<b>#{xml_close_tag}></b>)
|
19
20
|
end
|
20
21
|
code.gsub! %r(</([a-z\-]+[1-6]?)>) do
|
21
|
-
|
22
|
+
tag = $1
|
23
|
+
%Q(<b></<em>#{tag}</em>></b>)
|
22
24
|
end
|
23
25
|
code
|
24
26
|
end
|
data/lib/minisyntax/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minisyntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nico Hagenburger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple powerful syntax highlighter with minimal HTML output
|
14
14
|
email:
|