Module: Hyphae
- Defined in:
- lib/hyphae.rb
Defined Under Namespace
Classes: SiteDir, SiteLink, SiteNode, SitePage
Class Method Summary collapse
-
.make_tag(tag, content, attrs = {}) ⇒ Object
Renders an HTML tag.
-
.sanitize(str) ⇒ Object
Produces a URL safe version of a string.
Class Method Details
.make_tag(tag, content, attrs = {}) ⇒ Object
Renders an HTML tag
16 17 18 19 20 |
# File 'lib/hyphae.rb', line 16 def self.make_tag(tag, content, attrs={}) attrs_str = "" attrs.map { |x, y| attrs_str << " #{x}=\"#{y}\""} "<#{tag}#{attrs_str}>#{content}</#{tag}>" end |
.sanitize(str) ⇒ Object
Produces a URL safe version of a string
11 12 13 |
# File 'lib/hyphae.rb', line 11 def self.sanitize(str) str.downcase.gsub(' ', '_').gsub(/[^\d\w_]/, "") end |