Problem occur when a hidden page text variable is incompletely defined: when a substitution of the variable appears in the wiki code, the variable is not substituted (ok), but the remainder of the wiki is ignored (bug).
This is especially a problem when using a page text variable that is editable by students in a page that is only editable by administrators. In the following example, the rendering of the "Admin.JohnDoe" page stops at "birth date:".
Suggestion: incomplete definitions of page text variables should be ignored. In the example, the "birth_date" variable definition in "Student.JohnDoe" should be treated as if no variable definition existed, and the substitution in "Admin.JohnDoe" should substitute to empty (same as when substituting an undefined variable).
(:birth_date: Jan 1, 1998
remainder of the page, this is not displayed due to bug. (remove the [= protection in the wiki code to see the bug).
I have marked the bug as confirmed, although at first sight I could not see how/why it happens -- the text shouldn't disappear according to the markup definition. I need to investigate this. --Petko October 12, 2012, at 05:52 AM
When a hidden PageTextVariable is started, the markup engine looks for the first ":)" in order to hide the variable. This means that any directive like (:table:), (:cell:), (:if:), (:div:), (:include:), (:linebreaks:), (:input:), another (:pagetextvar:iable:), or recipes like (:thumblist:) will have a ":)" which will cause more than what is expected to be hidden.
Even when there are no such directives in the page itself, when the markup is processed, the wikitext is not only what the page contains, there is more, notably (:include GroupFooter:) and (:closeall:) and so there is always ":)" somewhere later in the page.
I am not really sure if there is a way to fix this, except by placing ":)" or "%comment% :) %%" after the area editable by the students. I'm not sure how a student can edit a variable if only admins can edit the page, but if they edit it via PmForm, these problematic cases are handled automatically.
Alternatively, it is possible to add a new PageTextVariable markup, and use it instead of (:ptv:value:).
For example, if you want to enable this
[:PTVname:PTVvalue:] format for PageTextVariables, here is what you add to config.php:
Markup('[textvar:', '<textvar:', '/\\[: *\\w[-\\w]* *:(?!\\)).*?:\\]/s', ''); $PageTextVarPatterns['[:var:...:]'] = '/(\\[: *(\\w[-\\w]*) *:(?!\\))\\s?)(.*?)(:\\)]/s';
This will add the new format without removing the default one. I'll keep thinking if something else could be done. --Petko May 08, 2013, at 07:08 AM