site.rb 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. require 'rubygems'
  2. require 'erector'
  3. require "#{File.dirname(__FILE__)}/sitegen"
  4. require 'fileutils'
  5. require 'bluecloth'
  6. class Layout < Erector::Widget
  7. def content
  8. html do
  9. head do
  10. link :rel => "stylesheet",
  11. :type => "text/css",
  12. :href => "./screen.css"
  13. rawtext %(
  14. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  15. </script>
  16. <script type="text/javascript">
  17. _uacct = "UA-3418876-1";
  18. urchinTracker();
  19. </script>
  20. )
  21. end
  22. body do
  23. div :id => 'top' do
  24. div :id => 'main_navigation' do
  25. main_navigation
  26. end
  27. end
  28. div :id => 'middle' do
  29. div :id => 'main_content' do
  30. main_content
  31. end
  32. end
  33. div :id => 'bottom' do
  34. end
  35. end
  36. end
  37. end
  38. def main_navigation
  39. ul do
  40. li { link_to "Documentation", SyntacticRecognition, Documentation }
  41. li { link_to "Contribute", Contribute }
  42. li { link_to "Home", Index }
  43. end
  44. end
  45. def main_content
  46. end
  47. end
  48. class Index < Layout
  49. def main_content
  50. bluecloth "index.markdown"
  51. end
  52. end
  53. class Documentation < Layout
  54. abstract
  55. def main_content
  56. div :id => 'secondary_navigation' do
  57. ul do
  58. li { link_to 'Syntax', SyntacticRecognition }
  59. li { link_to 'Semantics', SemanticInterpretation }
  60. li { link_to 'Using In Ruby', UsingInRuby }
  61. li { link_to 'Advanced Techniques', PitfallsAndAdvancedTechniques }
  62. end
  63. end
  64. div :id => 'documentation_content' do
  65. documentation_content
  66. end
  67. end
  68. end
  69. class SyntacticRecognition < Documentation
  70. def documentation_content
  71. bluecloth "syntactic_recognition.markdown"
  72. end
  73. end
  74. class SemanticInterpretation < Documentation
  75. def documentation_content
  76. bluecloth "semantic_interpretation.markdown"
  77. end
  78. end
  79. class UsingInRuby < Documentation
  80. def documentation_content
  81. bluecloth "using_in_ruby.markdown"
  82. end
  83. end
  84. class PitfallsAndAdvancedTechniques < Documentation
  85. def documentation_content
  86. bluecloth "pitfalls_and_advanced_techniques.markdown"
  87. end
  88. end
  89. class Contribute < Layout
  90. def main_content
  91. bluecloth "contributing_and_planned_features.markdown"
  92. end
  93. end
  94. Layout.generate_site