OSDN Git Service

The text edit in MyListCtrl seems weird. Hopefully fixed.
[molby/Molby.git] / Documents / makedoc.rb
index 952df8a..e31241e 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/ruby
+# -*- coding: utf-8 -*-
 require "rexml/document"
 
 class REXML::Element
@@ -154,6 +155,19 @@ def special_node(e, ef, lang)
       ep = @file_hash[href]
       c.unshift(make_a_element(href, (lang == "ja" ? ep.title_ja : ep.title_en)))
     end
+    if (href = prev_link(ef)) != nil
+      c.push(REXML::Text.new("    ", false, nil, true))
+      c.push(make_a_element(href, (lang == "ja" ? "[前]" : "[Prev]")))
+    end
+    if (href = next_link(ef)) != nil
+      c.push(REXML::Text.new("    ", false, nil, true))
+      c.push(make_a_element(href, (lang == "ja" ? "[次]" : "[Next]")))
+    end
+    otherlang = (lang == "ja" ? "en" : "ja")
+    n = REXML::Element.new("span")
+    n.add_attribute("class", "float_right")
+    n.add(make_a_element('../' + otherlang + '/' + ef.attributes['file'], (otherlang == "ja" ? "[Japanese]" : "[English]")))
+    c.push(n)
     c.each { |n|
       if n.is_a?(String)
         en.add_text(n)
@@ -185,6 +199,11 @@ def special_node(e, ef, lang)
       en.add(make_a_element(href, (lang == "ja" ? "[次: #{ep.title_ja}]" : "[Next: #{ep.title_en}]")))
       en.add_text(" ")
     end
+    otherlang = (lang == "ja" ? "en" : "ja")
+    n = REXML::Element.new("span")
+    n.add_attribute("class", "float_right")
+    n.add(make_a_element('../' + otherlang + '/' + ef.attributes['file'], (otherlang == "ja" ? "[Japanese]" : "[English]")))
+    en.add(n)
   elsif id == "\#toc"
     en = REXML::Element.new("div")
     en.add_attribute("class", "contents")
@@ -230,7 +249,7 @@ body.each_element_with_attribute('file') { |ef|
       e = e.deep_clone
       if e.name == "title"
         e = REXML::Element.new("title")
-        e.add_text(lang == "ja" ? ef.title_ja : ef.title_ja)
+        e.add_text(lang == "ja" ? ef.title_ja : ef.title_en)
       elsif e.name == "meta"
         if e.attributes["http-equiv"] == "Content-Type"
           e.attributes["lang"] = lang
@@ -276,9 +295,9 @@ body.each_element_with_attribute('file') { |ef|
        system("cd #{base_dir}/#{lang}; sed 's!/>! />!g' _#{file} >#{file}; rm _#{file}")
   end
 }
-target_dir = "../doc"
-system("cp -r etc #{base_dir}; rm -rf #{base_dir}/etc/CVS") 
-system("rm -rf #{target_dir}/*")
-system("mv #{base_dir}/* #{target_dir}")
-system("rmdir #{base_dir}")
-print "Documents were successfully created in #{target_dir}/{en,ja}.\n"
+
+system("cp -r -p etc #{base_dir}; rm -rf #{base_dir}/etc/CVS #{base_dir}/etc/.svn #{base_dir}/etc/.DS_Store") 
+system("cp -r -p src/molby_rb #{base_dir}/en; rm -rf #{base_dir}/en/molby_rb/CVS #{base_dir}/en/molby_rb/.svn")
+system("cp -r -p #{base_dir}/en/molby_rb #{base_dir}/ja")
+print "Documents were successfully created in #{base_dir}/{en,ja}.\n"
+exit 0