01089: Page Text Variables in GroupHeader/Footer and "Home page"

Summary: Page Text Variables in GroupHeader/Footer and "Home page"
Created: 2009-04-14 15:16
Status: Closed (not a bug)
Category: Bug
Assigned:
Priority: 4
Version: 2.2.0
OS:

Not a bug, the PTV was redefined once again in the same page.

Description: I have created a GroupHeader in Main that appears as follows:

(:classification:Unclassified:)
[[{$Group}-Discuss.{*$Name}|Discussion]]

>>center<<
(:if expr equal "(*$:classification}" "" || equal "{*$:classification}" "...":)%red%[++'''No classification specified! Must assume SECRET!'''++]%%
(:elseif expr equal "{*$:classification}" "UNCLASSIFIED" || equal "{*$:classification}" "Unclassified" || equal "{*$:classification}" "unclassified":)%green%[+'''{*$:classification}'''+]%%
(:else:)%red%[+++'''{*$classification}'''++]%%
(:ifend:)
>><<
----

Each page, by the way, has a (:classification:keyword:) in it. The classification comes through as expected, except for Main.HomePage. Some debugging output in Main.GroupHeader (and the equivalent Main.GroupFooter, which has "exactly similar" code, swapping the horizontal rule position with the remainder of the mess) tells me that, even with (:classification:Unclassified:) in Main.HomePage, the PTV comes out as "..." (which, I've discovered by experimentation, is what it appears to be when the GroupHeader has the PTV but the main page does not). As a result it trips the first if, which isn't what I want.

You may have a typo on the line (:else:)%red%[+++'''{*$classification}'''++]%%, should be {*$:classification}. I'll need to find some time to test and review this bug request, but you may find a simpler way to do it, like:

(:if equal "{*$:Classified}" "0":)
This page is NOT classified.
(:elseif  equal "{*$:Classified}" "":)
No classification specified! Must assume SECRET!
(:else:)
%red%{*$:Classified}%%
(:ifend:)

This way, in the page, you have (:Classified:0:) on non-classified pages, or (:Classified:James Bond:) or nothing for classified pages. --Petko April 14, 2009, at 06:48 PM


Sorry, it was a typo as I hand-copied it in. (The system on which we're running PmWiki is disconnected from the Internet or any Internet-reachable network or system.) The colon is in there.

I added the following lines as a test:

TEST {[@{$:classification}@] = "{$:classification}", [@{*$:classification}@] = "{*$:classification}"

and the output only on Main.HomePage was:

TEST {$:classification} = "...", {*$:classification} = "..."

Everywhere else the output was as I expected.

For our purposes I need finer detail than your workaround provides, I'm afraid. Plus, with the strange PTV bug, it doesn't correct anything; Main.HomePage is still mismarked. --~~ April 20, 2009, at 12:47 PM

DISCOVERY! The PTV "classification" was the issue! If I change it to "classified" it works. Strange, but workable. --Joe Sewell? April 20, 2009, at 01:06 PM

Hats back on, gentlemen, a loser. As soon as I removed a couple of lines, the bug reasserted itself. Here's the source for Main.HomePage, showing the error regardless of the PTV used ("classification" is used, not "classified"):

(:classification:Unclassified:)
Welcome to TSSR Wiki!\\\
View the [++[[Main/Table Of Contents]]++]\\
or\\
perform a [++[[Site/Search]]++]\\\

\\\
The [[PmWiki/basic editing]] page describes how to create pages
in TSSR Wiki. You can practice editing in the [[wiki sandbox]].
\\\
The only things we ask are:
#If you create a new page, please add it to the table of contents.
#Make sure any page you create or edit has the [=(:classification: ...:)=] marking. See [[Main/classification marking]] for more information.
#Don't screw this up for us.

Curiously, if I add the following lines at line 2, it starts to work!

[=(:nogroupheader:)=]
[=(:nogroupfooter:)=]

(Obviously I chose to nuke the group header & footer for now, but for testing purposes I put them back in temporarily.)

If I remove those two lines, it breaks again. (I didn't add text to Main.HomePage to see what the PTV is with nogroupheader & nogroupfooter enabled.)

Stranger and stranger! --Joe Sewell? April 20, 2009, at 01:16 PM

There is another typo at your expression: at the first (:if expr you have written (*$:classification} which should be {*$:classification} -- when I tested it and fixed it in my GroupHeader, it seems to work fine. --Petko May 07, 2009, at 08:24 PM


Sorry, this was another typo of mine when manually transcribing it to this entry. (Once again, the problem of having to hand-copy this from a LAN not connected to the Internet rears its ugly head.) The expression uses the "{" as expected.

Please remember, the problem seems to be that Unclassified comes out "..." on Main.HomePage, not the value I specify in the line. Also the problem only happens on Main.HomePage; Main.AnythingElse operates as expected. --Joe Sewell? May 14, 2009, at 08:13 AM


Here's the carefully hand-typed version of the source:

%comment%I wonder if this will make a difference?%%
(:classification:Unclassified:)
(:nogroupheader:)
(:nogroupfooter:)
>>center<<
%green%[+'''{$:classification}'''+]%%
>><<
----
Welcome to TSSR Wiki!\\\
View the [++[[Main/Table Of Contents]]++]\\
or\\
perform a [++[[Site/Search]]++]\\\

\\\
The [[PmWiki/basic editing]] page describes how to create pages
in TSSR Wiki. You can practice editing in the [[wiki sandbox]].
\\\
The only things we ask are:
#If you create a new page, please add it to the table of contents.
#Make sure any page you create or edit has the [=(:=]classification: ...:) \
marking. See [[Main/classification marking]] for more information.
#Don't screw this up for us.
----
>>center<<
%green%[+'''Unclassified'''+]%%
>><<

Here's what I get when it's displayed:

...


Welcome to TSSR Wiki!

View the Table Of Contents?
or
perform a Search



The basic editing page describes how to create pages in TSSR Wiki. You can practice editing in the wiki sandbox.

The only things we ask are:

  1. If you create a new page, please add it to the table of contents.
  2. Make sure any page you create or edit has the (:classification: ...:) marking. See classification marking? for more information.
  3. Don't screw this up for us.

Unclassified

Note, please, the "..." instead of "Unclassified" in green above the first horizontal line; that is what I've been trying to point out this whole time.

I also found that this works under Main.WikiSandbox, if I replace the entire contents. If I don't, though, it works fine; the code classification = "{$:classification}" comes out classification = "Unclassified" like it should!

I'm more confused than ever. Under what circumstances would a PTV give "..."??? --Joe Sewell? May 14, 2009, at 09:22 AM

It does the same here!!!!!

I just tried it here under the Wiki sandbox, and it does the same thing here! Even though the sandbox is cleared every 15 minutes, you now have a real-live version that demonstrates the problem I'm trying to explain! --Joe Sewell? May 14, 2009, at 09:26 AM

Ah. The second (:classification: ...:), in the documentation, even escaped, overrides the previous one in the same page. Try this instead: [=(:=]classification: ...:). I modified your example, now it displays "Unclassified". --Petko May 14, 2009, at 09:34 AM