Problem/Motivation
API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Plugin%21...
Enter a descriptive title (above) relating to interface ContextProviderInterface, then describe the problem you have found:
The documentation block in code looks like this:
/**
* Defines an interface for providing plugin contexts.
*
* Implementations only need to deal with unqualified context IDs so they only
* need to be unique in the context of a given service provider.
*
* The fully qualified context ID then includes the service ID:
* @{service_id}:{unqualified_context_id}.
*
* @see \Drupal\Core\Plugin\Context\ContextRepositoryInterface
*/But in the API page this shows up mangled, because the "@{service_id}" is interpreted as a doxygen tag. It ends up looking like this:
The fully qualified context ID then includes the service ID: service_id}:{unqualified_context_id}.
While it should read:
The fully qualified context ID then includes the service ID: @{service_id}:{unqualified_context_id}.
Proposed resolution
There are two viable patches posted here:
- #3014969-2: Unescaped "@" in ContextProviderInterface doc comment escapes the @ - this is the same method as used elsewhere in core, see #213120: Escape \@.
- #3014969-4: Unescaped "@" in ContextProviderInterface doc comment puts the problem text in a @code/@endcode block.
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 3014969-patch-applied.png | 16.05 KB | abhijith s |
| #18 | 3014969-18.patch | 783 bytes | longwave |
| #4 | 3014969-4-escape-at-sign.patch | 653 bytes | tr |
| #2 | 3014969-2-escape-at-sign.patch | 630 bytes | tr |
Comments
Comment #2
tr commentedPatch.
Comment #3
joachim commentedI'm not keen on escaping things in docs -- they are meant to be readable by humans in text editors, primarily.
Would the problem be fixed by putting this in a @code block instead?
Comment #4
tr commentedDoc blocks are for the API module, to provide readable documentation on the api.drupal.org site.
It's broken now. I don't care how it's fixed. Escaping is used in other places in core, and I consider it semantically wrong to use @code for non-code text simply because we don't have a "preformatted" tag, but if you prefer @code instead of escaping here's an alternative patch ...
Comment #7
tr commentedI encountered this again yesterday. It's still broken ... see the documentation linked in the original post.
There are two viable patches here:
lib/Drupal/Core/Entity/entity.api.phpandlib/Drupal/Core/Language/language.api.phpComment #8
shimpyI also went through few core files.I think #2 works well because this doc is not a code related. So putting in @code block doesnot make any sense. Rather escaping it is a better idea.
Comment #9
joachim commentedEscaping looks ugly and confusing when you read the documentation directly in the code files.
Comment #10
tr commented@joachim: Patch #4 fixes this with @code - if that's what you prefer, how about a confirmation that it fixes the bug and an RTBC?
Comment #11
longwaveI *think* the problem is that
@{identifies the start of a docblock group. As this is just a pair of placeholders to show the format, can we sidestep the issue by using different syntax for the example? Could we say something like:Comment #13
tr commentedBump.
Comment #14
sivaji_ganesh_jojodae commented@codelooks like a dapper way of handling this.Comment #15
tr commentedComment #16
longwaveBoth #2 and #4 solve the problem, as would my suggestion in #11. RTBC for core committers to make a decision.
Comment #17
catchTo be honest I would go for the suggestion in #11 here - solves the problem with the least visual disruption.
Comment #18
longwaveImplemented #11.
Comment #20
longwaveRandom fail.
Comment #22
abhijith s commentedApplied patch #18 on 9.2.x and its works fine.
Comment #23
abhijith s commentedComment #26
catchCommitted/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!
Comment #28
catchActually all the way to 8.9.x since this is a docs fix.