Skip to content
This repository
Browse code

Moved highlighters config settings under filter.*

  • Loading branch information...
commit eaf109b17f4c9b2e7c328fb592e2b0a6f1cb16f2 1 parent 0513c0f
Fabio Cevasco authored
4 book/config.yml
... ... @@ -1,8 +1,4 @@
1 1 ---
2   -:highlighters:
3   - :current: ultraviolet
4   - :ultraviolet:
5   - :theme: blackboard
6 2 :document:
7 3 :output: html
8 4 :title: Glyph
34 config.yml
@@ -11,6 +11,22 @@
11 11 :set: 'glyph' # xml, core, filters
12 12 :options:
13 13 :xml_fallback: true
  14 +:tools:
  15 + :pdf_generator: 'prince'
  16 +:filters:
  17 + :by_file_extension: true
  18 + :highlighter: 'coderay'
  19 + :target: 'html'
  20 + :markdown:
  21 + :converter: 'bluecloth'
  22 + :redcloth:
  23 + :restrictions: []
  24 + :coderay:
  25 + # See options at http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html
  26 + :css: :class
  27 + :ultraviolet:
  28 + :line_numbers: false
  29 + :theme: 'blackboard'
14 30 :system:
15 31 :quiet: false
16 32 :output_targets: [:html, :pdf]
@@ -61,21 +77,3 @@
61 77 - :index
62 78 - :lot
63 79 - :lof
64   -:tools:
65   - :pdf_generator: 'prince'
66   -:highlighters:
67   - :target: 'html'
68   - :current: 'coderay'
69   - :coderay:
70   - # See options at http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html
71   - :css: :class
72   - :ultraviolet:
73   - :line_numbers: false
74   - :theme: 'blackboard'
75   -:filters:
76   - :by_file_extension: true
77   - :target: 'html'
78   - :markdown:
79   - :converter: 'bluecloth'
80   - :redcloth:
81   - :restrictions: []
10 macros/filters.rb
@@ -76,7 +76,7 @@
76 76 lang = param(0)
77 77 text = param(1)
78 78 text.gsub!(/\\(.)/){$1}
79   - highlighter = Glyph["highlighters.current"].to_sym rescue nil
  79 + highlighter = Glyph["filters.highlighter"].to_sym rescue nil
80 80 begin
81 81 raise LoadError unless highlighter
82 82 if highlighter.to_s.match(/^(uv|ultraviolet)$/) then
@@ -98,12 +98,12 @@
98 98 end
99 99 end
100 100 Glyph["highlighter.current"] = highlighter
101   - target = Glyph["highlighters.target"]
  101 + target = Glyph["filters.target"]
102 102 result = ""
103 103 case highlighter.to_sym
104 104 when :coderay
105 105 begin
106   - result = CodeRay.scan(text, lang).div(Glyph["highlighters.coderay"])
  106 + result = CodeRay.scan(text, lang).div(Glyph["filters.coderay"])
107 107 rescue Exception => e
108 108 macro_error e.message
109 109 end
@@ -111,8 +111,8 @@
111 111 begin
112 112 target = 'xhtml' if target == 'html'
113 113 result = Uv.parse(text.to_s, target.to_s, lang.to_s,
114   - Glyph["highlighters.ultraviolet.line_numbers"],
115   - Glyph["highlighters.ultraviolet.theme"].to_s)
  114 + Glyph["filters.ultraviolet.line_numbers"],
  115 + Glyph["filters.ultraviolet.theme"].to_s)
116 116 rescue Exception => e
117 117 macro_error e.message
118 118 end
2  spec/macros/filters_spec.rb
@@ -60,7 +60,7 @@
60 60 uv_result = %{<pre class=\"iplastic\"><span class=\"Keyword\">def</span>
61 61 <span class=\"FunctionName\">test_method</span>(<span class=\"Arguments\">a<span class=\"Arguments\">,</span> b</span>)
62 62 puts a<span class=\"Keyword\">+</span>b <span class=\"Keyword\">end</span> </pre>}
63   - Glyph['highlighters.ultraviolet.theme'] = 'iplastic'
  63 + Glyph['filters.ultraviolet.theme'] = 'iplastic'
64 64 check = lambda do |hl, result|
65 65 Glyph["highlighters.current"] = hl
66 66 Glyph.debug_mode = true

0 comments on commit eaf109b

Please sign in to comment.
Something went wrong with that request. Please try again.