aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2022-05-11 17:40:33 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2022-05-11 17:40:33 +0200
commitfc59e926b33c1bad05b58c7fff4f2822ac071c96 (patch)
treeef0ae38fb89635f89a4e66bdbe41b2717189b2c5
parent7ffa8919e601c8520d29a6137ebfb7dc7f74ed4f (diff)
downloadhyde-fc59e926b33c1bad05b58c7fff4f2822ac071c96.tar.gz
hyde-fc59e926b33c1bad05b58c7fff4f2822ac071c96.zip
Add some comment
-rwxr-xr-xhyde.rb18
-rw-r--r--optparser.rb2
2 files changed, 12 insertions, 8 deletions
diff --git a/hyde.rb b/hyde.rb
index 5de5988..23a6203 100755
--- a/hyde.rb
+++ b/hyde.rb
@@ -1,6 +1,6 @@
#!/usr/local/bin/ruby
-# A simple website generator
+# A static website generator
# Copyright (C) 2022 Alessandro Iezzi <aiezzi AT alessandroiezzi DOT it>
#
# This program is free software: you can redistribute it and/or modify
@@ -24,9 +24,11 @@ require 'date'
require_relative 'page.rb'
require_relative 'optparser.rb'
-options = optparse
-
-#puts options
+=begin
+Considerations on file formats.
+ .config -- Are configurations, written in YAML
+ .tmpl -- Are templates, they don't need configuration files
+=end
def listarticles(path, max)
pages = Array.new
@@ -46,11 +48,15 @@ def listarticles(path, max)
return pages
end
+# Parse arguments from the CLI
+options = optparse
+
+# Every file needs a config file. It is similar to the YAML block in head to files processed by gohugo or jekyll.
configfile = options[:fileName] + '.config'
if(!File.exist?(configfile) && !options[:fileName].end_with?("tmpl"))
puts 'Cannot find configuration file: ' + configfile
- exit -1
+ exit 1
end
if(File.exist?(configfile))
@@ -66,8 +72,6 @@ if(File.exist?(configfile))
end
end
-puts 'Creating page'
-
page = Page.new(title, options[:fileName], pageNames, description, nil, classes, category)
if (options[:master] != nil)
diff --git a/optparser.rb b/optparser.rb
index 1886476..27a0708 100644
--- a/optparser.rb
+++ b/optparser.rb
@@ -1,4 +1,4 @@
-# A simple website generator
+# A static website generator
# Copyright (C) 2022 Alessandro Iezzi <aiezzi AT alessandroiezzi DOT it>
#
# This program is free software: you can redistribute it and/or modify