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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d00d156afb454e19ed03a65df0ca287906ca26e
4
- data.tar.gz: edd96d251836758e95355667b5e7abd8fb15d81e
3
+ metadata.gz: b11bc636bb88bb2f95c420592024180796f6c56b
4
+ data.tar.gz: e865299aa26679412d45a6fa92f4692a82d0c8f7
5
5
  SHA512:
6
- metadata.gz: 3e87b455e0ebfdbd147145a7423ff9e7dbf957443b5f8ef126077b73a757acf0499a048b2337c07e43a51efac4f1b23611a5d526cc2ee566229ece5c1f0ad9bf
7
- data.tar.gz: 688e4ffcba894f5beac42dad912c2778377850ac8c74939690db94e126042765ab1a4a5e2c58082ee3b2c98fb438c98dba61817401065fd1d1a0e604699986c4
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 = $5
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>&lt;<em>#{tag}</em></b>#{attributes}<b>#{xml_close_tag}&gt;</b>)
19
20
  end
20
21
  code.gsub! %r(&lt;/([a-z\-]+[1-6]?)&gt;) do
21
- %Q(<b>&lt;/<em>#{$1}</em>&gt;</b>)
22
+ tag = $1
23
+ %Q(<b>&lt;/<em>#{tag}</em>&gt;</b>)
22
24
  end
23
25
  code
24
26
  end
@@ -1,4 +1,4 @@
1
1
  module MiniSyntax
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
4
4
 
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
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-06 00:00:00.000000000 Z
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: