Class: MarkdownSite::Config
- Inherits:
-
Object
- Object
- MarkdownSite::Config
- Defined in:
- lib/markdown_site/config.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#raw_config ⇒ Object
Returns the value of attribute raw_config.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #assets_dir ⇒ Object
- #citation ⇒ Object
- #copy_files ⇒ Object
- #get_base_info(name) ⇒ Object
- #get_generate_info(name) ⇒ Object
- #get_template_info(name) ⇒ Object
- #giscus ⇒ Object
- #index_template ⇒ Object
-
#initialize(file, type) ⇒ Config
constructor
A new instance of Config.
- #journal_template ⇒ Object
- #journals ⇒ Object
- #journals_template ⇒ Object
- #knowledge_graph ⇒ Object
- #knowledge_graph_template ⇒ Object
- #languages ⇒ Object
- #load_file(file) ⇒ Object
- #page_template ⇒ Object
- #pages ⇒ Object
- #pages_template ⇒ Object
- #preprocessing ⇒ Object
- #publish_dir ⇒ Object
- #root_template ⇒ Object
- #src ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(file, type) ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 |
# File 'lib/markdown_site/config.rb', line 15 def initialize(file, type) @file = file @type = type load_file(file) return self end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
5 6 7 |
# File 'lib/markdown_site/config.rb', line 5 def file @file end |
#raw_config ⇒ Object
Returns the value of attribute raw_config.
5 6 7 |
# File 'lib/markdown_site/config.rb', line 5 def raw_config @raw_config end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/markdown_site/config.rb', line 5 def type @type end |
Instance Method Details
#assets_dir ⇒ Object
87 88 89 |
# File 'lib/markdown_site/config.rb', line 87 def assets_dir return get_generate_info("assets_dir") end |
#citation ⇒ Object
71 72 73 74 75 |
# File 'lib/markdown_site/config.rb', line 71 def citation if @raw_config return @raw_config["citation"] end end |
#copy_files ⇒ Object
91 92 93 |
# File 'lib/markdown_site/config.rb', line 91 def copy_files return get_generate_info("copy_files") end |
#get_base_info(name) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/markdown_site/config.rb', line 22 def get_base_info(name) if @raw_config if @raw_config[@type.to_s] return @raw_config[@type.to_s][name] end end "" end |
#get_generate_info(name) ⇒ Object
31 32 33 34 35 |
# File 'lib/markdown_site/config.rb', line 31 def get_generate_info(name) if @raw_config["generate"] return @raw_config["generate"][name] end end |
#get_template_info(name) ⇒ Object
37 38 39 40 41 |
# File 'lib/markdown_site/config.rb', line 37 def get_template_info(name) if @raw_config["template"] return @raw_config["template"][name] end end |
#giscus ⇒ Object
65 66 67 68 69 |
# File 'lib/markdown_site/config.rb', line 65 def giscus if @raw_config return @raw_config["giscus"] end end |
#index_template ⇒ Object
123 124 125 |
# File 'lib/markdown_site/config.rb', line 123 def index_template return get_template_info("index_template") end |
#journal_template ⇒ Object
111 112 113 |
# File 'lib/markdown_site/config.rb', line 111 def journal_template return get_template_info("journal_template") end |
#journals ⇒ Object
55 56 57 |
# File 'lib/markdown_site/config.rb', line 55 def journals get_base_info("journals") end |
#journals_template ⇒ Object
115 116 117 |
# File 'lib/markdown_site/config.rb', line 115 def journals_template return get_template_info("journals_template") end |
#knowledge_graph ⇒ Object
95 96 97 |
# File 'lib/markdown_site/config.rb', line 95 def knowledge_graph return get_generate_info("knowledge_graph") end |
#knowledge_graph_template ⇒ Object
99 100 101 |
# File 'lib/markdown_site/config.rb', line 99 def knowledge_graph_template return get_template_info("knowledge_graph_template") end |
#languages ⇒ Object
77 78 79 80 81 |
# File 'lib/markdown_site/config.rb', line 77 def languages if @raw_config return @raw_config["languages"] end end |
#load_file(file) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/markdown_site/config.rb', line 7 def load_file(file) @raw_config = begin Tomlrb.load_file(file) rescue {} end end |
#page_template ⇒ Object
107 108 109 |
# File 'lib/markdown_site/config.rb', line 107 def page_template return get_template_info("page_template") end |
#pages ⇒ Object
51 52 53 |
# File 'lib/markdown_site/config.rb', line 51 def pages get_base_info("pages") end |
#pages_template ⇒ Object
103 104 105 |
# File 'lib/markdown_site/config.rb', line 103 def pages_template return get_template_info("pages_template") end |
#preprocessing ⇒ Object
59 60 61 62 63 |
# File 'lib/markdown_site/config.rb', line 59 def preprocessing if @raw_config return @raw_config["preprocessing"] end end |
#publish_dir ⇒ Object
83 84 85 |
# File 'lib/markdown_site/config.rb', line 83 def publish_dir return get_generate_info("publish_dir") end |
#root_template ⇒ Object
119 120 121 |
# File 'lib/markdown_site/config.rb', line 119 def root_template return get_template_info("root_template") end |
#src ⇒ Object
47 48 49 |
# File 'lib/markdown_site/config.rb', line 47 def src get_base_info("src") end |
#title ⇒ Object
43 44 45 |
# File 'lib/markdown_site/config.rb', line 43 def title get_base_info("title") end |