Nested bullet lists not rendering correctly

mvc - September 26, 2009 - 00:39
Project:API
Version:6.x-1.2-beta4
Component:Parser
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:Needs tests
Description

I believe the page is missing a

halfway through the list of return values.

#1

mvc - September 26, 2009 - 00:40

Oops, should have hit preview.

I meant to say that it's missing a </ul> tag.

#2

jhodgdon - September 28, 2009 - 15:29
Title:Documentation problem with hook_block» Nested bullet lists not rendering correctly
Project:Drupal» API
Version:6.x-dev» 6.x-1.2-beta4
Component:documentation» Parser

This is rendering incorrectly due to a bug in the API module. The doc is written correctly, as you can see here:
http://api.drupal.org/api/drupal/developer--hooks--core.php/6/source

It looks like this:

* @return
*   - If $op is 'list': An array of block descriptions. Each block description
*     is an associative array, with the following key-value pairs:
*     - 'info': (required) The human-readable name of the block.
*     - 'cache': A bitmask of flags describing how the block should behave with
*       respect to block caching. The following shortcut bitmasks are provided
*       as constants in block.module:
*       - BLOCK_CACHE_PER_ROLE (default): The block can change depending on the
*         roles the user viewing the page belongs to.
*       - BLOCK_CACHE_PER_USER: The block can change depending on the user
*         viewing the page. This setting can be resource-consuming for sites
*         with large number of users, and should only be used when
*         BLOCK_CACHE_PER_ROLE is not sufficient.
*       - BLOCK_CACHE_PER_PAGE: The block can change depending on the page
*         being viewed.
*       - BLOCK_CACHE_GLOBAL: The block is the same for every user on every
*         page where it is visible.
*       - BLOCK_NO_CACHE: The block should not get cached.
*     - 'weight', 'status', 'region', 'visibility', 'pages':
*       You can give your blocks an explicit weight, enable them, limit them to
*       given pages, etc. These settings will be registered when the block is first
*       loaded at admin/block, and from there can be changed manually via block
*       administration.
*       Note that if you set a region that isn't available in a given theme, the
*       block will be registered instead to that theme's default region (the first
*       item in the _regions array).
*   - If $op is 'configure': optionally return the configuration form.
*   - If $op is 'save': return nothing.
*   - If $op is 'view': return an array which must define a 'subject' element
*     and a 'content' element defining the block indexed by $delta.

But it is not rendering correctly in the Return Value section, as you can see here:
http://api.drupal.org/api/function/hook_block/6

The "If $op is 'configure'" and later bullet points should be at the top level, not indented one level.

#3

drumm - October 5, 2009 - 00:05
Status:active» fixed

Committed a patch to fix this. The section was run through trim() before the bullets were processed, so the initial whitespace was gone and mismatched.

#4

jhodgdon - October 5, 2009 - 15:02

Great! Please push to a.d.o when you can. :)

#5

jhodgdon - October 5, 2009 - 15:03

And do you need a test written for this case?

#6

drumm - October 8, 2009 - 05:00

Sure! api_format_documentation_lists() itself actually didn't cause the issue, the calling code did the trimming. Hopefully there aren't side effects from not trimming.

#7

jhodgdon - October 8, 2009 - 13:59
Status:fixed» needs work

Marking back to "needs work" because it needs a test.

 
 

Drupal is a registered trademark of Dries Buytaert.