You are here: Foswiki>Tasks Web>Item11857 (21 Jun 2015, GeorgeClark)Edit Attach

Item11857: Including into a table cell

pencil
Priority: Enhancement
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: INCLUDE
Branches:
Reported By: JozefMojzis
Waiting For:
Last Change By: GeorgeClark
The following is serious, because it is impossible to do it correctly from WYSIWYG editor so, the normal users can't do it.

See TestTopic133310. The included section TestTopic133310inc is created with WYISWIG editor.

The same bug is appear, when try use a %FORMFIELD{"Descr" topic="SomeTopic"}% and the Descr is a textarea, containing empty lines.

Babars hint from the IRC:
[11:30am] Babar: you can't have carriage returns in the included section
[11:30am] Babar: you'd have to replace those with %BR%
is nice and (maybe) ok for power users or programmers. But it is impossible teach normal secretary writing %BR%s in WYSIWYG instead of pressing enter, especially when this is needed only for topics what will be included sometime in the future...

I'm quickly make one test page on xwiki.org. The source shown simple table
|=# |=text |=value 
| 1|{{include document="TestPage4Inc"/}}| aaa
| 2|some text |some value 

and the included topic has a couple of things and they're included without problems into a cell.

= Title =

This is an included text from another topic. Empty lines following:



up to this.

Image too: [[image:http://platform.xwiki.org/xwiki/bin/download/Features/WysiwygEditor/linkinsertmenu.png]]

end of topic with horizontal line


----

So, would be nice steal the rendering logic from xwiki...

-- JozefMojzis - 13 May 2012

Trademark Wiki had the RecursiveRenderPlugin which could be used to include formatted content within Wiki table cells. Don't know if this got ported (yet), or there's a more stable way to do this without the need to use HTML-table notation. From the perspective of us users I totally agree with Jozef that it should be possible to use INCLUDE within Wiki table cells. Maybe introducing a newline="%BR%" parameter to INCLUDE could do the trick.

-- FranzJosefGigler - 13 May 2012

I've tested RecursiveRenderPlugin with activated TWikiCompatibilityPlugin on my latest Foswiki installation, and voila it still works like a charme. Awfully I'm to stupid to port this very useful gem efficiently to Foswiki world. And I still think we should turn this into an enhancement request for INCLUDE.

-- FranzJosefGigler - 14 May 2012

So you need to have a recursive render plugin (what a name) to use INCLUDE in a table cell... Not ideal to make it easy for FW users.

-- ArthurClemens - 14 May 2012

Jozef and I would love it to be as simple as in XWiki, hence the enhancement request for INCLUDE. Don't make your users think (too much wink )

-- FranzJosefGigler - 15 May 2012

In that case, file a feature proposal so ideas can be reviewed.

-- ArthurClemens - 15 May 2012

Okay, I've created BorrowXwikisIncludeMechanism for further discussions.

-- FranzJosefGigler - 15 May 2012

Most probably this is an evaluation ordering issue: xwiki (as well as mediawiki) evaluate outside-in-left-to-right, whereas foswiki does inside-out-left-to-right. And that's why the table doesn't break: it first renders the html table from the wiki markup and inserts the test page later on. That way the included content doesn't break parsing the wiki markup. This has got nothing to do with the include mechanism itself. Any arbitrary %macro inside a cell could expand to somethign containing line-breaks and then break the tml table.

So this isn't so much of a thing to "borrow xwiki's include mechanism" rather than to tinker with evaluation order.

-- MichaelDaum - 15 May 2012

I don't even think we have to mess with order. adding an escape or intable mode to INCLUDE, which potentially is auto detected when in a table context is not particularly complicated.

in fact....

yup, feature req is needed, but there is a simpler approach.

-- SvenDowideit - 16 May 2012

I'd never propose to tinker with evaluation order. Sticking to the one we have at foswiki is very important.

My normal reflexes of layouting results of complex %macros (not only INCLUDE or SEARCH) using foswiki tables are: don't do it. For exactly that reason. Any innocent linebreak breaks more than the line.

The only reason to try it nevertheless is TablePlugin's sort feature, which you'd loose when using the more robust html instead of fragile tml tables.

-- MichaelDaum - 16 May 2012

I doesn't care about the evaluation order - I only want include topic/section into a table cell. Michael, your advice: don't do it is clear - but (sorry) not a solution :(.

-- JozefMojzis - 16 May 2012

So, after studying the Foswiki source, this needs a lot of clarifying. The inside-out-left-to-right rendering is applies to macros. But, the whole page rendering is (simplified) done in the strictly sequential order:
  1. $topicObject->expandMacros - now just calls expandMacros from the Foswiki.pm (and yes, renders the MACROS inside-out-left-to-right)
  2. $topicObject->renderTML - now calls the getRenderedVersion from the Render.pm .

So, all all above what is said about the inside-out-left-to-right evaluation order just muddles the true source of the problem.

Imaginge a simple, one line topic
table cell %INCLUDE{"SomeTopic"}%
and for the simplicity, the SomeTopic doesn't contains any MACROS, just for example a bulleted list. Here isn't applies any inside-out-left-to-right MACRO rendering, but happens this: 1.) expands the %INCLUDE 2.) renders the TML to HTML (what breaks the TML-table) - due how (badly) is the TML table is rendered. For this ins't needed any MACRO "evaluation order" change, but needs fix how the tables are rendered.

And the TML doesn't have anything with the inside-out-left-to-right - it is just a TML and the Render.pm doesn't do anything inside-out - (but does some protecting of some parts). So, when some MACROS breaks the TML-table is a definitely a BUG (because some MACROS works). So, this is an simple BUG-report - nothing more, nothing less.

For the clarification, the solution for the TML isn't trivial, because need change how the TML-table is rendered (e.g. protect the cells before renders the TML-table, for example with a special tag like <verbatim>) , so yes, the proposal is required and when i will be ready to handle it in the 14day rule - will write the proposal. This comment is written only to clarify the fluff about the inside-out-left-to-right evaluation order.

Also for the future readers - here is an simple solution: just use the extended tables (HTML-tables) when you need include something complex into the table cells. (but unfortunately, sometimes the WYSIWYG editor converts it back to the TML-table, to avoid this - just add any id to the table.)

-- JozefMojzis - 21 Jun 2015

The other option is to surround the text you want untouched with <sticky> and </sticky> tags

-- GeorgeClark - 21 Jun 2015
 

ItemTemplate edit

Summary Including into a table cell
ReportedBy JozefMojzis
Codebase 1.1.5
SVN Range
AppliesTo Engine
Component INCLUDE
Priority Enhancement
CurrentState Proposal Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r16 - 21 Jun 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy