Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/rdoc/cross_reference.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require_relative 'markup/attribute_manager' # for PROTECT_ATTR

##
# RDoc::CrossReference is a reusable way to create cross references for names.

Expand Down Expand Up @@ -33,7 +31,7 @@ class RDoc::CrossReference
# See CLASS_REGEXP_STR

METHOD_REGEXP_STR = /(
(?!\d)[\w#{RDoc::Markup::AttributeManager::PROTECT_ATTR}]+[!?=]?|
(?!\d)[\w]+[!?=]?|
%|=(?:==?|~)|![=~]|\[\]=?|<(?:<|=>?)?|>[>=]?|[-+!]@?|\*\*?|[\/%\`|&^~]
)#{METHOD_ARGS_REGEXP_STR}/.source.delete("\n ").freeze

Expand Down
38 changes: 8 additions & 30 deletions lib/rdoc/markup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#
# class WikiHtml < RDoc::Markup::ToHtml
# def handle_regexp_WIKIWORD(target)
# "<font color=red>" + target.text + "</font>"
# "<font color=red>" + target + "</font>"
# end
# end
#
Expand Down Expand Up @@ -110,10 +110,10 @@

class RDoc::Markup

##
# An AttributeManager which handles inline markup.
# Array of regexp handling pattern and its name. A regexp handling
# sequence is something like a WikiWord

attr_reader :attribute_manager
attr_reader :regexp_handlings

##
# Parses +str+ into an RDoc::Markup::Document.
Expand Down Expand Up @@ -148,27 +148,11 @@ def self.parse(str)
# structure (paragraphs, lists, and so on). Invoke an event handler as we
# identify significant chunks.

def initialize(attribute_manager = nil)
@attribute_manager = attribute_manager || RDoc::Markup::AttributeManager.new
def initialize
@regexp_handlings = []
@output = nil
end

##
# Add to the sequences used to add formatting to an individual word (such
# as *bold*). Matching entries will generate attributes that the output
# formatters can recognize by their +name+.

def add_word_pair(start, stop, name)
@attribute_manager.add_word_pair(start, stop, name)
end

##
# Add to the sequences recognized as general markup.

def add_html(tag, name)
@attribute_manager.add_html(tag, name)
end

##
# Add to other inline sequences. For example, we could add WikiWords using
# something like:
Expand All @@ -178,7 +162,7 @@ def add_html(tag, name)
# Each wiki word will be presented to the output formatter.

def add_regexp_handling(pattern, name)
@attribute_manager.add_regexp_handling(pattern, name)
@regexp_handlings << [pattern, name]
end

##
Expand All @@ -197,15 +181,9 @@ def convert(input, formatter)
end

autoload :Parser, "#{__dir__}/markup/parser"
autoload :InlineParser, "#{__dir__}/markup/inline_parser"
autoload :PreProcess, "#{__dir__}/markup/pre_process"

# Inline markup classes
autoload :AttrChanger, "#{__dir__}/markup/attr_changer"
autoload :AttrSpan, "#{__dir__}/markup/attr_span"
autoload :Attributes, "#{__dir__}/markup/attributes"
autoload :AttributeManager, "#{__dir__}/markup/attribute_manager"
autoload :RegexpHandling, "#{__dir__}/markup/regexp_handling"

# RDoc::Markup AST
autoload :BlankLine, "#{__dir__}/markup/blank_line"
autoload :BlockQuote, "#{__dir__}/markup/block_quote"
Expand Down
22 changes: 0 additions & 22 deletions lib/rdoc/markup/attr_changer.rb

This file was deleted.

35 changes: 0 additions & 35 deletions lib/rdoc/markup/attr_span.rb

This file was deleted.

Loading
Loading