Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request improves the way in which code listing blocks in extra file objects are matched.
In the result, listings in extra file objects written in AsciiDoc are now properly enriched with YARD: the syntax is highlighted, and the identifiers are linked with their respective documentation.
Fixes #1239 (went with option 2).
Details
The regular expression used for code blocks detection has been significantly relaxed. The updated one makes no assumptions on what HTML attributes can be set on
<pre>
or<code>
element, allowing everything. It still requires that the listing's outermost element is<pre>
, but this seems to be a reasonable limitation.The programming language detection still considers the values of
class
andlang
HTML attributes. Moreover,data-lang
attribute, which is produced by AsciiDoctor markup processor, is also supported now.Finally, this pull request properly ensures that code blocks produced from Ruby source files are not highlighted twice. It wasn't a problem before only because of a very lucky situation that code blocks produced by
html_markup_ruby
have a slightly different attributes, and that was preventing them from being erroneously double-highlighted.Completed Tasks
bundle exec rake
locally (if code is attached to PR).