class

RDoc::CrossReference

v2_6_3 - Show latest stable - Superclass: Object

frozen_string_literal: true

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

Constants

ALL_CROSSREF_REGEXP = /\n(?:^|\\s)\n(\n(?:\n# A::B::C.meth\n#{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}\n\n# Stand-alone method\n| \\\\?#{METHOD_REGEXP_STR}\n\n# A::B::C\n| #{CLASS_REGEXP_STR}(?=[@\\s).?!,;<\\000]|\\z)\n\n# Things that look like filenames\n| (?:\\.\\.\\/)*[-\\/\\w]+[_\\/.][-\\w\\/.]+\n\n# Things that have markup suppressed\n| \\\\[^\\s<]\n)\n\n# labels for headings\n(?:@[\\w+%-]+)?\n)/x

CLASS_REGEXP_STR = '\\\\\\\\?((?:\\:{2})?[A-Z]\\w*(?:\\:\\:\\w+)*)'

CROSSREF_REGEXP = /(?:^|\\s)\n(\n(?:\n# A::B::C.meth\n#{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}\n\n# Stand-alone method (preceded by a #)\n| \\\\?\\##{METHOD_REGEXP_STR}\n\n# Stand-alone method (preceded by ::)\n| ::#{METHOD_REGEXP_STR}\n\n# A::B::C\n# The stuff after CLASS_REGEXP_STR is a\n# nasty hack. CLASS_REGEXP_STR unfortunately matches\n# words like dog and cat (these are legal "class"\n# names in Fortran 95). When a word is flagged as a\n# potential cross-reference, limitations in the markup\n# engine suppress other processing, such as typesetting.\n# This is particularly noticeable for contractions.\n# In order that words like "can't" not\n# be flagged as potential cross-references, only\n# flag potential class cross-references if the character\n# after the cross-reference is a space, sentence\n# punctuation, tag start character, or attribute\n# marker.\n| #{CLASS_REGEXP_STR}(?=[@\\s).?!,;<\\000]|\\z)\n\n# Things that look like filenames\n# The key thing is that there must be at least\n# one special character (period, slash, or\n# underscore).\n| (?:\\.\\.\\/)*[-\\/\\w]+[_\\/.][-\\w\\/.]+\n\n# Things that have markup suppressed\n# Don't process things like '\\<' in \\<tt>, though.\n# TODO: including < is a hack, not very satisfying.\n| \\\\[^\\s<]\n)\n\n# labels for headings\n(?:@[\\w+%-]+(?:\\.[\\w|%-]+)?)?\n)/x

METHOD_REGEXP_STR = '([a-z]\\w*[!?=]?|%|===|\\[\\]=?|<<|>>|-|\\+|\\*)(?:\\([\\w.+*/=<>-]*\\))?'

Attributes

[RW]seen

Files

  • lib/rdoc/cross_reference.rb