[前][次][番号順一覧][スレッド一覧]

ruby-changes:3268

From: ko1@a...
Date: 28 Dec 2007 15:39:34 +0900
Subject: [ruby-changes:3268] drbrain - Ruby:r14761 (trunk): Move RDoc markup samples to sample/rdoc/markup directory

drbrain	2007-12-28 15:39:15 +0900 (Fri, 28 Dec 2007)

  New Revision: 14761

  Added directories:
    trunk/sample/rdoc/
    trunk/sample/rdoc/markup/
  Added files:
    trunk/sample/rdoc/markup/rdoc2latex.rb
    trunk/sample/rdoc/markup/sample.rb
  Removed directories:
    trunk/lib/rdoc/markup/sample/
  Modified files:
    trunk/ChangeLog

  Log:
    Move RDoc markup samples to sample/rdoc/markup directory
  Added: trunk/sample/rdoc/

  Added: trunk/sample/rdoc/markup/

  Deleted: trunk/lib/rdoc/markup/sample/
    % svn ls -r 14761 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/markup/sample/

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sample/rdoc/markup/sample.rb
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14761&r2=14760
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sample/rdoc/markup/rdoc2latex.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14760)
+++ ChangeLog	(revision 14761)
@@ -1,3 +1,7 @@
+Fri Dec 28 15:38:29 2007  Eric Hodel  <drbrain@s...>
+
+	* lib/rdoc/markup/sample/: Move to sample/rdoc/markup directory.
+
 Fri Dec 28 15:15:12 2007  Akinori MUSHA  <knu@i...>
 
 	* lib/irb/completion.rb: Remove garbage ("X=1").
Index: sample/rdoc/markup/sample.rb
===================================================================
--- sample/rdoc/markup/sample.rb	(revision 0)
+++ sample/rdoc/markup/sample.rb	(revision 14761)
@@ -0,0 +1,40 @@
+# This program illustrates the basic use of the SimpleMarkup
+# class. It extracts the first comment block from the
+# simple_markup.rb file and converts it into HTML on
+# standard output. Run it using
+#
+#  % ruby sample.rb
+#
+# You should be in the sample/rdoc/markup/ directory when you do this,
+# as it hardwires the path to the files it needs to require.
+# This isn't necessary in the code you write once you've
+# installed the package.
+#
+# For a better way of formatting code comment blocks (and more)
+# see the rdoc package.
+#
+
+require 'rdoc/markup/simple_markup'
+require 'rdoc/markup/simple_markup/to_html'
+
+# Extract the comment block from the source file
+
+input_string = ""
+
+File.foreach("../../../lib/rdoc/markup/simple_markup.rb") do |line|
+  break unless line.gsub!(/^\# ?/, '')
+  input_string << line
+end
+
+# Create a markup object
+markup = SM::SimpleMarkup.new
+
+# Attach it to an HTML formatter
+h = SM::ToHtml.new
+
+# And convert out comment block to html. Wrap it a body
+# tag pair to let browsers view it
+
+puts "<html><body>"
+puts markup.convert(input_string, h)
+puts "</body></html>"

Property changes on: sample/rdoc/markup/sample.rb
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + LF

Index: sample/rdoc/markup/rdoc2latex.rb
===================================================================
--- sample/rdoc/markup/rdoc2latex.rb	(revision 0)
+++ sample/rdoc/markup/rdoc2latex.rb	(revision 14761)
@@ -0,0 +1,16 @@
+#!/usr/local/bin/ruby
+# Illustration of a script to convert an RDoc-style file to a LaTeX
+# document
+
+require 'rdoc/markup/simple_markup'
+require 'rdoc/markup/simple_markup/to_latex'
+
+p = SM::SimpleMarkup.new
+h = SM::ToLaTeX.new
+
+#puts "\\documentclass{report}"
+#puts "\\usepackage{tabularx}"
+#puts "\\usepackage{parskip}"
+#puts "\\begin{document}"
+puts p.convert(ARGF.read, h)
+#puts "\\end{document}"

Property changes on: sample/rdoc/markup/rdoc2latex.rb
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + LF


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]