Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
At various places in the Drupal 8 documentation, number lists are used, but these are not rendered correctly. api_format_documentation_lists()
only supports unordered lists.
Some number lists in the documentation (search for "1." or "2." on the page):
https://api.drupal.org/api/drupal/core%21includes%21install.core.inc/fun...
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Asset%21A...
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Cache%21C...
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21Me...
Comment | File | Size | Author |
---|---|---|---|
#15 | number_lists_are_not-2457273-15.patch | 14.89 KB | Anonymous (not verified) |
#15 | interdiff-13-15.txt | 1.41 KB | Anonymous (not verified) |
#13 | number_lists_are_not-2457273_13.patch | 14.89 KB | Anonymous (not verified) |
#13 | interdiff-10_13.txt | 2.96 KB | Anonymous (not verified) |
#10 | number_lists_are_not-2457273-10.patch | 15.17 KB | Anonymous (not verified) |
Comments
Comment #1
jhodgdonI do not think 4 instances is enough to warrant adding this feature to the API module or to the coding standards. Let's instead fix the code docs to use bullet lists, which are well supported.
Comment #2
Sutharsan CreditAttribution: Sutharsan commentedThese 4 are just examples. I count 31 number lists in PHP and JS files.
Search pattern:
[\*|//] +2\.
Comment #3
jhodgdonWe are not parsing JS files in the API module... and the existing numbered lists are in violation of our current coding standards. Making changes to the standards is a pain, too.
So I guess the question is whether the numbered lists are really needed or not. I doubt that they are. From recent issues where these have been fixed in a few places, they're usually easy to replace with bullet lists, and the bullet lists are actually more readable from what I've seen.
Comment #4
drummAgreed replacing the lists with bullets would be a good solution.
If other documentation comment parsers support numbered lists, we can treat this as a Feature request to get parity with them.
Comment #5
jhodgdonIf we do, I doubt we'll support the syntax that is in Drupal Core now. Other parsers (markdown, etc.) use something like # or . as prefixes for numbered lists, not individual numbers on the items.
But I just don't see a strong reason to want to have them in Drupal docs right now.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedI count 30 occurences, see file attached. I think a patch that resolves this issue could be considered disruptive.
Fwiw, I searched using the regex by @Sutharsan in #2.
Comment #7
jhodgdonNumber lists in // comments are not a problem. These comments are not parsed/displayed. It's only in /** */ comments that we should not (currently) be using numbered lists.
It's also not a problem if the numbered items are in separate paragraphs, because (although it's probably not ideal) the numbered paragraphs will at least be rendered OK.
So the only problem is if someone creates a numbered list that is formatted like this:
If we have a *lot* of these, then it may be worth going through the (currently totally broken and always fairly lengthy) process of updating the comment/code standards to define a way to make numbered lists. But this will *still* probably require patching the comments, because the standard we should adopt is more in line with what other docs parsers do, something like what we do with bullet lists but using # instead of - for the list items.
I really don't think it's worth it. I still think there are not many places, and they aren't less understandable as bullet lists.
So let's just fix the bad lists, which I think are only a few spots.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedYou are right, only replacing the /* */ is sufficient and there aren't too many of these.
Comment #9
jhodgdonThanks! Yeah, not a lot of stuff to fix... So this is a good start, but the lists do not quite conform to our lists in docs standards -- see https://www.drupal.org/node/1354#lists
Some specific items to address (representative of what needs fixing, but not listing all spots that need fixing) -- basically the indentation, punctuation, and capitalization needs to be adjusted throughout:
There should not be a blank line between the explanation line ending in : and the start of the list.
In the indented bullet list, just indent 2 spaces. Also the bullet items should start with capital letters.
The second and third lines should be wrapped with the first one here, unless it's meant to be an indented bullet item, in which case it needs to start with - ... I think just wrap it.
Bullet items should start with capital letters. Also the second line of a bullet item should be indented just 2 spaces (it's 3 here).
Same problem as in CacheContexts... check rest of patch for this?
Bullet items should end in .
Before any list, there should be an explanation line ending in :
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedThank you for the feedback. I think I addressed all of it.
I was wondering if the repeated lines in LanguageUILanguageNegotiationTest (e.g. "- admin/config: Tests the UI using the precedence rules.") should get a single description?
Comment #12
jhodgdonYes, I think those repeated lines in LanguageUILanguageNegotiationTest would be good to consolidate. Maybe you can just say something like:
blah blah blah for each of these, the following are tested:
- admin/config etc.
Nice work consolidating that documentation block already, by the way! It is already a LOT more readable than the original in the code, and I'm sure *much* more readable on the API site with this patch.
So everything else in this patch looks perfect. Let's just fix this one area and get it in. Thanks!
(you probably figured this out but when you upload an interdiff, make the extension .txt so it will not get test bot review)
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedYeah, it's better now. I also fixed another wrong indentation.
edit: I noticed the interdiff extension too late, is there any way to change that afterwards?
Comment #14
jhodgdonActually, URL is correct in text, not Url. It's an acronym. It's just that in method names we use CamelCaseEvenForAcronymsLikeUrlAndHtml.
Changing PATH, BROWSER, etc. to lower-case is good though!
And here:
you don't want a space before the ,
Good catch in RendererPostRenderCacheTest.php -- I missed that one. Rest looks good!
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedAha, ok. And fixed the space.
Comment #16
jhodgdonLooks good now, thanks!
Comment #17
alexpottDocs are not frozen in beta. Committed 5ad5c13 and pushed to 8.0.x. Thanks!