class String
Constants
- LATEX_ADD_SLASH
These are TeX's special characters
- LATEX_TO_CHARCODE
These, we transform to {tt char<ascii code>}
- OtherGoodies
other things that are good on the eyes
- Textile2_EmptyLine
- Textile2_Signature
Public Instance Methods
escape_to_latex(s)
click to toggle source
# File lib/maruku/output/to_latex_strings.rb, line 31 def escape_to_latex(s) s2 = "" s.each_byte do |b| if LATEX_TO_CHARCODE.include? b s2 += "{\\tt \\char#{b}}" elsif LATEX_ADD_SLASH.include? b s2 << ?\\ << b elsif b == ?\ # there is no backslash in cmr10 fonts s2 += "$\\backslash$" else s2 << b end end s2 end
fix_latex()
click to toggle source
fix some LaTeX command-name clashes
# File lib/maruku/ext/math/latex_fix.rb, line 3 def fix_latex if #{html_math_engine} == 'itex2mml' s = self.gsub("\\mathop{", "\\operatorname{") s.gsub!(/\begin\{svg\}.*?\end\{svg\}/m, " ") s.gsub("\\space{", "\\itexspace{") else self end end
inspect_more(a=nil,b=nil)
click to toggle source
# File lib/maruku/structures_inspect.rb, line 24 def inspect_more(a=nil,b=nil) inspect end
md_type()
click to toggle source
# File lib/maruku/input/type_detection.rb, line 23 def md_type() @md_type ||= line_md_type(self) end
mysplit()
click to toggle source
“ andrea censi ” => [“ andrea ”, “censi ”]
# File lib/maruku/output/to_markdown.rb, line 29 def mysplit split.map{|x| x+" "} end
quote_if_needed()
click to toggle source
# File lib/maruku/attributes.rb, line 23 def quote_if_needed if /[\s\\"]/.match self inspect else self end end
t2_contains_signature?()
click to toggle source
# File lib/maruku/input_textile2/t2_parser.rb, line 9 def t2_contains_signature? self =~ Textile2_Signature end
t2_empty?()
click to toggle source
# File lib/maruku/input_textile2/t2_parser.rb, line 5 def t2_empty? self =~ Textile2_EmptyLine end
t2_get_signature()
click to toggle source
sig, rest = #t2_get_signature
# File lib/maruku/input_textile2/t2_parser.rb, line 14 def t2_get_signature self =~ Textile2_Signature return Textile2Signature.new($1), $2 end
to_html()
click to toggle source
A string is rendered into HTML by creating a REXML::Text node. REXML takes care of all the encoding.
# File lib/maruku/output/to_html.rb, line 34 def to_html REXML::Text.new(self) end
to_latex()
click to toggle source
escapes special characters
# File lib/maruku/output/to_latex_strings.rb, line 49 def to_latex s = escape_to_latex(self) OtherGoodies.each do |k, v| s.gsub!(k, v) end s end
to_md(c=nil)
click to toggle source
XXX: markdown escaping
# File lib/maruku/output/to_markdown.rb, line 24 def to_md(c=nil) to_s end