Skip to content

Broken html when crossref matches #< without linking < #1743

Description

@4lllex

https://docs.ruby-lang.org/en/4.0/Encoding/Converter.html#method-i-convpath

<p>In the above example, [#&lt;Encoding:ISO-8859-1&gt;,
 <encoding:utf-8&gt;] means="" a="" converter="" from="" iso-8859-1="" to="" utf-8.="" “crlf_newline”="" newline="" lf="" crlf.<="" p="">
 </encoding:utf-8&gt;]>
</p>

Second #<Encoding with a leading space is matched:

"In the above example, [#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>] means"
  .match(RDoc::CrossReference::CROSSREF_REGEXP, 2)

# => #<MatchData " #<" 1:"#<" 2:nil 3:nil 4:nil 5:"<" 6:nil>

"<" doesn't get linked by handle_regexp_CROSSREF and assigns handled as unescaped text "<" which breaks html:

if matched_name
handled = public_send(:"handle_regexp_#{matched_name}", matched_text)
output << [handled, true]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions