These are TeX's special characters
These, we transform to {tt char<ascii code>}
other things that are good on the eyes
# 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 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\}/, " ") s.gsub("\\space{", "\\itexspace{") else self end end
# File lib/maruku/structures_inspect.rb, line 24 def inspect_more(a=nil,b=nil) inspect end
# File lib/maruku/input/type_detection.rb, line 23 def md_type() @md_type ||= line_md_type(self) end
“ andrea censi ” => [“ andrea ”, “censi ”]
# File lib/maruku/output/to_markdown.rb, line 29 def mysplit split.map{|x| x+" "} end
# File lib/maruku/attributes.rb, line 23 def quote_if_needed if /[\s\\"]/.match self inspect else self end end
# File lib/maruku/input_textile2/t2_parser.rb, line 9 def t2_contains_signature? self =~ Textile2_Signature end
# File lib/maruku/input_textile2/t2_parser.rb, line 5 def t2_empty? self =~ Textile2_EmptyLine end
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
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
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
XXX: markdown escaping
# File lib/maruku/output/to_markdown.rb, line 24 def to_md(c=nil) to_s end