class CiteProc::Ruby::Formats::Latex
Attributes
Public Class Methods
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
Source
# File lib/citeproc/ruby/formats/latex.rb, line 63 def apply_display output.replace( content_tag(config[:display], output) ) end
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
Source
# File lib/citeproc/ruby/formats/latex.rb, line 48 def apply_font_variant end
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
Source
# File lib/citeproc/ruby/formats/latex.rb, line 57 def apply_text_decoration end
Source
# File lib/citeproc/ruby/formats/latex.rb, line 60 def apply_vertical_align end
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
Source
# File lib/citeproc/ruby/formats/latex.rb, line 69 def escape_quotes? false end
Protected Instance Methods
Source
# File lib/citeproc/ruby/formats/latex.rb, line 89 def cleanup! super end
Calls superclass method
CiteProc::Ruby::Format#cleanup!
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
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
Source
# File lib/citeproc/ruby/formats/latex.rb, line 126 def closing_tag(name) if name == '' '' else '}' end end
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
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
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