Community
Participate
Working Groups
Build Identifier: MediaWiki handles Templates recursively: Templates can be included in other templates. Example: Template:foo _{{bar}}expanded_ Template:bar +exp+ "one {{foo}} two" will be resolved by mediaWiki as "one _+exp+expanded_ two". The current Implementation of WikiText returns: "one _{{bar}} expanded_ two" Reproducible: Always
Created attachment 215749 [details] Patch for bug 379783 Here a first patch for this bug. The test testBasicTemplatesNoParametersRec() in TemplateProcessorTest illustrates the case described in the bug. Nothing on loop detection (see next comment).
Created attachment 215750 [details] Loop detection screenshot MediaWiki handles a Loop Detection. Here an example: Template:mer "§test{{mer}}test§" Template:rec1 "+ rec1 {{rec2}} rec1 +" Template:rec2 "+ rec2 {{rec3}} rec2 +" Template:rec3 "+ rec3 {{rec1}} rec3 +" In a page (see screenshot) including {{mer}} is expanded as: "§testTemplate loop detected: Template:Mertest§" including {{rec1}} is exanded as: "+ rec1 + rec2 + rec3 Template loop detected: Template:Rec1 rec3 + rec2 + rec1 +" * Do you think WikiText should also check for Loops? * How should a loop be signalized? (In the output like MediaWiki, as an Exception ?) I would be glad to correct my patch, if you give me some input on you vision. Thanks.
Excellent patch, thank you. I've pushed a review: https://git.eclipse.org/r/#change,6020 Yes, Mylyn WikiText should also check for loops/cycles in template processing. Generally Mylyn WikiText should attempt to process content without throwing exceptions since exceptions are not very useful to the user. In most cases we try to emulate the behaviour of the reference implementation of a particular wiki markup (in this case MediaWiki). I look forward to an updated patch!
Created attachment 215823 [details] mylyn/context/zip
Here is the output from MediaWiki corresponding to the screenshot (attachment 215750 [details] [1]): For the first example: §test<span class="error">Template loop detected: <a href="/mediawiki_root/index.php/Template:Mer" title="Template:Mer">Template:Mer</a></span>test§ For the second example: + rec1 + rec2 + rec3 <span class="error">Template loop detected: <a href="/mediawiki_root/index.php/Template:Rec1" title="Template:Rec1">Template:Rec1</a></span> rec3 + rec2 + rec1 + * I am not so sure the '<a href="{url of template}" title="{nampe of template}">{nampe of template}</a>' makes sence for Wikitext (Wikitext is independent from the MediaWiki instance). * Having a span class error suppose to have a good CSS (like red). Otherwise the user won't be aware of the conversion error due to the loop. Here the CSS corresponding to error (default skin): .error { color: red; font-size: larger; } [1] https://bugs.eclipse.org/bugs/attachment.cgi?id=215750
Created attachment 215902 [details] Patch for bug 379783 (version 2) Correction of the patch to detect loops I implement the proposed examples as unit test (also in the patch). I needed to change rec1, rec2, rec3 in rec_a, rec_b, rec_c because of Bug 380052. The output is not exactly the same as MediaWiki (see previous comment): First case: §test<span class=\"error\">Template loop detected:mer</span>test§ Second case: + rec_a + rec_b + rec_c <span class=\"error\">Template loop detected:rec_a</span> rec_c + rec_b + rec_a +
Uploaded patch set 2. https://git.eclipse.org/r/6020
Uploaded patch set 3.
Jeremie, the patch looks great. I'm planning on merging your patch as soon as we've cleared the "contribution quiet time":http://dev.eclipse.org/mhonarc/lists/mylyn-dev/msg01666.html for the Mylyn 3.8 release. Assigning to you so that you get credit for the excellent contribution.
No problem to wait after RC3. It is not a problem for me to have a queue of changes in Gerrit.
Uploaded patch set 4. https://git.eclipse.org/r/6020 * Rebase on head of master (to get the Hudson build the project) * Change the commit message. * Add a Message in Gerrit (vote 0) with the confirmation described in the Git Contribution process [1] [1] http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions
Patch applied as commit 6d61fcabeee824df898541d6d18da9b63a755230. Thanks for the contribution.
Created attachment 218443 [details] mylyn/context/zip