Given that there is some debate whether bug:777 is a bug or a wish, I'd like to propose an "enhanced" version of the bug report as a wish.
The end result I'm looking for in this proposal is the same: the ability to build "proper" [[html]] and [[code]] blocks using ListPages. Those appear to be the 2 pieces of wiki syntax that, when output by ListPages, do not work as expected. Trying to create [[html]] and [[code]] blocks using ListPages does not work because of the way the parser apparently handles these scenarios.
I would like to see a "mode" argument added to ListPages that would support these two properties:
Argument | Property | Meaning |
---|---|---|
mode | normal | The default mode. ListPages works as it does now |
mode | html | Used to output a [[html]] or [[code]] block |
Additionally, for mode="html" (or mode="normal" if possible), I'd like to see support for additional syntax in the module body that would replace or supplement the prependLine and appendLine options. Both of those options are limiting now because we can't use double quotes or create line breaks (see: wish:868). I propose the addition of [[prepend]]...[[/prepend]] and [[append]]...[[/append]] blocks in the module body section to help overcome these limitations and make our source easier to create and read.
The syntax changes I'm proposing might look something like this:
[[module ListPages mode="html" category="employee" order="_lastname" separate="no"]]
[[prepend]]
[[html]]
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['table']});
google.load('visualization', '1.1', {packages: ['controls']});
function drawTable() {
var data = google.visualization.arrayToDataTable([
['Employee #', 'First Name', 'Last Name', 'Phone #'],
[[/prepend]]
// the ListPages module body output gets rendered here...
[%%form_data{id}%%, '%%form_data{firstname}%%', '%%form_data{lastname}%%', '%%form_data{phone}%%'],
// end Listpages output
[[append]]
]);
var table = new google.visualization.ChartWrapper({ 'chartType': 'Table', 'containerId': 'table_div', 'options': { 'width': '100%' } });
//
// the rest of the append code removed for clarity
//
// <snip>
//
</body>
[[/html]]
[[/append]]
[[/module]]
If [[html]] or [[code]] tags are missing from the [[prepend]] or [[append]] blocks, then a [[code]] block is assumed and generated. Similarly, if the [[prepend]] or [[append]] blocks are missing from the body, they are assumed to exist with [[code]] and [[/code]] as their contents respectively.
Finally, with mode="html", the separate argument should always be forced to separate="no" and <p> … </p> tags should not wrap the module output.
This would allow us to enhance our sites using external tools like those provided by Google Visualizations where we could easily process our form data dynamically and generate some stunning pages.
Since rendering other "blocks" like [[gallery]] and [[collapsible]] with Listpages is possible, I think we should have the same option with [[html]] and [[code]] blocks.
i like it especially if HTML code will not hide inside <iframe> but will live on page itself