Sha256: add6c361f9f8a0d36fd36740239595df2bef5d5d6d11c19d18e923e55d2e10be

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

module Hemingway

  # This is a moronic little class to generate some HTML Tags around
  # some content.
  class Build
    def self.tag(html_attribute, html_content=nil, options={})
      String.new.tap do |t|
        t << "<" + html_attribute
        t << " id='" + options[:id] + "'" if options[:id]
        t << " class='" + options[:class] + "'" if options[:class]
        t << " href='" + options[:href] + "'" if options[:href]
        t << ">"
        t << html_content if html_content
        t << "</" + html_attribute + ">" unless options[:close_tag] == false
      end
    end

    def self.symbol(symbol)
      latex_sym_to_html[symbol]
    end

    private
    def self.latex_sym_to_html
      {
        "\\Gamma" =>  "&Gamma;",
        "\\Delta" =>  "&Delta;",
        "\\Theta" =>  "&Theta;",
        "\\Lambda" =>  "&Lambda;",
        "\\Xi" =>  "&Xi;",
        "\\Pi" =>  "&Pi;",
        "\\Sigma" =>  "&Sigma;",
        "\\Upsilon" =>  "&Upsilon;",
        "\\Phi" =>  "&Phi;",
        "\\Psi" =>  "&Psi;",
        "\\Omega" =>  "&Omega;",
        "\\alpha" =>  "&alpha;",
        "\\beta" =>  "&beta;",
        "\\gamma" =>  "&gamma;",
        "\\delta" =>  "&delta;",
        "\\epsilon" =>  "&epsilon;",
        "\\zeta" =>  "&zeta;",
        "\\eta" =>  "&eta;",
        "\\theta" =>  "&theta;",
        "\\iota" =>  "&iota;",
        "\\kappa" =>  "&kappa;",
        "\\lambda" =>  "&lambda;",
        "\\mu" =>  "&mu;",
        "\\nu" =>  "&nu;",
        "\\xi" =>  "&xi;",
        "\\pi" =>  "&pi;",
        "\\rho" =>  "&rho;",
        "\\varsigma" =>  "&sigmaf;",
        "\\sigma" =>  "&sigma;",
        "\\tau" =>  "&tau;",
        "\\upsilon" =>  "&upsilon;",
        "\\phi" =>  "&phi;",
        "\\chi" =>  "&chi;",
        "\\psi" =>  "&psi;",
        "\\omega" =>  "&omega;"
      }
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hemingway-0.0.2 lib/hemingway/build.rb