summaryrefslogtreecommitdiff
path: root/doc/plugins/conditional/discussion.mdwn
blob: 6e84fdfc1907eb46c3ed376a58f29b38d30d6039 (plain)

Conditional broken?

Using [[!if test="tagged(plugin)" then="= Tagged as plugin =" else="No plugins found"]] on this wiki should present the 'Tagged as plugin' heading, instead it emits 'no plugins found'. Is the conditional plugin currently broken for tags or am I misusing it? Thanks.

-- Thiana

This wiki has no page named "plugin", so nothing links to it; tags are a species of link so tagging a large number of pages with a tag that doesn't exist (which change has been reverted) doesn't make the pagespec match. It would if the tag's page existed. --[[Joey]]

So if I understand this correctly... Assuming the tags Tag_A and Tag_B, the existence of @wiki-home@/tags/Tag_A.creole, and a number of files with a [[!tag Tag_A Tag_B]] the following is correct?

  • [[!if test="tagged(Tag_A)" then="OK" else="Fail"]] => OK
  • [[!if test="tagged(Tag_B)" then="OK" else="Fail"]] => Fail
  • [[!if test="tagged(Tag_A) and tagged(Tag_B)" then="OK" else="Fail"]] => Fail

Is that the expected behaviour? If so, that's not what I'm seeing here since they all result in a Fail. If not, what exactly is wrong with those conditionals? Thanks.

-- Thiana


Would there be a way for this plugin to emit fewer blank lines (i.e. none at all)?

For example, having a look at this page's sidebar. This sidebar (source code) is supposed to have no blank lines between...

  • Hurd and About,
  • Todo and Mach,
  • Mach and Mig.

--[[tschwinge]]

The blank lines in this example are coming from the newline after then=", and also from the newline before the close quote. If you remove those newlines, I think it should work. --[[Joey]]

No, that's unfortunately not it, see here: [[!if test="enabled(trallala)" then="foot"]] Continued. But on the other [[!if test="enabled(trallala)" then="foot" else="hand:"]] Continued. --[[tschwinge]]

Seems ok, no? The only linebreaks I see in the source are the ones you put at the end of the lines. --[[Joey]]

Okay, that would explain the linebreak between 1 and 3. But then, why are all linebreaks removed between 3 and 5?

1 No, that's unfortunately not it, see here: [[!if test="enabled(trallala)" then="foot"]] 3 Continued. But on the other [[!if test="enabled(trallala)" then="foot" else="hand:"]] 5 Continued. --[[tschwinge]]

The conditional after 1 evaluates to "", so there's a blank line there. The one after 3 evaluates to "hand:", so no blank line there. --[[Joey]]

I have a sidebar that contains

I am trying to make it so that the archives and index only show up if the destpage is either blog/* or / -- the top of the wiki. Unfortunately, I don't think I am getting the conditional right -- I have a "]] left over at the end (looking at the rendered html). Ideally, I would like to be able to do todays calendar on the top level pagel and the annual calendar on archives/200[4567].mdwn, and monthly calendars for the proper month on archives/200[4567]/[0..12].mdwn. Do I have to create separate sidebars? I do not use the usedir directive, so all my annual archive pages live in archives/, and all my monthly archive pages live in, say, archives/2007/ --ManojSrivastava

Are you using triple quoting for the text in the conditional? --[[Joey]]