Item8244: BreadCrumbsPlugin should expand ", needs a new pseudo-variable

pencil
Priority: Enhancement
Current State: Closed
Released In: 1.0.6
Target Release: patch
Applies To: Extension
Component: BreadCrumbsPlugin
Branches:
Reported By: Foswiki:Main.PaulHarvey
Waiting For: MichaelDaum
Last Change By: PaulHarvey
The following doesn't work as with other formatted strings:

%BREADCRUMBS{"RootWeb/OtherWeb/SubWeb.SomeTopic" format=""""}%

Expected: "" in each expanded breadcrumb, but instead shows "".

Also, I needed a way to tell if I was expanding a parent web (other than the web where the breadcrumbs were being expanded). So I added a pseudo-variable, $webpart.

Also, there is a pseudo-variable available ($web) which is not documented.

I've attached a patch and the following lines should be added to the pseudo-variables documentation in the BreadCrumbsPlugin topic:

  • $web: the web where the %BREADCRUMBS% macro is being expanded.
  • $webpart: when processing a breadcrumb that is a parent web, expands to the name of that parent web.

-- PaulHarvey - 16 Aug 2009

Thanks Paul for the patch. I'll look into what you are trying to achieve. Btw. " isn't really needed. Try \" instead.

-- MichaelDaum - 16 Aug 2009

Whoops. I am sorry Michael, somehow I got my $ and " mixed up. The BreadCrumbsPlugin topic does not actually document a $ variable. I just fixed up this bug report to reflect that I was mistaken. I suppose I shouldn't be debugging in the car on long trips!

The reason I was looking for " was because I was using an IF{} in the format string (as I would with other FormattedSearch strings).

As for the $webpart variable, I do an IF as follows: %IF{"'$webpart'!='$web'" then="<parent web formatting>" else="<current web formatting>"}%. Perhaps this could be avoided with the provision of a new format string (different format strings for parent vs current webs), but even here I feel $webpart could still be useful.

-- PaulHarvey - 16 Aug 2009

Actually the correct fix is to expand $web to the web part of the $webtopic variable and $topic to the topic part. The former value of $web was pretty pointless as it always expanded to BASEWEB. So your IF expression should actually be %IF{"'$webpart'!=$BASEWEB" then="<parent web formatting>" else="<current web formatting>"}%

I won't add " as that is redundant a legacy way of writing \". Use %BREADCRUMBS{"RootWeb/OtherWeb/SubWeb.SomeTopic" format="\"\""}% instead.

-- MichaelDaum - 20 Aug 2009

We fixed behaviour for $web but not for $topic. This next commit makes BreadCrumbsPlugin behave as described with the updated notes about these pseudo-vars.

Michael, hope you don't mind me making this commit for you. Let me know if you'd rather I didn't commit any one-line fixes like this in future.

-- PaulHarvey - 17 Sep 2009

That's okay. I trust your instincts to spot'n fix bugs.

-- MichaelDaum - 17 Sep 2009

ItemTemplate edit

Summary BreadCrumbsPlugin should expand ", needs a new pseudo-variable
ReportedBy Foswiki:Main.PaulHarvey
Codebase 1.0.6
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component BreadCrumbsPlugin
Priority Enhancement
CurrentState Closed
WaitingFor MichaelDaum
Checkins BreadCrumbsPlugin:97df4ba14de9 BreadCrumbsPlugin:84043e404a1e
TargetRelease patch
ReleasedIn 1.0.6
I Attachment Action Size Date Who Comment
BreadCrumbsPlugin.txt.diffdiff BreadCrumbsPlugin.txt.diff manage 912 bytes 16 Aug 2009 - 02:05 PaulHarvey  
Core.pm.diffdiff Core.pm.diff manage 396 bytes 16 Aug 2009 - 02:06 PaulHarvey  
Topic revision: r10 - 17 Sep 2009, PaulHarvey
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