From fc59e926b33c1bad05b58c7fff4f2822ac071c96 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Wed, 11 May 2022 17:40:33 +0200 Subject: Add some comment --- hyde.rb | 18 +++++++++++------- optparser.rb | 2 +- 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 # # 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 # # This program is free software: you can redistribute it and/or modify -- cgit v1.2.3