From 152f113f771ffb896e4d72b9a377a1e89f64c0f2 Mon Sep 17 00:00:00 2001 From: no author Date: Mon, 26 Sep 2005 22:05:44 +0000 Subject: New RDoc Template! added trunk/rake_helpers folder moved trunk/coderay_rdoc_template.rb to it changed trunk/Rakefile added trunk/rake_helpers/ca.rb (CSS preprocessing) --- Rakefile | 2 +- coderay_rdoc_template.rb | 586 ------------------------------ rake_helpers/ca.rb | 40 +++ rake_helpers/coderay_rdoc_template.rb | 648 ++++++++++++++++++++++++++++++++++ 4 files changed, 689 insertions(+), 587 deletions(-) delete mode 100644 coderay_rdoc_template.rb create mode 100644 rake_helpers/ca.rb create mode 100644 rake_helpers/coderay_rdoc_template.rb diff --git a/Rakefile b/Rakefile index de3fef3..67caebf 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ Rake::RDocTask.new :rdoc do |rd| rd.main = ROOT + 'README' rd.title = "CodeRay Documentation" rd.options << '--line-numbers' << '--inline-source' << '--tab-width' << '2' - rd.template = './coderay_rdoc_template.rb' + rd.template = 'rake_helpers/coderay_rdoc_template.rb' rd.rdoc_files.add ROOT + 'README' rd.rdoc_files.add *Dir[LIB_ROOT + '**/*.rb'] # rd.rdoc_files.include ROOT + 'coderay/scanners/*.rb' diff --git a/coderay_rdoc_template.rb b/coderay_rdoc_template.rb deleted file mode 100644 index 3b68ac1..0000000 --- a/coderay_rdoc_template.rb +++ /dev/null @@ -1,586 +0,0 @@ -# This goes to /lib/ruby/1.8/rdoc/generators/template/html/ -module RDoc::Page - -FONTS = "Tahoma, Verdana, sans-serif" - -STYLE = < pre { - border: 1px solid silver; - background: #112; - color: white; - padding: 0.5em; -} - -CSS - -XHTML_PREAMBLE = %{ - -} - -HEADER = XHTML_PREAMBLE + < - - %title% - - - - - - - -ENDHEADER - -FILE_PAGE = < - - - - -
File
%short_name%
- - - - - - - - - -
Path:%full_path% -IF:cvsurl -  (CVS) -ENDIF:cvsurl -
Modified:%dtm_modified%
-
- -
-HTML - -################################################################### - -CLASS_PAGE = < - %classmod%
%full_name% - - - - - - -IF:parent - - - - -ENDIF:parent -
In: -START:infiles -HREF:full_path_url:full_path: -IF:cvsurl - (CVS) -ENDIF:cvsurl -END:infiles -
Parent: -IF:par_url - -ENDIF:par_url -%parent% -IF:par_url - -ENDIF:par_url -
- - - -HTML - -################################################################### - -METHOD_LIST = < -IF:diagram -
- %diagram% -
-ENDIF:diagram - -IF:description -
%description%
-ENDIF:description - -IF:requires -
Required Files
-
    -START:requires -
  • HREF:aref:name:
  • -END:requires -
-ENDIF:requires - -IF:toc -
Contents
- -ENDIF:toc - -IF:methods -
Methods
-
    -START:methods -
  • HREF:aref:name:
  • -END:methods -
-ENDIF:methods - -IF:includes -
Included Modules
-
    -START:includes -
  • HREF:aref:name:
  • -END:includes -
-ENDIF:includes - -START:sections -IF:sectitle - -IF:seccomment -
-%seccomment% -
-ENDIF:seccomment -ENDIF:sectitle - -IF:classlist -
Classes and Modules
- %classlist% -ENDIF:classlist - -IF:constants -
Constants
- -START:constants - - - - - -IF:desc - - - - -ENDIF:desc -END:constants -
%name%=%value%
 %desc%
-ENDIF:constants - -IF:attributes -
Attributes
- -START:attributes - - - - - -END:attributes -
-IF:rw -[%rw%] -ENDIF:rw - %name%%a_desc%
-ENDIF:attributes - -IF:method_list -START:method_list -IF:methods -
%type% %category% methods
-START:methods -
-
-IF:callseq - %callseq% -ENDIF:callseq -IFNOT:callseq - %name%%params% -ENDIF:callseq -IF:codeurl -[ source ] -ENDIF:codeurl -
-IF:m_desc -
- %m_desc% -
-ENDIF:m_desc -IF:aka -
- This method is also aliased as -START:aka - %name% -END:aka -
-ENDIF:aka -IF:sourcecode -
- -
-
-%sourcecode%
-
-
-
-ENDIF:sourcecode -
-END:methods -ENDIF:methods -END:method_list -ENDIF:method_list -END:sections - -HTML - -FOOTER = < - -ENDFOOTER - -BODY = HEADER + < - -
- #{METHOD_LIST} -
- - #{FOOTER} -ENDBODY - -########################## Source code ########################## - -SRC_PAGE = XHTML_PREAMBLE + < -%title% - - - - -
%code%
- - -HTML - -########################## Index ################################ - -FR_INDEX_BODY = < - - - - - - - -
-START:entries -%name%
-END:entries -
- -HTML - -CLASS_INDEX = FILE_INDEX -METHOD_INDEX = FILE_INDEX - -INDEX = XHTML_PREAMBLE + < - - - - - - - - -IF:inline_source - -ENDIF:inline_source -IFNOT:inline_source - - - - -ENDIF:inline_source - - <body bgcolor="white"> - Click <a href="html/index.html">here</a> for a non-frames - version of this page. - </body> - - - - -HTML - -end diff --git a/rake_helpers/ca.rb b/rake_helpers/ca.rb new file mode 100644 index 0000000..8c18518 --- /dev/null +++ b/rake_helpers/ca.rb @@ -0,0 +1,40 @@ +#!c:/ruby/bin/rubyw +# Hy-Ca 0.2 by murphy + +module Hy + def self.ca str + str.gsub! %r-^(\s*)(?://)(.*)?-, '\1/*\2*/' + str.gsub! %r-\s*/\*.*?\*/\n?-m, '' + str.gsub!(/<<(.*?)>>/m) do + begin + eval $1 + '' + rescue Exception => boom + "<<\n#{boom}\n>>" + end + end + + str.gsub!(/\$([\w_]+)/m) do + begin + eval $1 + rescue + '' + end + end + + str + end +end + +begin + if file = ENV['PATH_TRANSLATED'] + puts "Content-Type: text/css" + puts + ca = File.read file + else + ca = ARGF.read + end + print Hy.ca(ca) +rescue => boom + p boom +end diff --git a/rake_helpers/coderay_rdoc_template.rb b/rake_helpers/coderay_rdoc_template.rb new file mode 100644 index 0000000..01e67ea --- /dev/null +++ b/rake_helpers/coderay_rdoc_template.rb @@ -0,0 +1,648 @@ +# This goes to /lib/ruby/1.8/rdoc/generators/template/html/ +module RDoc::Page + +FONTS = "Tahoma, Verdana, sans-serif" + +require 'rake_helpers/ca.rb' + +Hy.ca <> +CA + +STYLE = Hy.ca < pre { + border: 1px solid silver; + background: #112; + color: white; + padding: 0.5em; +} +CSS + +XHTML_FRAMESET_PREAMBLE = # +%{ +} + +XHTML_PREAMBLE = +%{ +} + +HEADER = XHTML_PREAMBLE + < + + %title% + + + + + + + +ENDHEADER + +FILE_PAGE = < + + + + + + + +
File %short_name%
+ + + + + + + + + +
Path:%full_path% +IF:cvsurl +  (CVS) +ENDIF:cvsurl +
Modified:%dtm_modified%
+
+ + + Ruby-Chan + + +
+HTML + +################################################################### + +CLASS_PAGE = < + + %classmod% %full_name% + + Ruby-Chan + + + + + + + + + +IF:parent + + + + +ENDIF:parent +
In: +START:infiles +HREF:full_path_url:full_path: +IF:cvsurl + (CVS) +ENDIF:cvsurl +END:infiles +
Parent: +IF:par_url + +ENDIF:par_url +%parent% +IF:par_url + +ENDIF:par_url +
+ + + +HTML + +################################################################### + +METHOD_LIST = < +IF:diagram +
+ %diagram% +
+ENDIF:diagram + +IF:description +
%description%
+ENDIF:description + +IF:requires +
Required Files
+
    +START:requires +
  • HREF:aref:name:
  • +END:requires +
+ENDIF:requires + +IF:toc +
Contents
+ +ENDIF:toc + +IF:methods +
Methods
+
    +START:methods +
  • HREF:aref:name:
  • +END:methods +
+ENDIF:methods + +IF:includes +
Included Modules
+
    +START:includes +
  • HREF:aref:name:
  • +END:includes +
+ENDIF:includes + +START:sections +IF:sectitle + +IF:seccomment +
+%seccomment% +
+ENDIF:seccomment +ENDIF:sectitle + +IF:classlist +
Classes and Modules
+ %classlist% +ENDIF:classlist + +IF:constants +
Constants
+ +START:constants + + + + + +IF:desc + + + + +ENDIF:desc +END:constants +
%name%=%value%
 %desc%
+ENDIF:constants + +IF:attributes +
Attributes
+ +START:attributes + + + + + +END:attributes +
+IF:rw +[%rw%] +ENDIF:rw + %name%%a_desc%
+ENDIF:attributes + +IF:method_list +START:method_list +IF:methods +
%type% %category% methods
+START:methods +
+
+IF:callseq + %callseq% +ENDIF:callseq +IFNOT:callseq + %name%%params% +ENDIF:callseq +IF:codeurl +[ source ] +ENDIF:codeurl +
+IF:m_desc +
+ %m_desc% +
+ENDIF:m_desc +IF:aka +
+ --- This method is also aliased as +START:aka + %name% +END:aka + --- +
+ENDIF:aka +IF:sourcecode +
+ +
+
+%sourcecode%
+
+
+
+ENDIF:sourcecode +
+END:methods +ENDIF:methods +END:method_list +ENDIF:method_list +END:sections + +HTML + +FOOTER = < + +ENDFOOTER + +BODY = HEADER + < + +
+ #{METHOD_LIST} +
+ + #{FOOTER} +ENDBODY + +########################## Source code ########################## + +SRC_PAGE = XHTML_PREAMBLE + < +%title% + + + + +
%code%
+ + +HTML + +########################## Index ################################ + +FR_INDEX_BODY = < +List + + + + + + +
+START:entries +%name%
+END:entries +
+ +HTML + +CLASS_INDEX = FILE_INDEX +METHOD_INDEX = FILE_INDEX + +INDEX = XHTML_FRAMESET_PREAMBLE + < + + %title% + + + + + + + + + +IF:inline_source + +ENDIF:inline_source +IFNOT:inline_source + + + + +ENDIF:inline_source + + <body bgcolor="white"> + Click <a href="html/index.html">here</a> for a non-frames + version of this page. + </body> + + + + +HTML + +end -- cgit v1.2.1