module Jekyll::Latex::Pdf::Utilities
Add methods which can be useful anywhere in the package.
Public Instance Methods
nomarkdown(string_to_wrap)
click to toggle source
Surround a string with nomarkdown tags to tell kramdown that this is plain latex.
# File lib/jekyll/latex/pdf/utilities.rb, line 10 def nomarkdown(string_to_wrap) "{::nomarkdown type=\"latex\"}" + string_to_wrap + "{:/}" end
nomarkdown_p(string_to_wrap)
click to toggle source
# File lib/jekyll/latex/pdf/utilities.rb, line 14 def nomarkdown_p(string_to_wrap) "\n{::nomarkdown type=\"latex\"}\n" + string_to_wrap + "\n{:/}\n" end
run_cmds(cmds, tempdir)
click to toggle source
Run some commands und stop on errors.
# File lib/jekyll/latex/pdf/utilities.rb, line 19 def run_cmds(cmds, tempdir) status = 0 out = "\n" cmds.each do |cmd| Open3.popen2(*cmd, chdir: tempdir) do |_i, oe, t| oe.each {|l| out += l + "\n" } status = t.value end unless 0 == status Jekyll.logger.warn "jekyll-latex-pdf", "Error running #{cmd.join ' '}" Jekyll.logger.warn "Return status: #{status}" Jekyll.logger.warn out end end [out, status] end
set_context_to(context)
click to toggle source
stolen from jekyll-scholar
# File lib/jekyll/latex/pdf/utilities.rb, line 38 def set_context_to(context) @context, @site, = context, context.registers[:site] config.merge!(site.config['scholar'] || {}) self end