Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
6.0-rc-1
-
None
-
Unknown
-
Description
Old getSections() used to look for 1, 1.1, 1.1.1 etc and infer sections this way.
New getSections() uses the XDOM to get the number of headers and titles of each but it is unable to get the offset in the content so it sets the value to -1.
This is not an issue for general use because getSections() is nolonger used internally, having it's logic duplicated by XWikiDocument.getContentOfSection() and XWikiDocument.updateDocumentSection().
In XWikiDocument
// put -1 as index since there is no way to get the position of the header in the source int documentSectionIndex = -1;
This is not good because public API Document.getSections() calls this, returning -1 for all sections.
To test:
{{velocity}}
#foreach($sect in $xwiki.getDocument('Sandbox.WebHome').getSections())
$sect.getSectionIndex()
#end
{{/velocity}}