forked from ewfm/ewfm
Add prre and post processor support.
This commit is contained in:
parent
53a1afb8d7
commit
3caf6c0fe5
2 changed files with 48 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/proc
|
||||
/themes
|
||||
/input
|
||||
/output
|
||||
|
|
51
main.rb
51
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
|
||||
|
|
Loading…
Reference in a new issue