class VimwikiMarkdown::Options

Constants

CSS_FILE
DEFAULTS
EXTENSION
FORCE
INPUT_FILE
OUTPUT_DIR
ROOT_PATH
SYNTAX
TEMPLATE_DEFAULT
TEMPLATE_EXT
TEMPLATE_PATH

Attributes

css_file[R]
extension[R]
force[R]
input_file[R]
output_dir[R]
root_path[R]
syntax[R]
template_default[R]
template_ext[R]
template_path[R]

Public Class Methods

arguments() click to toggle source
# File lib/vimwiki_markdown/options.rb, line 64
def self.arguments
  ARGV.empty? ? DEFAULTS : ARGV
end
new() click to toggle source

syntax : the syntax chosen for this wiki extension : the file extension for this wiki output_dir : the full path of the output directory, i.e. ‘path_html’ input_file : the full path of the wiki page css_file : the full path of the css file for this wiki template_path : the full path to the wiki’s templates template_default : the default template name template_ext : the extension of template files root_path : a count of ../ for pages buried in subdirs

if you have wikilink [[dir1/dir2/dir3/my page in a subdir]]
then e %root_path% is replaced by '../../../'.
# File lib/vimwiki_markdown/options.rb, line 45
def initialize
  @force = arguments[FORCE] == "1" ? true : false
  @syntax = arguments[SYNTAX]
  @extension = ".#{arguments[EXTENSION]}"
  @output_dir = arguments[OUTPUT_DIR]
  @input_file = arguments[INPUT_FILE]
  @css_file = arguments[CSS_FILE]
  @template_path = arguments[TEMPLATE_PATH]
  @template_default = arguments[TEMPLATE_DEFAULT]
  @template_ext = arguments[TEMPLATE_EXT]
  @root_path = arguments[ROOT_PATH]
  @root_path = "./" if @root_path == "-"
  raise "Must be markdown" unless syntax == 'markdown'
end

Public Instance Methods

output_fullpath() click to toggle source
# File lib/vimwiki_markdown/options.rb, line 72
def output_fullpath
  filename = title.parameterize =~ /^\s*$/ ? title : title.parameterize
  "#{output_dir}#{filename}.html"
end
template_filename() click to toggle source
# File lib/vimwiki_markdown/options.rb, line 60
def template_filename
  "#{template_path}#{template_default}#{template_ext}"
end
title() click to toggle source
# File lib/vimwiki_markdown/options.rb, line 68
def title
  File.basename(input_file, "#{extension}").capitalize
end

Private Instance Methods

arguments() click to toggle source
# File lib/vimwiki_markdown/options.rb, line 80
def arguments
  Options.arguments
end