[ 
https://issues.apache.org/jira/browse/JSPWIKI-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136994#comment-18136994
 ] 

Arturo Bernal commented on JSPWIKI-1065:
----------------------------------------

Cause: TableOfContents parses the saved text of the page with itself as heading 
listener and does not run plugins. The parser calls 
ParserStagePlugin.executeParser while parsing, in document order, with the 
context it was given. The headings of an inserted page have ids with the name 
of that page, so they must be parsed with the context of the inserted page, as 
InsertPage does.

A) InsertPage implements ParserStagePlugin and, when the context carries a 
heading listener set by TableOfContents, parses the inserted page with the same 
checks as execute (view permission, circular reference, section, maxlength). 
Order follows the page; it needs a context variable defined in the API.
B) TableOfContents renders the page and reads the headings. Alex warned it may 
loop; the plugin has a guard against re-entry (VAR_ALREADY_PROCESSING) and I 
did not check if it is enough.
C) Parse the inserted pages after the host page. Simplest, but their headings 
would come after those of the host page.

None is prototyped. PR 558 (JSPWIKI-584) changes the text that TableOfContents 
reads, so this should go after it or on top of it. Is a new constant in 
jspwiki-api acceptable, or should the change stay inside the plugins? Same root 
cause as JSPWIKI-1066.

> Inserted page content is not included in table of contents
> ----------------------------------------------------------
>
>                 Key: JSPWIKI-1065
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-1065
>             Project: JSPWiki
>          Issue Type: Bug
>            Reporter: Harvey Echain
>            Priority: Minor
>
> Given this:
> [{TableOfContents}]
> [{InsertPage page="MyPage"}]
>  
> The heading titles of MyPage are not included within the table of contents, 
> which is not the expected behavior.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to