lib/citeproc/js/engine.rb in citeproc-js-0.0.1.pre.1 vs lib/citeproc/js/engine.rb in citeproc-js-0.0.1
- old
+ new
@@ -61,15 +61,23 @@
word.downcase!
word
end
end
-
+
#
# instance methods
#
+
+ def style=(style)
+ @style = Style.load(style.to_s)
+ end
+ def locales=(locale)
+ @locales = { locale.to_sym => Locale.load(locale.to_s) }
+ end
+
attr_context :processor_version, :csl_version, :opt
alias flags opt
delegate_context %w{ setOutputFormat updateItems updateUncitedItems
@@ -97,11 +105,15 @@
def start
return if started?
super
+ self.style = processor.options[:style] if @style.nil?
+ self.locales = processor.options[:locale] if @locales.nil?
+
@context = ExecJS.compile(Engine.source)
update_system
+
delegate "citeproc = new CSL.Engine(system, #{style.inspect}, #{language.inspect})", :exec
set_output_format(options[:format])
self
rescue => e