diff --git a/.gitignore b/.gitignore index 80dcac1..6fe769f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/proc /themes /input /output diff --git a/main.rb b/main.rb index e5579ed..c7e83c4 100644 --- a/main.rb +++ b/main.rb @@ -53,6 +53,8 @@ for string in prelim end end +procfiles = Marshal.load(Marshal.dump(files)) + for file in directory file1 = "/" + file file1["input/"]= "" @@ -73,17 +75,44 @@ for file in structure end for file in files - handle = File.read(file) + if(File.exist?('input/inclusions.conf')) + list = IO.readlines("input/inclusions.conf", chomp: true) + for ext in list + if file.include? ext + handle = File.read(file) - output = file - output["input"]= "output" - IO.write(output, handle) + output = file + output["input"]= "output" + IO.write(output, handle) + end + end + else + handle = File.read(file) + + output = file + output["input"]= "output" + IO.write(output, handle) + end end def scope yield end +if(File.exist?('input/preproc.conf')) + list = IO.readlines("input/preproc.conf", chomp: true) + for proc in list + if(File.exist?('proc/' + proc +'/pre.sh')) + for file in procfiles + runner = `proc/#{proc}/pre.sh #{file}` + puts runner + end + else + puts proc +" does not support being used as a pre-processor." + end + end +end + for file in workspace text = File.read(file) template = File.read(theme_dir + "template.html") @@ -179,3 +208,17 @@ for file in workspace handle[".md"]= ".html" IO.write(handle, product) end + +if(File.exist?('input/postproc.conf')) + list = IO.readlines("input/postproc.conf", chomp: true) + for proc in list + if(File.exist?('proc/' + proc +'/post.sh')) + for file in procfiles + runner = `proc/#{proc}/post.sh #{file}` + puts runner + end + else + puts proc +" does not support being used as a post-processor." + end + end +end