1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix namespacing

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-01-17 19:29:16 +00:00
parent b6dff84acc
commit 6d59907c0f
3 changed files with 32 additions and 25 deletions

View file

@ -1,3 +1,9 @@
Fri Jan 18 04:27:57 2008 Eric Hodel <drbrain@segment7.net>
* sample/rdoc/markup/rdoc2latex.rb: Fix for new namespacing.
* lib/rdoc/markup/to_latex.rb: Fix namespacing.
Fri Jan 18 02:02:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bootstraptest/runner.rb (assert_valid_syntax): added.

View file

@ -29,13 +29,13 @@ class RDoc::Markup::ToLaTeX
end
LIST_TYPE_TO_LATEX = {
ListBase::BULLET => [ l("\\begin{itemize}"), l("\\end{itemize}") ],
ListBase::NUMBER => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\arabic" ],
ListBase::UPPERALPHA => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\Alph" ],
ListBase::LOWERALPHA => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\alph" ],
ListBase::LABELED => [ l("\\begin{description}"), l("\\end{description}") ],
ListBase::NOTE => [
l("\\begin{tabularx}{\\linewidth}{@{} l X @{}}"),
RDoc::Markup::ListBase::BULLET => [ l("\\begin{itemize}"), l("\\end{itemize}") ],
RDoc::Markup::ListBase::NUMBER => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\arabic" ],
RDoc::Markup::ListBase::UPPERALPHA => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\Alph" ],
RDoc::Markup::ListBase::LOWERALPHA => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\alph" ],
RDoc::Markup::ListBase::LABELED => [ l("\\begin{description}"), l("\\end{description}") ],
RDoc::Markup::ListBase::NOTE => [
l("\\begin{tabularx}{\\linewidth}{@{} l X @{}}"),
l("\\end{tabularx}") ],
}
@ -62,7 +62,7 @@ class RDoc::Markup::ToLaTeX
# Escape a LaTeX string
def escape(str)
$stderr.print "FE: ", str
$stderr.print "FE: ", str if $DEBUG_RDOC
s = str.
sub(/\s+$/, '').
gsub(/([_\${}&%#])/, "#{BS}\\1").
@ -73,7 +73,7 @@ $stderr.print "FE: ", str
gsub(/>/, GREATERTHAN).
gsub(/,,/, ",{},").
gsub(/\`/, BACKQUOTE)
$stderr.print "-> ", s, "\n"
$stderr.print "-> ", s, "\n" if $DEBUG_RDOC
s
end
@ -202,7 +202,7 @@ $stderr.print "-> ", s, "\n"
flow.each do |item|
case item
when String
$stderr.puts "Converting '#{item}'"
$stderr.puts "Converting '#{item}'" if $DEBUG_RDOC
res << convert_string(item)
when AttrChanger
off_tags(res, item)
@ -299,14 +299,15 @@ $stderr.print "-> ", s, "\n"
def list_item_start(am, fragment)
case fragment.type
when ListBase::BULLET, ListBase::NUMBER, ListBase::UPPERALPHA,
ListBase::LOWERALPHA
when RDoc::Markup::ListBase::BULLET, RDoc::Markup::ListBase::NUMBER,
RDoc::Markup::ListBase::UPPERALPHA,
RDoc::Markup::ListBase::LOWERALPHA then
"\\item "
when ListBase::LABELED
when RDoc::Markup::ListBase::LABELED then
"\\item[" + convert_flow(am.flow(fragment.param)) + "] "
when ListBase::NOTE
when RDoc::Markup::ListBase::NOTE then
convert_flow(am.flow(fragment.param)) + " & "
else
raise "Invalid list type"
@ -315,10 +316,13 @@ $stderr.print "-> ", s, "\n"
def list_end_for(fragment_type)
case fragment_type
when ListBase::BULLET, ListBase::NUMBER, ListBase::UPPERALPHA,
ListBase::LOWERALPHA, ListBase::LABELED
when RDoc::Markup::ListBase::BULLET,
RDoc::Markup::ListBase::NUMBER,
RDoc::Markup::ListBase::UPPERALPHA,
RDoc::Markup::ListBase::LOWERALPHA,
RDoc::Markup::ListBase::LABELED then
""
when ListBase::NOTE
when RDoc::Markup::ListBase::NOTE
"\\\\\n"
else
raise "Invalid list type"
@ -327,5 +331,3 @@ $stderr.print "-> ", s, "\n"
end
d

View file

@ -1,12 +1,11 @@
#!/usr/local/bin/ruby
# Illustration of a script to convert an RDoc-style file to a LaTeX
# document
# 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'
require 'rdoc/markup'
require 'rdoc/markup/to_latex'
p = SM::SimpleMarkup.new
h = SM::ToLaTeX.new
p = RDoc::Markup.new
h = RDoc::Markup::ToLaTeX.new
#puts "\\documentclass{report}"
#puts "\\usepackage{tabularx}"