module Mdtex

Constants

SETTING_FILE
VERSION

Public Class Methods

exist_command?(command) click to toggle source
# File lib/mdtex/util.rb, line 25
def exist_command?(command)
  `type "#{command}" 2> /dev/null` != ''
end
load_config() click to toggle source
# File lib/mdtex/util.rb, line 6
def load_config
  raise 'config.yml is not found.' unless File.exists? SETTING_FILE
  require 'mdtex/constant'
  Mdtex::Constant
end
make_target_directory(target) click to toggle source
# File lib/mdtex/util.rb, line 12
def make_target_directory(target)
  target_dir = File.dirname(target)
  FileUtils.mkdir_p target_dir unless File.directory?(target_dir)
end
md2latex(src, dest) click to toggle source
# File lib/mdtex/util.rb, line 17
def md2latex(src, dest)
  if exist_command?('pandoc')
    `pandoc #{src} -o #{dest} > /dev/null`
  else
    raise 'pandoc is not installed.'
  end
end
relative_path(path, base=Dir.pwd) click to toggle source
# File lib/mdtex/util.rb, line 29
def relative_path(path, base=Dir.pwd)
  Pathname(path).relative_path_from(Pathname(base))
end