]> git.mdlowis.com Git - projs/mdlowis.com.git/commitdiff
added arg for navtree to Page class master
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 3 Jul 2018 15:27:49 +0000 (11:27 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 3 Jul 2018 15:27:49 +0000 (11:27 -0400)
generate.rb

index 62b2d15d663adb88bcb7ce202538d6e9161acb64..c9ecf7ff143cf2ade19ac80ab8801df7fe3c316f 100755 (executable)
@@ -9,8 +9,9 @@ TEMPLATE = IO.read("page.html.erb")
 class Page
   attr_accessor :year, :navigation, :markdown
 
-  def initialize(src)
+  def initialize(src,nav)
     @year = Time.new.year
+    @navigation = nav
     @markdown = `tools/md2html.awk #{src}`
   end
 
@@ -20,12 +21,13 @@ class Page
 end
 
 def generate(p)
-  op = p.gsub(/^#{SRCDIR}/,'')
-  FileUtils.mkdir_p(File.join(DESTDIR, op))
-  op = File.join(DESTDIR, op)
+  sp = p.gsub(/^#{SRCDIR}\//,'')
+  puts sp
+  FileUtils.mkdir_p(File.join(DESTDIR, sp))
+  op = File.join(DESTDIR, sp)
   if p.end_with? ".md" then
     op = File.join(File.dirname(op), "#{File.basename(op,'.*')}.html")
-    File.open(op, 'w') { |file| file.write(Page.new(p).render) }
+    File.open(op, 'w') { |file| file.write(Page.new(p,"").render) }
   else
     FileUtils.copy(p, op)
   end