commit e3e2e735f8b5707e5d2b6e0de26d206ffb3530d8
parent 703811eadc78d9817a0a53f5941d5fd8460cd2f4
Author: Frederic Cambus <fred@statdns.com>
Date: Tue, 13 Mar 2018 11:45:00 +0100
Call YAML.load_file directly
Diffstat:
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/motyl.rb b/src/motyl.rb
@@ -17,11 +17,6 @@ require 'kramdown'
require 'mustache'
require 'yaml'
-# Load YAML from file
-def loadYAML(path)
- return YAML.load_file(path)
-end
-
# Load and process Markdown file
def loadMD(path)
return Kramdown::Document.new(File.read(path)).to_html
@@ -36,7 +31,7 @@ end
data = {}
data["version"] = "Motyl 1.00"
data["updated"] = Time.now.strftime("%Y-%m-%dT%XZ")
-data["site"] = loadYAML("motyl.conf")
+data["site"] = YAML.load_file("motyl.conf")
data["site"]["feed"] = {}
data["site"]["posts"] = []
data["site"]["categories"] = {}
@@ -60,7 +55,7 @@ def render(directory, templates, data)
if extension == ".md"
basename = File.basename(file, extension)
- data["page"] = loadYAML(directory + "/" + basename + ".yaml")
+ data["page"] = YAML.load_file(directory + "/" + basename + ".yaml")
data["page"]["content"] = Mustache.render(loadMD(directory + "/" + file), data)
if data["page"]["url"].nil?
data["page"]["url"] = basename + "/"