зеркало из https://github.com/github/ruby.git
* lib/rdoc/code_objects.rb: Make some attributes accessible for reuse.
* lib/rdoc/generator/html.rb: Pull out ContextUser classes and related methods for reuse. * lib/rdoc/generator.rb: Move ContextUser classes to RDoc::Generator::Context for reuse. * lib/rdoc/rdoc.rb: Make RDoc::RDoc initialization a little easier. * lib/rdoc/options.rb: Make RDoc::Options easier to use without parsing an ARGV. * lib/rdoc/markup/to_*.rb: Subclass RDoc::Markup::Formatter. * lib/rdoc/markup/formatter.rb: Add RDoc::Markup::Formatter to make RDoc markup conversion easier. * lib/rdoc/markup/fragments.rb: Make RDoc::Markup::ListItem easier to test. * lib/rdoc/markup/to_html_hyperlink.rb: Pulled out of the HTML generator for easier reusability. * lib/rdoc/markup.rb: Fix bug with labeled lists containing bullet lists. * lib/rdoc/generators/html/html.rb: Fix Constant display. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d44f24c47c
Коммит
455b051a00
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
Sun Feb 10 12:58:33 2008 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rdoc/code_objects.rb: Make some attributes accessible for reuse.
|
||||
* lib/rdoc/generator/html.rb: Pull out ContextUser classes and related
|
||||
methods for reuse.
|
||||
* lib/rdoc/generator.rb: Move ContextUser classes to
|
||||
RDoc::Generator::Context for reuse.
|
||||
* lib/rdoc/rdoc.rb: Make RDoc::RDoc initialization a little easier.
|
||||
* lib/rdoc/options.rb: Make RDoc::Options easier to use without
|
||||
parsing an ARGV.
|
||||
* lib/rdoc/markup/to_*.rb: Subclass RDoc::Markup::Formatter.
|
||||
* lib/rdoc/markup/formatter.rb: Add RDoc::Markup::Formatter to make
|
||||
RDoc markup conversion easier.
|
||||
* lib/rdoc/markup/fragments.rb: Make RDoc::Markup::ListItem easier to
|
||||
test.
|
||||
* lib/rdoc/markup/to_html_hyperlink.rb: Pulled out of the HTML
|
||||
generator for easier reusability.
|
||||
* lib/rdoc/markup.rb: Fix bug with labeled lists containing bullet
|
||||
lists.
|
||||
* lib/rdoc/generators/html/html.rb: Fix Constant display.
|
||||
|
||||
Sat Feb 9 23:44:29 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* missing/tgamma.c (tgamma): use lgamma_r if available.
|
||||
|
|
|
@ -5,10 +5,10 @@ require 'rdoc/tokenstream'
|
|||
|
||||
module RDoc
|
||||
|
||||
|
||||
##
|
||||
# We contain the common stuff for contexts (which are containers)
|
||||
# and other elements (methods, attributes and so on)
|
||||
#
|
||||
|
||||
class CodeObject
|
||||
|
||||
attr_accessor :parent
|
||||
|
@ -82,8 +82,7 @@ module RDoc
|
|||
# Access the code object's comment
|
||||
attr_reader :comment
|
||||
|
||||
# Update the comment, but don't overwrite a real comment
|
||||
# with an empty one
|
||||
# Update the comment, but don't overwrite a real comment with an empty one
|
||||
def comment=(comment)
|
||||
@comment = comment unless comment.empty?
|
||||
end
|
||||
|
@ -94,7 +93,7 @@ module RDoc
|
|||
# those directives. Wehn a comment is assigned, we then extract
|
||||
# out any matching directives and update our object
|
||||
|
||||
def CodeObject.attr_overridable(name, *aliases)
|
||||
def self.attr_overridable(name, *aliases)
|
||||
@overridables ||= {}
|
||||
|
||||
attr_accessor name
|
||||
|
@ -623,7 +622,7 @@ module RDoc
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
##
|
||||
# AnyMethod is the base class for objects representing methods
|
||||
|
||||
class AnyMethod < CodeObject
|
||||
|
@ -632,14 +631,18 @@ module RDoc
|
|||
attr_accessor :block_params
|
||||
attr_accessor :dont_rename_initialize
|
||||
attr_accessor :singleton
|
||||
attr_reader :aliases # list of other names for this method
|
||||
attr_accessor :is_alias_for # or a method we're aliasing
|
||||
attr_reader :text
|
||||
|
||||
# list of other names for this method
|
||||
attr_reader :aliases
|
||||
|
||||
# method we're aliasing
|
||||
attr_accessor :is_alias_for
|
||||
|
||||
attr_overridable :params, :param, :parameters, :parameter
|
||||
|
||||
attr_accessor :call_seq
|
||||
|
||||
|
||||
include TokenStream
|
||||
|
||||
def initialize(text, name)
|
||||
|
@ -693,7 +696,6 @@ $stderr.puts p
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# Represent an alias, which is an old_name/ new_name pair associated
|
||||
# with a particular context
|
||||
class Alias < CodeObject
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -478,14 +478,14 @@ EOF
|
|||
|
||||
<div class="name-list">
|
||||
<table summary="Constants">
|
||||
<% values["constants"].each do |constants| $stderr.puts({ :constants => constants }.inspect) %>
|
||||
<% values["constants"].each do |constants| %>
|
||||
<tr class="top-aligned-row context-row">
|
||||
<td class="context-item-name"><%= values["name"] %></td>
|
||||
<td class="context-item-name"><%= constants["name"] %></td>
|
||||
<td>=</td>
|
||||
<td class="context-item-value"><%= values["value"] %></td>
|
||||
<td class="context-item-value"><%= constants["value"] %></td>
|
||||
<% if values["desc"] then %>
|
||||
<td width="3em"> </td>
|
||||
<td class="context-item-desc"><%= values["desc"] %></td>
|
||||
<td class="context-item-desc"><%= constants["desc"] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end # values["constants"] %>
|
||||
|
|
|
@ -146,16 +146,16 @@ require 'rdoc'
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# p = RDoc::Markup.new
|
||||
# p.add_word_pair("{", "}", :STRIKE)
|
||||
# p.add_html("no", :STRIKE)
|
||||
# m = RDoc::Markup.new
|
||||
# m.add_word_pair("{", "}", :STRIKE)
|
||||
# m.add_html("no", :STRIKE)
|
||||
#
|
||||
# p.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
||||
# m.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
||||
#
|
||||
# h = WikiHtml.new
|
||||
# h.add_tag(:STRIKE, "<strike>", "</strike>")
|
||||
#
|
||||
# puts "<body>" + p.convert(ARGF.read, h) + "</body>"
|
||||
# puts "<body>" + m.convert(ARGF.read, h) + "</body>"
|
||||
#
|
||||
#--
|
||||
# Author:: Dave Thomas, dave@pragmaticprogrammer.com
|
||||
|
@ -194,7 +194,7 @@ class RDoc::Markup
|
|||
# identify significant chunks.
|
||||
|
||||
def initialize
|
||||
@am = AttributeManager.new
|
||||
@am = RDoc::Markup::AttributeManager.new
|
||||
@output = nil
|
||||
end
|
||||
|
||||
|
@ -234,15 +234,16 @@ class RDoc::Markup
|
|||
# display the result.
|
||||
|
||||
def convert(str, op)
|
||||
@lines = Lines.new(str.split(/\r?\n/).collect { |aLine|
|
||||
Line.new(aLine) })
|
||||
lines = str.split(/\r?\n/).map { |line| Line.new line }
|
||||
@lines = Lines.new lines
|
||||
|
||||
return "" if @lines.empty?
|
||||
@lines.normalize
|
||||
assign_types_to_lines
|
||||
group = group_lines
|
||||
# call the output formatter to handle the result
|
||||
# group.to_a.each {|i| p i}
|
||||
group.accept(@am, op)
|
||||
#group.each { |line| p line }
|
||||
group.accept @am, op
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -252,9 +253,8 @@ class RDoc::Markup
|
|||
# Blank, a paragraph, a list element, or verbatim text.
|
||||
|
||||
def assign_types_to_lines(margin = 0, level = 0)
|
||||
|
||||
while line = @lines.next
|
||||
if line.isBlank?
|
||||
if line.blank? then
|
||||
line.stamp :BLANK, level
|
||||
next
|
||||
end
|
||||
|
@ -289,7 +289,6 @@ class RDoc::Markup
|
|||
# text following them (* xxx, - xxx, and dd. xxx)
|
||||
|
||||
if SIMPLE_LIST_RE =~ active_line
|
||||
|
||||
offset = margin + $1.length
|
||||
prefix = $2
|
||||
prefix_length = prefix.length
|
||||
|
@ -308,7 +307,6 @@ class RDoc::Markup
|
|||
next
|
||||
end
|
||||
|
||||
|
||||
if LABEL_LIST_RE =~ active_line
|
||||
offset = margin + $1.length
|
||||
prefix = $2
|
||||
|
@ -366,22 +364,23 @@ class RDoc::Markup
|
|||
prefix_length = prefix.length
|
||||
text = line.text
|
||||
flag = nil
|
||||
|
||||
case prefix
|
||||
when /^\[/
|
||||
when /^\[/ then
|
||||
flag = :LABELED
|
||||
prefix = prefix[1, prefix.length-2]
|
||||
when /:$/
|
||||
when /:$/ then
|
||||
flag = :NOTE
|
||||
prefix.chop!
|
||||
else raise "Invalid List Type: #{self.inspect}"
|
||||
else
|
||||
raise "Invalid List Type: #{self.inspect}"
|
||||
end
|
||||
|
||||
# body is on the next line
|
||||
|
||||
if text.length <= offset
|
||||
if text.length <= offset then
|
||||
original_line = line
|
||||
line = @lines.next
|
||||
return(false) unless line
|
||||
return false unless line
|
||||
text = line.text
|
||||
|
||||
for i in 0..margin
|
||||
|
@ -390,15 +389,24 @@ class RDoc::Markup
|
|||
return false
|
||||
end
|
||||
end
|
||||
|
||||
i = margin
|
||||
i += 1 while text[i] == SPACE
|
||||
if i >= text.length
|
||||
|
||||
if i >= text.length then
|
||||
@lines.unget
|
||||
return false
|
||||
else
|
||||
offset = i
|
||||
prefix_length = 0
|
||||
@lines.delete(original_line)
|
||||
|
||||
if text[offset..-1] =~ SIMPLE_LIST_RE then
|
||||
@lines.unget
|
||||
line = original_line
|
||||
line.text = ''
|
||||
else
|
||||
@lines.delete original_line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -418,24 +426,26 @@ class RDoc::Markup
|
|||
def group_lines
|
||||
@lines.rewind
|
||||
|
||||
inList = false
|
||||
wantedType = wantedLevel = nil
|
||||
in_list = false
|
||||
wanted_type = wanted_level = nil
|
||||
|
||||
block = LineCollection.new
|
||||
group = nil
|
||||
|
||||
while line = @lines.next
|
||||
if line.level == wantedLevel and line.type == wantedType
|
||||
if line.level == wanted_level and line.type == wanted_type
|
||||
group.add_text(line.text)
|
||||
else
|
||||
group = block.fragment_for(line)
|
||||
block.add(group)
|
||||
|
||||
if line.type == :LIST
|
||||
wantedType = :PARAGRAPH
|
||||
wanted_type = :PARAGRAPH
|
||||
else
|
||||
wantedType = line.type
|
||||
wanted_type = line.type
|
||||
end
|
||||
wantedLevel = line.type == :HEADING ? line.param : line.level
|
||||
|
||||
wanted_level = line.type == :HEADING ? line.param : line.level
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -462,4 +472,5 @@ class RDoc::Markup
|
|||
end
|
||||
|
||||
require 'rdoc/markup/fragments'
|
||||
require 'rdoc/markup/inline'
|
||||
require 'rdoc/markup/lines'
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
require 'rdoc/markup'
|
||||
|
||||
class RDoc::Markup::Formatter
|
||||
|
||||
def initialize
|
||||
@markup = RDoc::Markup.new
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
@markup.convert content, self
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -83,10 +83,16 @@ class RDoc::Markup
|
|||
class ListItem < ListBase
|
||||
type_name :LIST
|
||||
|
||||
# def label
|
||||
# am = AttributeManager.new(@param)
|
||||
# am.flow
|
||||
# end
|
||||
def to_s
|
||||
text = if [:NOTE, :LABELED].include? type then
|
||||
"#{@param}: #{@txt}"
|
||||
else
|
||||
@txt
|
||||
end
|
||||
|
||||
"L#@level: #{type} #{self.class.name.split('::')[-1]}\n#{text}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ListStart < ListBase
|
||||
|
@ -311,9 +317,8 @@ class RDoc::Markup
|
|||
|
||||
def tidy_blank_lines
|
||||
(@fragments.size - 1).times do |i|
|
||||
if @fragments[i].kind_of?(BlankLine) and
|
||||
@fragments[i+1].kind_of?(ListEnd)
|
||||
@fragments[i], @fragments[i+1] = @fragments[i+1], @fragments[i]
|
||||
if BlankLine === @fragments[i] and ListEnd === @fragments[i+1] then
|
||||
@fragments[i], @fragments[i+1] = @fragments[i+1], @fragments[i]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ class RDoc::Markup
|
|||
@@name_to_bitmap = { :_SPECIAL_ => SPECIAL }
|
||||
@@next_bitmap = 2
|
||||
|
||||
def Attribute.bitmap_for(name)
|
||||
def self.bitmap_for(name)
|
||||
bitmap = @@name_to_bitmap[name]
|
||||
if !bitmap
|
||||
unless bitmap then
|
||||
bitmap = @@next_bitmap
|
||||
@@next_bitmap <<= 1
|
||||
@@name_to_bitmap[name] = bitmap
|
||||
|
@ -22,7 +22,7 @@ class RDoc::Markup
|
|||
bitmap
|
||||
end
|
||||
|
||||
def Attribute.as_string(bitmap)
|
||||
def self.as_string(bitmap)
|
||||
return "none" if bitmap.zero?
|
||||
res = []
|
||||
@@name_to_bitmap.each do |name, bit|
|
||||
|
@ -31,7 +31,7 @@ class RDoc::Markup
|
|||
res.join(",")
|
||||
end
|
||||
|
||||
def Attribute.each_name_of(bitmap)
|
||||
def self.each_name_of(bitmap)
|
||||
@@name_to_bitmap.each do |name, bit|
|
||||
next if bit == SPECIAL
|
||||
yield name.to_s if (bitmap & bit) != 0
|
||||
|
@ -85,14 +85,15 @@ class RDoc::Markup
|
|||
self.text == o.text && self.type == o.type
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Special: type=#{type}, name=#{RDoc::Markup::Attribute.as_string type}, text=#{text.dump}"
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#<RDoc::Markup::Special:0x%x @type=%p, name=%p @text=%p>" % [
|
||||
object_id, @type, RDoc::Markup::Attribute.as_string(type), text.dump]
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Special: type=#{type}, name=#{RDoc::Markup::Attribute.as_string type}, text=#{text.dump}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class AttributeManager
|
||||
|
@ -165,8 +166,10 @@ class RDoc::Markup
|
|||
def convert_attrs(str, attrs)
|
||||
# first do matching ones
|
||||
tags = MATCHING_WORD_PAIRS.keys.join("")
|
||||
|
||||
re = "(^|\\W)([#{tags}])([A-Za-z_]+?)\\2(\\W|\$)"
|
||||
# re = "(^|\\W)([#{tags}])(\\S+?)\\2(\\W|\$)"
|
||||
|
||||
1 while str.gsub!(Regexp.new(re)) {
|
||||
attr = MATCHING_WORD_PAIRS[$2];
|
||||
attrs.set_attrs($`.length + $1.length + $2.length, $3.length, attr)
|
||||
|
@ -185,9 +188,9 @@ class RDoc::Markup
|
|||
end
|
||||
|
||||
def convert_html(str, attrs)
|
||||
tags = HTML_TAGS.keys.join("|")
|
||||
re = "<(#{tags})>(.*?)</\\1>"
|
||||
1 while str.gsub!(Regexp.new(re, Regexp::IGNORECASE)) {
|
||||
tags = HTML_TAGS.keys.join '|'
|
||||
|
||||
1 while str.gsub!(/<(#{tags})>(.*?)<\/\1>/i) {
|
||||
attr = HTML_TAGS[$1.downcase]
|
||||
html_length = $1.length + 2
|
||||
seq = NULL * html_length
|
||||
|
@ -210,7 +213,7 @@ class RDoc::Markup
|
|||
# A \ in front of a character that would normally be processed turns off
|
||||
# processing. We do this by turning \< into <#{PROTECT}
|
||||
|
||||
PROTECTABLE = [ "<" << "\\" ] #"
|
||||
PROTECTABLE = [ "<" << "\\" ]
|
||||
|
||||
|
||||
def mask_protected_sequences
|
||||
|
@ -300,7 +303,6 @@ class RDoc::Markup
|
|||
end
|
||||
|
||||
def split_into_flow
|
||||
|
||||
display_attributes if $DEBUG_RDOC
|
||||
|
||||
res = []
|
||||
|
|
|
@ -59,8 +59,8 @@ class RDoc::Markup
|
|||
end
|
||||
|
||||
# Return true if this line is blank
|
||||
def isBlank?
|
||||
@text.length.zero?
|
||||
def blank?
|
||||
@text.empty?
|
||||
end
|
||||
|
||||
# stamp a line with a type, a level, a prefix, and a flag
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require 'rdoc/markup/formatter'
|
||||
require 'rdoc/markup/fragments'
|
||||
require 'rdoc/markup/inline'
|
||||
require 'cgi'
|
||||
|
@ -22,7 +23,7 @@ class RDoc::Markup
|
|||
H = Struct.new(:level, :text)
|
||||
end
|
||||
|
||||
class ToFlow
|
||||
class ToFlow < RDoc::Markup::Formatter
|
||||
LIST_TYPE_TO_HTML = {
|
||||
:BULLET => [ "<ul>", "</ul>" ],
|
||||
:NUMBER => [ "<ol>", "</ol>" ],
|
||||
|
@ -35,6 +36,8 @@ class RDoc::Markup
|
|||
InlineTag = Struct.new(:bit, :on, :off)
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
||||
init_tags
|
||||
end
|
||||
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
require 'rdoc/markup/formatter'
|
||||
require 'rdoc/markup/fragments'
|
||||
require 'rdoc/markup/inline'
|
||||
|
||||
require 'cgi'
|
||||
|
||||
class RDoc::Markup::ToHtml
|
||||
class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
||||
|
||||
LIST_TYPE_TO_HTML = {
|
||||
:BULLET => [ "<ul>", "</ul>" ],
|
||||
:NUMBER => [ "<ol>", "</ol>" ],
|
||||
:UPPERALPHA => [ "<ol>", "</ol>" ],
|
||||
:LOWERALPHA => [ "<ol>", "</ol>" ],
|
||||
:LABELED => [ "<dl>", "</dl>" ],
|
||||
:NOTE => [ "<table>", "</table>" ],
|
||||
:BULLET => %w[<ul> </ul>],
|
||||
:NUMBER => %w[<ol> </ol>],
|
||||
:UPPERALPHA => %w[<ol> </ol>],
|
||||
:LOWERALPHA => %w[<ol> </ol>],
|
||||
:LABELED => %w[<dl> </dl>],
|
||||
:NOTE => %w[<table> </table>],
|
||||
}
|
||||
|
||||
InlineTag = Struct.new(:bit, :on, :off)
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
||||
init_tags
|
||||
end
|
||||
|
||||
|
@ -94,8 +97,11 @@ class RDoc::Markup::ToHtml
|
|||
if tag = @in_list_entry.last
|
||||
@res << annotate(tag) << "\n"
|
||||
end
|
||||
|
||||
@res << list_item_start(am, fragment)
|
||||
|
||||
@res << wrap(convert_flow(am.flow(fragment.txt))) << "\n"
|
||||
|
||||
@in_list_entry[-1] = list_end_for(fragment.type)
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
require 'rdoc/markup/to_html'
|
||||
|
||||
##
|
||||
# Subclass of the RDoc::Markup::ToHtml class that supports looking up words in
|
||||
# the AllReferences list. Those that are found (like AllReferences in this
|
||||
# comment) will be hyperlinked
|
||||
|
||||
class RDoc::Markup::ToHtmlHyperlink < RDoc::Markup::ToHtml
|
||||
|
||||
attr_accessor :context
|
||||
|
||||
##
|
||||
# We need to record the html path of our caller so we can generate
|
||||
# correct relative paths for any hyperlinks that we find
|
||||
|
||||
def initialize(from_path, context, show_hash)
|
||||
super()
|
||||
|
||||
# class names, variable names, or instance variables
|
||||
@markup.add_special(/(
|
||||
# A::B.meth(**) (for operator in Fortran95)
|
||||
\w+(::\w+)*[.\#]\w+(\([\.\w+\*\/\+\-\=\<\>]+\))?
|
||||
# meth(**) (for operator in Fortran95)
|
||||
| \#\w+(\([.\w\*\/\+\-\=\<\>]+\))?
|
||||
| \b([A-Z]\w*(::\w+)*[.\#]\w+) # A::B.meth
|
||||
| \b([A-Z]\w+(::\w+)*) # A::B
|
||||
| \#\w+[!?=]? # #meth_name
|
||||
| \\?\b\w+([_\/\.]+\w+)*[!?=]? # meth_name
|
||||
)/x,
|
||||
:CROSSREF)
|
||||
|
||||
# external hyperlinks
|
||||
@markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
|
||||
|
||||
# and links of the form <text>[<url>]
|
||||
@markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
|
||||
|
||||
@from_path = from_path
|
||||
@context = context
|
||||
@show_hash = show_hash
|
||||
|
||||
@seen = {}
|
||||
end
|
||||
|
||||
##
|
||||
# We're invoked when any text matches the CROSSREF pattern
|
||||
# (defined in MarkUp). If we fine the corresponding reference,
|
||||
# generate a hyperlink. If the name we're looking for contains
|
||||
# no punctuation, we look for it up the module/class chain. For
|
||||
# example, HyperlinkHtml is found, even without the Generator::
|
||||
# prefix, because we look for it in module Generator first.
|
||||
|
||||
def handle_special_CROSSREF(special)
|
||||
name = special.text
|
||||
|
||||
return @seen[name] if @seen.include? name
|
||||
|
||||
if name[0,1] == '#' then
|
||||
lookup = name[1..-1]
|
||||
name = lookup unless @show_hash
|
||||
else
|
||||
lookup = name
|
||||
end
|
||||
|
||||
# Find class, module, or method in class or module.
|
||||
if /([A-Z]\w*)[.\#](\w+[!?=]?)/ =~ lookup then
|
||||
container = $1
|
||||
method = $2
|
||||
ref = @context.find_symbol container, method
|
||||
elsif /([A-Za-z]\w*)[.\#](\w+(\([\.\w+\*\/\+\-\=\<\>]+\))?)/ =~ lookup then
|
||||
container = $1
|
||||
method = $2
|
||||
ref = @context.find_symbol container, method
|
||||
else
|
||||
ref = @context.find_symbol lookup
|
||||
end
|
||||
|
||||
out = if lookup =~ /^\\/ then
|
||||
$'
|
||||
elsif ref and ref.document_self then
|
||||
"<a href=\"#{ref.as_href(@from_path)}\">#{name}</a>"
|
||||
else
|
||||
name
|
||||
end
|
||||
|
||||
@seen[name] = out
|
||||
|
||||
out
|
||||
end
|
||||
|
||||
##
|
||||
# Generate a hyperlink for url, labeled with text. Handle the
|
||||
# special cases for img: and link: described under handle_special_HYPEDLINK
|
||||
|
||||
def gen_url(url, text)
|
||||
if url =~ /([A-Za-z]+):(.*)/ then
|
||||
type = $1
|
||||
path = $2
|
||||
else
|
||||
type = "http"
|
||||
path = url
|
||||
url = "http://#{url}"
|
||||
end
|
||||
|
||||
if type == "link" then
|
||||
url = if path[0, 1] == '#' then # is this meaningful?
|
||||
path
|
||||
else
|
||||
HTML.gen_url @from_path, path
|
||||
end
|
||||
end
|
||||
|
||||
if (type == "http" or type == "link") and
|
||||
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
|
||||
"<img src=\"#{url}\" />"
|
||||
else
|
||||
"<a href=\"#{url}\">#{text.sub(%r{^#{type}:/*}, '')}</a>"
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# And we're invoked with a potential external hyperlink mailto:
|
||||
# just gets inserted. http: links are checked to see if they
|
||||
# reference an image. If so, that image gets inserted using an
|
||||
# <img> tag. Otherwise a conventional <a href> is used. We also
|
||||
# support a special type of hyperlink, link:, which is a reference
|
||||
# to a local file whose path is relative to the --op directory.
|
||||
|
||||
def handle_special_HYPERLINK(special)
|
||||
url = special.text
|
||||
gen_url url, url
|
||||
end
|
||||
|
||||
##
|
||||
# Here's a hypedlink where the label is different to the URL
|
||||
# <label>[url]
|
||||
|
||||
def handle_special_TIDYLINK(special)
|
||||
text = special.text
|
||||
|
||||
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
|
||||
|
||||
label = $1
|
||||
url = $2
|
||||
gen_url url, label
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
require 'rdoc/markup/formatter'
|
||||
require 'rdoc/markup/fragments'
|
||||
require 'rdoc/markup/inline'
|
||||
|
||||
|
@ -6,7 +7,7 @@ require 'cgi'
|
|||
##
|
||||
# Convert SimpleMarkup to basic LaTeX report format.
|
||||
|
||||
class RDoc::Markup::ToLaTeX
|
||||
class RDoc::Markup::ToLaTeX < RDoc::Markup::Formatter
|
||||
|
||||
BS = "\020" # \
|
||||
OB = "\021" # {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
require 'rdoc/markup'
|
||||
require 'rdoc/markup/formatter'
|
||||
|
||||
##
|
||||
# This Markup outputter is used for testing purposes.
|
||||
|
||||
class RDoc::Markup::ToTest
|
||||
class RDoc::Markup::ToTest < RDoc::Markup::Formatter
|
||||
|
||||
def start_accepting
|
||||
@res = []
|
||||
|
|
|
@ -49,7 +49,7 @@ class RDoc::Options
|
|||
##
|
||||
# The list of files to be processed
|
||||
|
||||
attr_reader :files
|
||||
attr_accessor :files
|
||||
|
||||
##
|
||||
# Scan newer sources than the flag file if true.
|
||||
|
@ -74,7 +74,7 @@ class RDoc::Options
|
|||
##
|
||||
# Should source code be included inline, or displayed in a popup
|
||||
|
||||
attr_reader :inline_source
|
||||
attr_accessor :inline_source
|
||||
|
||||
##
|
||||
# Name of the file, class or module to display in the initial index page (if
|
||||
|
|
|
@ -53,13 +53,15 @@ module RDoc
|
|||
end
|
||||
end
|
||||
|
||||
private
|
||||
def initialize
|
||||
@stats = Stats.new
|
||||
end
|
||||
|
||||
##
|
||||
# Report an error message and exit
|
||||
|
||||
def error(msg)
|
||||
raise RDoc::Error, msg
|
||||
raise ::RDoc::Error, msg
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -206,8 +208,6 @@ module RDoc
|
|||
file_info
|
||||
end
|
||||
|
||||
public
|
||||
|
||||
##
|
||||
# Format up one or more files according to the given arguments.
|
||||
#
|
||||
|
@ -223,8 +223,6 @@ module RDoc
|
|||
def document(argv)
|
||||
TopLevel::reset
|
||||
|
||||
@stats = Stats.new
|
||||
|
||||
options = Options.new GENERATORS
|
||||
options.parse argv
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def line_groups(str, expected)
|
||||
p = RDoc::Markup.new
|
||||
m = RDoc::Markup.new
|
||||
mock = RDoc::Markup::ToTest.new
|
||||
|
||||
block = p.convert(str, mock)
|
||||
block = m.convert(str, mock)
|
||||
|
||||
if block != expected
|
||||
rows = (0...([expected.size, block.size].max)).collect{|i|
|
||||
|
@ -29,10 +29,10 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def line_types(str, expected)
|
||||
p = RDoc::Markup.new
|
||||
m = RDoc::Markup.new
|
||||
mock = RDoc::Markup::ToTest.new
|
||||
p.convert(str, mock)
|
||||
assert_equal(expected, p.get_line_types.map{|type| type.to_s[0,1]}.join(''))
|
||||
m.convert(str, mock)
|
||||
assert_equal(expected, m.get_line_types.map{|type| type.to_s[0,1]}.join(''))
|
||||
end
|
||||
|
||||
def test_groups
|
||||
|
@ -68,8 +68,8 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: BULLET ListItem\nl1",
|
||||
"L1: BULLET ListItem\nl2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -83,8 +83,8 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1 l1+",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: BULLET ListItem\nl1 l1+",
|
||||
"L1: BULLET ListItem\nl2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -98,11 +98,11 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1",
|
||||
"L1: BULLET ListItem\nl1",
|
||||
"L2: ListStart\n",
|
||||
"L2: ListItem\nl1.1",
|
||||
"L2: BULLET ListItem\nl1.1",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: BULLET ListItem\nl2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -122,13 +122,13 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1",
|
||||
"L1: BULLET ListItem\nl1",
|
||||
"L2: ListStart\n",
|
||||
"L2: ListItem\nl1.1 text",
|
||||
"L2: BULLET ListItem\nl1.1 text",
|
||||
"L2: Verbatim\n code\n code\n",
|
||||
"L2: Paragraph\ntext",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: BULLET ListItem\nl2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -143,11 +143,11 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1",
|
||||
"L1: NUMBER ListItem\nl1",
|
||||
"L2: ListStart\n",
|
||||
"L2: ListItem\nl1.1",
|
||||
"L2: BULLET ListItem\nl1.1",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: NUMBER ListItem\nl2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -161,11 +161,11 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1",
|
||||
"L1: LABELED ListItem\ncat: l1",
|
||||
"L2: ListStart\n",
|
||||
"L2: ListItem\nl1.1",
|
||||
"L2: BULLET ListItem\nl1.1",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: LABELED ListItem\ndog: l2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -179,8 +179,8 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1 continuation",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: LABELED ListItem\ncat: l1 continuation",
|
||||
"L1: LABELED ListItem\ndog: l2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
@ -218,6 +218,133 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
|
||||
end
|
||||
|
||||
def test_list_alpha
|
||||
str = "a. alpha\nb. baker\nB. ALPHA\nA. BAKER"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: LOWERALPHA ListItem\nalpha",
|
||||
"L1: LOWERALPHA ListItem\nbaker",
|
||||
"L1: ListEnd\n",
|
||||
"L1: ListStart\n",
|
||||
"L1: UPPERALPHA ListItem\nALPHA",
|
||||
"L1: UPPERALPHA ListItem\nBAKER",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_bullet_dash
|
||||
str = "- one\n- two\n"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: BULLET ListItem\none",
|
||||
"L1: BULLET ListItem\ntwo",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_bullet_star
|
||||
str = "* one\n* two\n"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: BULLET ListItem\none",
|
||||
"L1: BULLET ListItem\ntwo",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_labeled_bracket
|
||||
str = "[one] item one\n[two] item two"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: LABELED ListItem\none: item one",
|
||||
"L1: LABELED ListItem\ntwo: item two",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_labeled_bracket_continued
|
||||
str = "[one]\n item one\n[two]\n item two"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: LABELED ListItem\none: item one",
|
||||
"L1: LABELED ListItem\ntwo: item two",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_labeled_colon
|
||||
str = "one:: item one\ntwo:: item two"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: NOTE ListItem\none:: item one",
|
||||
"L1: NOTE ListItem\ntwo:: item two",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_labeled_colon_continued
|
||||
str = "one::\n item one\ntwo::\n item two"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: NOTE ListItem\none:: item one",
|
||||
"L1: NOTE ListItem\ntwo:: item two",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_nested_bullet_bullet
|
||||
str = "* one\n* two\n * cat\n * dog"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: BULLET ListItem\none",
|
||||
"L1: BULLET ListItem\ntwo",
|
||||
"L2: ListStart\n",
|
||||
"L2: BULLET ListItem\ncat",
|
||||
"L2: BULLET ListItem\ndog",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_nested_labeled_bullet
|
||||
str = "[one]\n * cat\n * dog"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: LABELED ListItem\none: ",
|
||||
"L2: ListStart\n",
|
||||
"L2: BULLET ListItem\ncat",
|
||||
"L2: BULLET ListItem\ndog",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_nested_labeled_bullet_bullet
|
||||
str = "[one]\n * cat\n * dog"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: LABELED ListItem\none: ",
|
||||
"L2: ListStart\n",
|
||||
"L2: BULLET ListItem\ncat",
|
||||
"L3: ListStart\n",
|
||||
"L3: BULLET ListItem\ndog",
|
||||
"L3: ListEnd\n",
|
||||
"L2: ListEnd\n",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_number
|
||||
str = "1. one\n2. two\n1. three"
|
||||
|
||||
line_groups(str,
|
||||
[ "L1: ListStart\n",
|
||||
"L1: NUMBER ListItem\none",
|
||||
"L1: NUMBER ListItem\ntwo",
|
||||
"L1: NUMBER ListItem\nthree",
|
||||
"L1: ListEnd\n" ])
|
||||
end
|
||||
|
||||
def test_list_split
|
||||
str = %{\
|
||||
now is
|
||||
|
@ -229,20 +356,30 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_groups(str,
|
||||
[ "L0: Paragraph\nnow is",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl1",
|
||||
"L1: BULLET ListItem\nl1",
|
||||
"L1: ListEnd\n",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nn1",
|
||||
"L1: ListItem\nn2",
|
||||
"L1: NUMBER ListItem\nn1",
|
||||
"L1: NUMBER ListItem\nn2",
|
||||
"L1: ListEnd\n",
|
||||
"L1: ListStart\n",
|
||||
"L1: ListItem\nl2",
|
||||
"L1: BULLET ListItem\nl2",
|
||||
"L1: ListEnd\n",
|
||||
"L0: Paragraph\nthe time"
|
||||
])
|
||||
|
||||
end
|
||||
|
||||
def test_paragraph
|
||||
str = "paragraph\n\n*bold* paragraph\n"
|
||||
|
||||
line_groups str, [
|
||||
"L0: Paragraph\nparagraph",
|
||||
"L0: BlankLine\n",
|
||||
"L0: Paragraph\n*bold* paragraph"
|
||||
]
|
||||
end
|
||||
|
||||
def test_tabs
|
||||
str = "hello\n dave"
|
||||
assert_equal(str, basic_conv(str))
|
||||
|
@ -345,6 +482,15 @@ class TestRDocMarkup < Test::Unit::TestCase
|
|||
line_types(str, 'PLPLP')
|
||||
end
|
||||
|
||||
def test_verbatim
|
||||
str = "paragraph\n *bold* verbatim\n"
|
||||
|
||||
line_groups str, [
|
||||
"L0: Paragraph\nparagraph",
|
||||
"L0: Verbatim\n *bold* verbatim\n"
|
||||
]
|
||||
end
|
||||
|
||||
def test_verbatim_merge
|
||||
str = %{\
|
||||
now is
|
||||
|
|
|
@ -31,9 +31,9 @@ class TestRDocMarkupAttributeManager < Test::Unit::TestCase
|
|||
crossref_bitmap = RDoc::Markup::Attribute.bitmap_for(:_SPECIAL_) |
|
||||
RDoc::Markup::Attribute.bitmap_for(:CROSSREF)
|
||||
|
||||
[ @am.changed_attribute_by_name([], [:CROSSREF] | [:_SPECIAL_]),
|
||||
[ @am.changed_attribute_by_name([], [:CROSSREF, :_SPECIAL_]),
|
||||
RDoc::Markup::Special.new(crossref_bitmap, text),
|
||||
@am.changed_attribute_by_name([:CROSSREF] | [:_SPECIAL_], [])
|
||||
@am.changed_attribute_by_name([:CROSSREF, :_SPECIAL_], [])
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -90,31 +90,46 @@ class TestRDocMarkupAttributeManager < Test::Unit::TestCase
|
|||
@am.flow("cat _a__nd_ *dog*"))
|
||||
end
|
||||
|
||||
def test_html_like
|
||||
assert_equal(["cat ", @tt_on, "dog", @tt_off], @am.flow("cat <tt>dog</Tt>"))
|
||||
def test_html_like_em_bold
|
||||
assert_equal ["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
|
||||
@am.flow("cat <i>and </i><b>dog</b>")
|
||||
end
|
||||
|
||||
assert_equal(["cat ", @em_on, "and", @em_off, " ", @bold_on, "dog", @bold_off],
|
||||
@am.flow("cat <i>and</i> <B>dog</b>"))
|
||||
|
||||
assert_equal(["cat ", @em_on, "and ", @em_then_bold, "dog", @bold_em_off],
|
||||
@am.flow("cat <i>and <B>dog</B></I>"))
|
||||
|
||||
assert_equal(["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
|
||||
@am.flow("cat <i>and </i><b>dog</b>"))
|
||||
|
||||
assert_equal(["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
|
||||
@am.flow("cat <i>and <b></i>dog</b>"))
|
||||
|
||||
assert_equal([@tt_on, "cat", @tt_off, " ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
|
||||
@am.flow("<tt>cat</tt> <i>and <b></i>dog</b>"))
|
||||
|
||||
assert_equal(["cat ", @em_on, "and ", @em_then_bold, "dog", @bold_em_off],
|
||||
@am.flow("cat <i>and <b>dog</b></i>"))
|
||||
def test_html_like_em_bold_SGML
|
||||
assert_equal ["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
|
||||
@am.flow("cat <i>and <b></i>dog</b>")
|
||||
end
|
||||
|
||||
def test_html_like_em_bold_nested_1
|
||||
assert_equal(["cat ", @bold_em_on, "and", @bold_em_off, " dog"],
|
||||
@am.flow("cat <i><b>and</b></i> dog"))
|
||||
end
|
||||
|
||||
def test_html_like_em_bold_nested_2
|
||||
assert_equal ["cat ", @em_on, "and ", @em_then_bold, "dog", @bold_em_off],
|
||||
@am.flow("cat <i>and <b>dog</b></i>")
|
||||
end
|
||||
|
||||
def test_html_like_em_bold_nested_mixed_case
|
||||
assert_equal ["cat ", @em_on, "and ", @em_then_bold, "dog", @bold_em_off],
|
||||
@am.flow("cat <i>and <B>dog</B></I>")
|
||||
end
|
||||
|
||||
def test_html_like_em_bold_mixed_case
|
||||
assert_equal ["cat ", @em_on, "and", @em_off, " ", @bold_on, "dog", @bold_off],
|
||||
@am.flow("cat <i>and</i> <B>dog</b>")
|
||||
end
|
||||
|
||||
def test_html_like_teletype
|
||||
assert_equal ["cat ", @tt_on, "dog", @tt_off],
|
||||
@am.flow("cat <tt>dog</Tt>")
|
||||
end
|
||||
|
||||
def test_html_like_teletype_em_bold_SGML
|
||||
assert_equal [@tt_on, "cat", @tt_off, " ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
|
||||
@am.flow("<tt>cat</tt> <i>and <b></i>dog</b>")
|
||||
end
|
||||
|
||||
def test_protect
|
||||
assert_equal(['cat \\ dog'], @am.flow('cat \\ dog'))
|
||||
|
||||
|
|
|
@ -250,6 +250,14 @@ class TestRDocRIFormatter < Test::Unit::TestCase
|
|||
assert_equal " a b c\n d e f\n\n", @output.string
|
||||
end
|
||||
|
||||
def test_display_verbatim_flow_item_bold
|
||||
verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
|
||||
|
||||
@f.display_verbatim_flow_item verbatim
|
||||
|
||||
assert_equal " *a* b c\n\n", @output.string
|
||||
end
|
||||
|
||||
def test_draw_line
|
||||
@f.draw_line
|
||||
|
||||
|
|
|
@ -18,6 +18,14 @@ class TestRDocRIOverstrikeFormatter < Test::Unit::TestCase
|
|||
@af = RDoc::RI::AttributeFormatter
|
||||
end
|
||||
|
||||
def test_display_verbatim_flow_item_bold
|
||||
verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
|
||||
|
||||
@f.display_verbatim_flow_item verbatim
|
||||
|
||||
assert_equal " *a* b c\n\n", @output.string
|
||||
end
|
||||
|
||||
def test_write_attribute_text_bold
|
||||
line = [RDoc::RI::AttributeFormatter::AttrChar.new('b', @af::BOLD)]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче