In Files
- rdoc/markup/to_tt_only.rb
Parent
Class/Module Index
- RDoc
- RDoc::Alias
- RDoc::AnonClass
- RDoc::AnyMethod
- RDoc::Attr
- RDoc::ClassModule
- RDoc::CodeObject
- RDoc::Comment
- RDoc::Constant
- RDoc::Context
- RDoc::Context::Section
- RDoc::CrossReference
- RDoc::ERBIO
- RDoc::ERBPartial
- RDoc::Encoding
- RDoc::Error
- RDoc::Extend
- RDoc::Generator
- RDoc::Generator::Darkfish
- RDoc::Generator::JsonIndex
- RDoc::Generator::Markup
- RDoc::Generator::POT
- RDoc::Generator::POT::MessageExtractor
- RDoc::Generator::POT::PO
- RDoc::Generator::POT::POEntry
- RDoc::Generator::RI
- RDoc::GhostMethod
- RDoc::I18n
- RDoc::I18n::Locale
- RDoc::I18n::Text
- RDoc::Include
- RDoc::Markdown
- RDoc::Markdown::Literals
- RDoc::Markup
- RDoc::Markup::AttrChanger
- RDoc::Markup::AttrSpan
- RDoc::Markup::AttributeManager
- RDoc::Markup::Attributes
- RDoc::Markup::BlankLine
- RDoc::Markup::BlockQuote
- RDoc::Markup::Document
- RDoc::Markup::Formatter
- RDoc::Markup::FormatterTestCase
- RDoc::Markup::HardBreak
- RDoc::Markup::Include
- RDoc::Markup::IndentedParagraph
- RDoc::Markup::List
- RDoc::Markup::ListItem
- RDoc::Markup::Paragraph
- RDoc::Markup::Parser
- RDoc::Markup::Parser::Error
- RDoc::Markup::Parser::ParseError
- RDoc::Markup::PreProcess
- RDoc::Markup::Raw
- RDoc::Markup::Rule
- RDoc::Markup::Special
- RDoc::Markup::TextFormatterTestCase
- RDoc::Markup::ToAnsi
- RDoc::Markup::ToBs
- RDoc::Markup::ToHtml
- RDoc::Markup::ToHtmlCrossref
- RDoc::Markup::ToHtmlSnippet
- RDoc::Markup::ToJoinedParagraph
- RDoc::Markup::ToLabel
- RDoc::Markup::ToMarkdown
- RDoc::Markup::ToRdoc
- RDoc::Markup::ToTableOfContents
- RDoc::Markup::ToTest
- RDoc::Markup::ToTtOnly
- RDoc::Markup::Verbatim
- RDoc::MetaMethod
- RDoc::MethodAttr
- RDoc::Mixin
- RDoc::NormalClass
- RDoc::NormalModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::Parser::ChangeLog
- RDoc::Parser::Markdown
- RDoc::Parser::RD
- RDoc::Parser::Ruby
- RDoc::Parser::RubyTools
- RDoc::Parser::Simple
- RDoc::Parser::Text
- RDoc::RD
- RDoc::RD::BlockParser
- RDoc::RD::Inline
- RDoc::RD::InlineParser
- RDoc::RDoc
- RDoc::RI
- RDoc::RI::Driver
- RDoc::RI::Driver::Error
- RDoc::RI::Driver::NotFoundError
- RDoc::RI::Error
- RDoc::RI::Paths
- RDoc::RI::Task
- RDoc::Require
- RDoc::RubyLex
- RDoc::RubyLex::Error
- RDoc::RubyToken
- RDoc::RubygemsHook
- RDoc::Servlet
- RDoc::SingleClass
- RDoc::Stats
- RDoc::Stats::Normal
- RDoc::Stats::Quiet
- RDoc::Stats::Verbose
- RDoc::Store
- RDoc::Store::Error
- RDoc::Store::MissingFileError
- RDoc::Task
- RDoc::TestCase
- RDoc::Text
- RDoc::TokenStream
- RDoc::TomDoc
- RDoc::TopLevel
- RDocTask
- Test
RDoc::Markup::ToTtOnly
frozen_string_literal: false
Extracts sections of text enclosed in plus, tt or code. Used to discover undocumented parameters.
Public Class Methods
Public Instance Methods
accept_block_quote(block_quote)
Adds tts from block_quote
to the output
# File rdoc/markup/to_tt_only.rb, line 30 def accept_block_quote block_quote tt_sections block_quote.text end
accept_list_end(list)
Pops the list type for list
from list_type
# File rdoc/markup/to_tt_only.rb, line 37 def accept_list_end list @list_type.pop end
accept_list_item_start(list_item)
Prepares the visitor for consuming list_item
# File rdoc/markup/to_tt_only.rb, line 51 def accept_list_item_start list_item case @list_type.last when :NOTE, :LABEL then Array(list_item.label).map do |label| tt_sections label end.flatten end end
accept_list_start(list)
Pushes the list type for list
onto list_type
# File rdoc/markup/to_tt_only.rb, line 44 def accept_list_start list @list_type << list.type end
accept_paragraph(paragraph)
Adds paragraph
to the output
# File rdoc/markup/to_tt_only.rb, line 63 def accept_paragraph paragraph tt_sections(paragraph.text) end
do_nothing(markup_item)
Does nothing to markup_item
because it doesn’t have any
user-built content
# File rdoc/markup/to_tt_only.rb, line 71 def do_nothing markup_item end
Also aliased as: accept_blank_line, accept_heading, accept_list_item_end, accept_raw, accept_rule, accept_verbatim
end_accepting()
Returns an Array of items that were wrapped in plus, tt or code.
# File rdoc/markup/to_tt_only.rb, line 107 def end_accepting @res.compact end
start_accepting()
Prepares the visitor for gathering tt sections
# File rdoc/markup/to_tt_only.rb, line 114 def start_accepting @res = [] @list_type = [] end
tt_sections(text)
Extracts tt sections from text
# File rdoc/markup/to_tt_only.rb, line 84 def tt_sections text flow = @am.flow text.dup flow.each do |item| case item when String then @res << item if in_tt? when RDoc::Markup::AttrChanger then off_tags res, item on_tags res, item when RDoc::Markup::Special then @res << convert_special(item) if in_tt? # TODO can this happen? else raise "Unknown flow element: #{item.inspect}" end end res end