Class: VimwikiMarkdown::Options
- Inherits:
-
Object
- Object
- VimwikiMarkdown::Options
- Defined in:
- lib/vimwiki_markdown/options.rb
Constant Summary collapse
- DEFAULTS =
force - 1/0
["1", #force - 1/0 "markdown", "md", "~/vimwiki/site_html/", "~/vimwiki/index.md", "~/vimwiki/site_html/style.css", "~/vimwiki/templates/", "default", ".tpl", "-"].freeze
- FORCE =
0
- SYNTAX =
1
- EXTENSION =
2
- OUTPUT_DIR =
3
- INPUT_FILE =
4
- CSS_FILE =
5
- TEMPLATE_PATH =
6
- TEMPLATE_DEFAULT =
7
- TEMPLATE_EXT =
8
- ROOT_PATH =
9
Instance Attribute Summary collapse
-
#css_file ⇒ Object
readonly
Returns the value of attribute css_file.
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#force ⇒ Object
readonly
Returns the value of attribute force.
-
#input_file ⇒ Object
readonly
Returns the value of attribute input_file.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
-
#syntax ⇒ Object
readonly
Returns the value of attribute syntax.
-
#template_default ⇒ Object
readonly
Returns the value of attribute template_default.
-
#template_ext ⇒ Object
readonly
Returns the value of attribute template_ext.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
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.
- #output_fullpath ⇒ Object
- #template_filename ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize ⇒ Options
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 '../../../'.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# 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 |
Instance Attribute Details
#css_file ⇒ Object (readonly)
Returns the value of attribute css_file.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def css_file @css_file end |
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def extension @extension end |
#force ⇒ Object (readonly)
Returns the value of attribute force.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def force @force end |
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def input_file @input_file end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def output_dir @output_dir end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def root_path @root_path end |
#syntax ⇒ Object (readonly)
Returns the value of attribute syntax.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def syntax @syntax end |
#template_default ⇒ Object (readonly)
Returns the value of attribute template_default.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def template_default @template_default end |
#template_ext ⇒ Object (readonly)
Returns the value of attribute template_ext.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def template_ext @template_ext end |
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
27 28 29 |
# File 'lib/vimwiki_markdown/options.rb', line 27 def template_path @template_path end |
Class Method Details
.arguments ⇒ Object
64 65 66 |
# File 'lib/vimwiki_markdown/options.rb', line 64 def self.arguments ARGV.empty? ? DEFAULTS : ARGV end |
Instance Method Details
#output_fullpath ⇒ Object
72 73 74 75 |
# 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 ⇒ Object
60 61 62 |
# File 'lib/vimwiki_markdown/options.rb', line 60 def template_filename "#{template_path}#{template_default}#{template_ext}" end |
#title ⇒ Object
68 69 70 |
# File 'lib/vimwiki_markdown/options.rb', line 68 def title File.basename(input_file, "#{extension}").capitalize end |