Class: Jekyll::JekyllTexEqn::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-tex-eqn.rb

Overview

Utility class, with a few constants and class methods, mostly to retrieve options and to report errors

Constant Summary collapse

ROOT =

YAML tag for this plugin's options

"texeqn"
BACKEND_KEY =

Key for backend configuration

"backend"
OPTIONS_KEY =

Key for extra options for the backend

"options"
PACKAGES_KEY =

Key for the package list

"packages"
EXTRAPACKAGES_KEY =

Key for the extra package list

"extra_packages"
TMPDIR_KEY =

Key for the temporary directory

"tmpdir"
OUTPUTDIR_KEY =

Key for the output directory

"outputdir"
INLINE_CLASS_KEY =

Key for the inline equation class configuration

"inlineclass"
BLOCK_CLASS_KEY =

Key for the block equation class configuration

"blockclass"
EXTRAHEAD_KEY =

Key for the extra header

"extra_head"
INLINE_SCALE_KEY =

Key for setting up image scaling for inline equations

"inline_scale"
BLOCK_SCALE_KEY =

Key for setting up image scaling for block equations

"block_scale"
DEFAULT_BACKEND =

Default values

"pdflatex"
DEFAULT_PACKAGES =
[
  {"name": "inputenc", "option": "utf8"},
  {"name": "fontenc",  "option": "T1"},
  {"name": "amsmath"},
  {"name": "amssymb"}
]
DEFAULT_TMPDIR =
"_tmp"
DEFAULT_OUTPUTDIR =
"assets/texeqn"
DEFAULT_INLINE_SCALE =
"2.4"
DEFAULT_BLOCK_SCALE =
"2.4"
@@config =

Retrieve Jekyll configuration for this plugin

Class Method Summary collapse

Class Method Details

.get_option(key, default) ⇒ Object

Get the value of an option, or the provided default value if that option has not been set



70
71
72
73
74
75
76
77
78
79
# File 'lib/jekyll-tex-eqn.rb', line 70

def self.get_option(key, default)
  v = nil
  if !@@config.nil? then
    v = @@config[key]
  end
  if v.nil? && !default.nil? then
    v = default
  end
  v
end

.report(context, msg, cause) ⇒ Object

Make an error message to be reported



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/jekyll-tex-eqn.rb', line 82

def self.report(context, msg, cause)
  err = ""
  if !context.nil? then
    thispage = context.registers[:page]['path']
    err = "On #{thispage}: "
  end
  err << msg
  if !cause.nil? && !cause.message.empty? then
    err << ": #{cause.message}"
  end
  err
end