• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 4.x Series
    • Bug
    • Template rendering issue with empty line-breaks between variables

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: Template rendering issue with empty line-breaks between variables

    • Issue Tools
      • View Changes
    1. issueid=4964 March 26, 2017 12:02 AM
      ACL ACL is offline
      Regular Member
      Template rendering issue with empty line-breaks between variables

      I'm having some issues getting parts of a template to render where the html is embed inside if-else condition wiki code. I've been scratching my head over this issue thinking there was a problem with my template syntax or a limitation on how many nested templates there can be, but I have noticed that the issue fixes itself so long as the final page is treated as a template.

      Please see the attached comparison screenshot for a better idea of the issue.

      In my case, what I'm attempting to do is have a MediaWiki style Info Box. Each row of the infobox is run through an Info Box Row template to determine whether the row is a heading, data or data and a label. If the row is a heading it renders fine, but if the row is data with/without a label then it doesn't display except on the last line, unless the page that is embedding the template is also treated as a template where it renders perfectly.

      The hierarchy of templates for this is four levels deep:
      * Mini-YEAR (e.g. Mini 2017, since each year has different dates that need to be displayed)
      * Mini (the parent template of the year-based versions)
      * Info Box (the generic Info Box template used as a parent for Mini and any other info box)
      * Info Box Row (the template used for each row of an Info Box)

      The hierarchy is heavily inspired by MediaWiki, although the html has been adjusted to use dl,dt,dd rather than tables.

      Because header rows render fine on both template and non-template pages, the Info Box Row template is being called. This is the template, where [ if="{{{data|}}}" ] doesn't seem to parse on non-template pages. Yet it does parse on template pages. For what it is worth I also took out the else wiki code tag between the header and data if wiki code but that didn't help. Here's the code where if parsing isn't working.

      Code:
      [if="{{{header|}}}"]
      	<dl>
      		<dd style="width:100%;text-align:center; font-weight: bold;">{{{header|}}}</dd>
      	</dl>
      [else /]
      	[if="{{{data|}}}"]
      		<dl class="pairsJustified">
      			[if="{{{label|}}}"]
      				<dt style="text-align:left;">{{{label|}}}</dt>
      				<dd>{{{data|}}}</dd>
      			[else /]
      				<dd style="width: 100%; text-align: center;">{{{data|}}}</dd>
      			[/if]
      		</dl>
      	[/if]
      [/if]
      If it weren't for the fact that the above code does work on pages treated as a template I'd still be thinking the problem was my syntax.
    Issue Details
    Issue Number 4964
    Issue Type Bug
    Project VaultWiki 4.x Series
    Category Templates
    Status Fixed
    Priority 3 - Loss of Functionality
    Affected Version 4.0.17
    Fixed Version 4.0.18
    Milestone (none)
    Software DependencyAny
    License TypePaid
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 2
    Assigned Users (none)
    Tags (none)




    1. March 26, 2017 10:45 AM
      pegasus pegasus is offline
      VaultWiki Team
      I cannot reproduce this issue using just the example template provided. Since you mentioned that this occurs when using nested templates 4 levels deep, please provide the templates for the other levels, as well as the example usage that is not parsing.
      Reply Reply  
    2. March 26, 2017 3:20 PM
      ACL ACL is offline
      Regular Member
      Some further investigation reveals the issue isn't with the if condition parsing at all but in fact empty line breaks between template variables. What do I mean by this... well the first example has the problem I've described but the second example renders perfectly.

      Code:
      [template]Example-with-issue
      | variableone = stuff
      | variabletwo = more stuff
      
      | variablethree = even more stuff
      | variablefour = yet even more stuff
      [/template]
      Code:
      [template]Example-without-issue
      | variableone = stuff
      | variabletwo = more stuff
      | variablethree = even more stuff
      | variablefour = yet even more stuff
      [/template]
      Who would have thought a simple line break would be the culprit behind this issue?
      Reply Reply  
    3. March 26, 2017 3:29 PM
      pegasus pegasus is offline
      VaultWiki Team
      Now that you bring up line-breaks... Does your site have AdminCP > Home > Options > VaultWiki: Miscellaneous > Enable Support for Legacy Wiki Syntax = MediaWiki? I recently resolved an issue related to line-breaks + HTML-enabled areas + this setting, which could explain the discrepancy between our sites.

      If you have that combination, please try this edit in vault/core/model/parser/legacy/mediawiki/bbcode/vw.php. Find:
      Code:
      $text = preg_replace($pattern, '[' . $tags['div'] . '][/' . $tags['div'] . ']', $text);
      Before it, add:
      Code:
      if (!$this->do_html())
      Reply Reply  
    4. March 26, 2017 3:39 PM
      ACL ACL is offline
      Regular Member
      Yes, legacy MediaWiki syntax support is indeed enabled.

      And good news, the above code edit has resolved my template variable issue

      Thanks!
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 4:49 PM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.