class CiteProc::Ruby::Formats::Latex
Attributes
defaults[R]
config[R]
Public Class Methods
new(config = nil)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 23 def initialize(config = nil) if config.nil? @config = Latex.defaults.dup else @config = Latex.defaults.merge(config) end end
Public Instance Methods
apply_display()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 63 def apply_display output.replace( content_tag(config[:display], output) ) end
apply_font_style()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 42 def apply_font_style if options[:'font-style'] == 'italic' output.replace content_tag(config[:italic], output) end end
apply_font_variant()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 48 def apply_font_variant end
apply_font_weight()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 51 def apply_font_weight if options[:'font-weight'] == 'bold' output.replace content_tag(config[:bold], output) end end
apply_text_decoration()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 57 def apply_text_decoration end
apply_vertical_align()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 60 def apply_vertical_align end
bibliography(bibliography)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 31 def bibliography(bibliography) bibliography.header = "\\begin{enumerate}" bibliography.footer = "\\end{enumerate}" bibliography.prefix = "\\item " bibliography.suffix = "" bibliography.connector = "\n" bibliography end
escape_quotes?()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 69 def escape_quotes? false end
Protected Instance Methods
cleanup!()
click to toggle source
Calls superclass method
CiteProc::Ruby::Format#cleanup!
# File lib/citeproc/ruby/formats/latex.rb, line 89 def cleanup! super end
finalize!()
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 75 def finalize! # TODO find a better solution for this (strip tags?) # For now make sure not to double encode entities # by matching spaces before or after. output.gsub!(/[$&#^_%~]/) do |c| case c # TODO: when "\\" then '\backslash{}' when "^" then '\^{}' when '~' then '\~{}' else "\\#{c}" end end end
Private Instance Methods
attribute_assignments(options)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 104 def attribute_assignments(options) return unless options options = options.select { |_, v| !v.nil? } return unless !options.empty? ' ' << options.map { |k, v| [k, v.inspect].join('=') }.join(' ') end
closing_tag(name)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 126 def closing_tag(name) if name == '' '' else '}' end end
content_tag(name, content, options = nil)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 95 def content_tag(name, content, options = nil) opening_tag(name, options) << content << closing_tag(name) end
opening_tag(name, options = nil)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 114 def opening_tag(name, options = nil) if options && options.key?('style') options['style'] = style_for(options['style']) end if name == '' '' else "\\#{name}{" end end
style_for(options)
click to toggle source
# File lib/citeproc/ruby/formats/latex.rb, line 99 def style_for(options) return unless options && !options.empty? options.map { |*kv| kv.join(': ') }.join('; ') end