Class: Hemingway::Build
- Inherits:
-
Object
- Object
- Hemingway::Build
- Defined in:
- lib/hemingway/build.rb
Overview
This is a moronic little class to generate some HTML Tags around some content.
Class Method Summary collapse
-
.accent(character, accent) ⇒ Object
return the accented character or just the character if no match.
- .symbol(symbol) ⇒ Object
- .tag(html_attribute, html_content = nil, options = {}) ⇒ Object
Class Method Details
.accent(character, accent) ⇒ Object
return the accented character or just the character if no match.
25 26 27 |
# File 'lib/hemingway/build.rb', line 25 def self.accent(character, accent) character_accent_to_html[character] and character_accent_to_html[character][accent] or character end |
.symbol(symbol) ⇒ Object
20 21 22 |
# File 'lib/hemingway/build.rb', line 20 def self.symbol(symbol) latex_sym_to_html[symbol] end |
.tag(html_attribute, html_content = nil, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hemingway/build.rb', line 6 def self.tag(html_attribute, html_content=nil, ={}) String.new.tap do |t| t << "<#{html_attribute}" .select { |k, v| k != :close_tag }.each do |k, v| t << " #{k}='#{v}'" end t << ">" t << html_content if html_content t << "</#{html_attribute}>" unless [:close_tag] == false end end |