Thank you for the feedback - I have been playing with passing custom parameters, and have a few additional clarification questions. It seems that I need to use pure wiki syntax if I want the TOC macro to work right. I am currently relying on the {{html}} macro for two things which I can't figure out how to replace with custom parameters: 1) Nested <ul>'s - I can only get the custom parameter to apply to one line, and can't figure out how to nest another <ul>. Something like this: (% class="mktree" name="tree" %) * $doc.display("Title", $obj) <velocity code, including an {{html}} block to create an <input> element> **Additional parts of tree ***Additional parts of tree Just returns two different <ul>'s, only the first one of which has the custom parameter. Is this because the additional lines of code before continuing the tree forces the rendering engine to close the first <ul>? Any way to override that? 2) Table Sorter - Unfortunately, the whole set of object display code is wrapped in an {{html}} macro because I am using the old Table Sorter extension code. This is because I want to display multiple properties from each object in a single table cell. Looking at the Live Table macro, it seems that it only supports binding a table to a class and then setting a column to display a single property - where I need a single cell to include multiple properties displayed using custom code. Accomplishing this using the html syntax is simple - I can include an arbitrary amount of code in each <td> tag. To use wiki syntax for a sortable table, the XWiki Syntax document says I should use this: (% class="grid sortable filterable doOddEven" id="tableid" %) (% class="sortHeader" %)|=Title 1|=Title 2 |Cell 11|Cell 12 |Cell 21|Cell 22 This creates the table fine - but I can't figure out how to include additional multi-line code in a single cell. As soon as I put in a new line, etc...it closes the table. Is there any way to accomplish this using wiki syntax? Should I be trying to use LiveTable instead somehow? If the above is confusing, here's what I'm really asking: I want to use a sortable table to display multiple objects of the same class on the same page. I would like that table to display multiple properties of each object in certain cells in the row. Some of those properties will contain wiki syntax - which I would like to be readable by the TOC macro after the table has been rendered. Is there a way to accomplish this? Thank you, Aaron On Thu, Oct 20, 2011 at 1:18 PM, Ashtar Communications <[email protected]> wrote:
Interesting - I had missed the ability to pass custom parameters using wiki syntax. I will play with that and see if I can get it to output the same html I need.
I am in fact using a series of nested <ul> within each <div>, that forms a collapsible javascript tree. The js is touchy about the exact formatting of the UL - if I can't get the tags to nest correctly using wiki syntax then I may be back with additional questions.
A more accurate but simplified version of each object's display code is:
<ul class="tree"> <li> <h2>some content</h2> <input /> <input /> </li> <ul> <li>Some velocity code, returns wiki syntax with headings</li> <li>Some velocity code, returns wiki syntax with headings</li> <li>Some velocity code, returns wiki syntax with headings</li> </ul> </ul>
Thanks much,
aaron
On Thu, Oct 20, 2011 at 12:52 PM, Thomas Mortagne <[email protected]> wrote:
On Thu, Oct 20, 2011 at 7:10 PM, Ashtar Communications <[email protected]> wrote:
That makes sense, thank you for the clarification. Unfortunately, I am using the HTML macro to generate the final output - this is because I need to use <ul>'s with a javascript to make the div's into collapsible trees.
Does that mean I'm out of luck?
<ul> ? I don't see much lists in your example, did you mean div ?
You can get div with custom parameters in pure wiki syntax the following way:
(% class="somecssclass" %) ((( div content )))
which produces
<div class="somecssclass">div content</div>
And if you really mean list, list most of the wiki elements list support custom parameters too:
(% class="somecssclass" %) * mylist element 1 * mylist element 2
which produces
<ul class="somecssclass"> <li>mylist element 1</li> <li>mylist element 2</li> </ul
You can put anything you want in custom parameters and html renderer will print them as you provided them depending of the element.
Using the html macro should always be the last resort, usually when you get some html you don't really have control on that you need to display or when you need to display elements not supported by the wiki syntax (yet) like <form> related stuff.
On Thu, Oct 20, 2011 at 12:45 AM, Thomas Mortagne <[email protected]> wrote:
On Thu, Oct 20, 2011 at 8:02 AM, Ashtar Communications <[email protected]> wrote:
One more tonight...
It seems that I am unable to use the built-in TOC macro for wiki content which is generated dynamically from a Class Sheet {{include}}. I assume this is because the TOC macro is rendered before (or simultaneously with) the include macro which actually displays the objects on the page, so as far as the TOC macro knows, there are no wiki headings on the page (yet) to create an outline from.
Actually no, there is a concept of priority in macros and TOC macro priority is very low specifically to support use case like that. But TOC only support (generated or not) real wiki content which mean if you have anything in a html macro it will not support it because html macro produce a RawBlock which is a black box containing html syntax for other macros.
So if you use case is just what you described it should work well.
Does anyone have any suggestions on how to parse through the final rendered output of the wiki page to generate a table of contents for dynamically generated wiki content? If I'm missing something with the existing macro, that would be great...
What I am looking to do is write some code (preferably in a panel, I think), which creates a TOC-style index of all the wiki-syntax headings contained on the fully rendered page, after the content has been generated from TextArea properties of a set of attached objects to the page.
I have written custom display code that loops through every object of a custom class attached to a page and then displays some of that objects properties in a series of collapsible div's. Each object contains two TextArea properties - one for WYSIWYG data, and one for plain text, which would be formatted in wiki syntax. The result is a list of each objects name with an expandable <div> full of the wiki-rendered content contained in the TextArea properties. I would like to generate a TOC which "reads through" that content and comes up with a list of only the relevant headings under each displayed "object"
For example, on a page with 3 objects, the custom display code in the Class Sheet results in this (the wiki syntax appears fully rendered, obviously):
Object 1 Name - Click to expand ******Hidden until clicked******** ==Heading 2== ===Heading 3=== Normal text, etc...
Object 2 Name - Click to expand ******Hidden until clicked******** ==Heading 2== ===Heading 3=== Normal text, etc...
Object 3 Name - Click to expand ******Hidden until clicked******** ==Heading 2== ===Heading 3=== Normal text, etc...
I would like the TOC to return:
Object 1 Heading 2 Heading 3 Object 2 Heading 2 Heading 3 Object 3 Heading 2 Heading 3
Even when all the div's are initially collapsed/hidden. It would be ideal if the TOC was clickable and went to the relevant anchor...
Are the divs done using html macro or using wiki syntax ?
I can obviously use getValue() with each TextArea property to return a string with that objects wiki syntax - but I don't have an easy way to parse that string to only return the heading levels...
Any guidance would be appreciated.
Thanks,
aaron _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users