Permalink
Browse files

Moved highlighters config settings under filter.*

  • Loading branch information...
1 parent 0513c0f commit eaf109b17f4c9b2e7c328fb592e2b0a6f1cb16f2 @h3rald committed Jun 3, 2010
Showing with 22 additions and 28 deletions.
  1. +0 −4 book/config.yml
  2. +16 −18 config.yml
  3. +5 −5 macros/filters.rb
  4. +1 −1 spec/macros/filters_spec.rb
View
4 book/config.yml
@@ -1,8 +1,4 @@
---
-:highlighters:
- :current: ultraviolet
- :ultraviolet:
- :theme: blackboard
:document:
:output: html
:title: Glyph
View
34 config.yml
@@ -11,6 +11,22 @@
:set: 'glyph' # xml, core, filters
:options:
:xml_fallback: true
+:tools:
+ :pdf_generator: 'prince'
+:filters:
+ :by_file_extension: true
+ :highlighter: 'coderay'
+ :target: 'html'
+ :markdown:
+ :converter: 'bluecloth'
+ :redcloth:
+ :restrictions: []
+ :coderay:
+ # See options at http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html
+ :css: :class
+ :ultraviolet:
+ :line_numbers: false
+ :theme: 'blackboard'
:system:
:quiet: false
:output_targets: [:html, :pdf]
@@ -61,21 +77,3 @@
- :index
- :lot
- :lof
-:tools:
- :pdf_generator: 'prince'
-:highlighters:
- :target: 'html'
- :current: 'coderay'
- :coderay:
- # See options at http://coderay.rubychan.de/doc/classes/CodeRay/Encoders/HTML.html
- :css: :class
- :ultraviolet:
- :line_numbers: false
- :theme: 'blackboard'
-:filters:
- :by_file_extension: true
- :target: 'html'
- :markdown:
- :converter: 'bluecloth'
- :redcloth:
- :restrictions: []
View
10 macros/filters.rb
@@ -76,7 +76,7 @@
lang = param(0)
text = param(1)
text.gsub!(/\\(.)/){$1}
- highlighter = Glyph["highlighters.current"].to_sym rescue nil
+ highlighter = Glyph["filters.highlighter"].to_sym rescue nil
begin
raise LoadError unless highlighter
if highlighter.to_s.match(/^(uv|ultraviolet)$/) then
@@ -98,21 +98,21 @@
end
end
Glyph["highlighter.current"] = highlighter
- target = Glyph["highlighters.target"]
+ target = Glyph["filters.target"]
result = ""
case highlighter.to_sym
when :coderay
begin
- result = CodeRay.scan(text, lang).div(Glyph["highlighters.coderay"])
+ result = CodeRay.scan(text, lang).div(Glyph["filters.coderay"])
rescue Exception => e
macro_error e.message
end
when :ultraviolet
begin
target = 'xhtml' if target == 'html'
result = Uv.parse(text.to_s, target.to_s, lang.to_s,
- Glyph["highlighters.ultraviolet.line_numbers"],
- Glyph["highlighters.ultraviolet.theme"].to_s)
+ Glyph["filters.ultraviolet.line_numbers"],
+ Glyph["filters.ultraviolet.theme"].to_s)
rescue Exception => e
macro_error e.message
end
View
2 spec/macros/filters_spec.rb
@@ -60,7 +60,7 @@
uv_result = %{<pre class=\"iplastic\"><span class=\"Keyword\">def</span>
<span class=\"FunctionName\">test_method</span>(<span class=\"Arguments\">a<span class=\"Arguments\">,</span> b</span>)
puts a<span class=\"Keyword\">+</span>b <span class=\"Keyword\">end</span> </pre>}
- Glyph['highlighters.ultraviolet.theme'] = 'iplastic'
+ Glyph['filters.ultraviolet.theme'] = 'iplastic'
check = lambda do |hl, result|
Glyph["highlighters.current"] = hl
Glyph.debug_mode = true

0 comments on commit eaf109b

Please sign in to comment.