Class: QED::Document::Markup
- Inherits:
-
Object
- Object
- QED::Document::Markup
- Defined in:
- lib/qed/document/markup.rb
Overview
QED Document Markup
QED Document Markup is based on RDoc’s SimpleMarkup format but adds some additional features.
-
‘[no-spaces]` produces
[no-space]
.
Defined Under Namespace
Classes: ToHTML
Instance Method Summary collapse
- #formatter ⇒ Object
-
#initialize(text, options = {}) ⇒ Markup
constructor
A new instance of Markup.
- #parser ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(text, options = {}) ⇒ Markup
Returns a new instance of Markup.
16 17 18 |
# File 'lib/qed/document/markup.rb', line 16 def initialize(text, ={}) @text = text end |
Instance Method Details
#formatter ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/qed/document/markup.rb', line 35 def formatter @formatter ||= ( f = ToHTML.new #f.add_tag(:STRIKE, "<strike>", "</strike>") f ) end |
#parser ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/qed/document/markup.rb', line 24 def parser @parser ||= ( p = SM::SimpleMarkup.new #p.add_word_pair("{", "}", :STRIKE) #p.add_html("no", :STRIKE) #p.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD) p.add_special(/\`(\S+?)\`/, :CODE) p ) end |
#to_html ⇒ Object
20 21 22 |
# File 'lib/qed/document/markup.rb', line 20 def to_html parser.convert(@text, formatter) end |