[pmwiki-users] Re: Undesired space combined with (:if ...:)

chr at home.se chr at home.se
Sun Aug 7 02:50:56 CDT 2005


On Sat, 6 Aug 2005, Patrick R. Michaud wrote:

> On Sun, Aug 07, 2005 at 12:34:45AM +0200, chr at home.se wrote:
> > I just started using conditional statements and noticed something that I 
> > find annoying. If I write something like this:
> > 
> > 	* Item A
> > 	(:if false:)
> > 	* Item never shown
> > 	(:ifend:)
> > 	* Item B
> > 
> > where the condition is true, I get this result that I find unintuitive
> > 
> > 	* Item A
> > 
> > 	* Item B

> I'm still working on the idea that only lines that are truly
> blank in the markup produce blank lines in the output.

Sounds good in general. Just a thought... would it make sense to do an 
initial conversion step that replaces blank lines with a special 
marker/markukp? Then it doesn't matter if later blank lines are created 
in intermediate steps, since you'll still be able to separate these from 
the initially blank lines. Anyway, guess we're getting sidetracked here...

> Thus in the above, the (:if false:) and (:ifend:) wouldn't result in
> blank lines.  (But this might not help in the above case anyway, because
> of the way that if's are handled.)
> 
> The real way to write the above is probably
> 
>  	* Item A
>  	(:if false:)* Item never shown
>         (:ifend:)* Item B

I don't understand why you place extra space in front of (:ifend:)?

If I could choose, I'd prefer for neither false statement below to produce
a blank line:

	* Item A
	(:if false:)* ...(:ifend:)
	* Item B
	(:if false:)
	* ...
	(:ifend:)
	* Item C

With this working, how do you do get blank lines? Well, ideally like this:

	* Item A
	(:if false:)* ...(:else:)

	(:ifend:)
	* Item B
	(:if false:)
	* ...
	(:else:)

	(:ifend:)
	* Item C

but I don't think there is an (:else:).
 
> This is also in keeping with the way to do multiple conditions:
> 
> 	* Item A
> 	(:if auth edit:)* Item B
>         (:if auth attr:)* Item C
>         (:ifend:)

Um... I don't quite what you mean. I thought the above is more like
	* Item A
	(:if auth edit:)* Item B
	(:elseif auth attr:)* Item C
	(:ifend:)

in which case the indentation doesn't make sense to me. I'd only use 
indentation if it was possible to have nested conditions.


Hans added this markup to the test page:

	* Item A - 
	(:if true:)* Item B - true(:ifend:)
	* Item C 
	(:if false:)* Item D - false (:ifend:)
	* Item E

that results in this output

	* Item A - 
	* Item B - true 
	* Item C 

	* Item E

and Hans thinks the blank line from the false statement is logical.  I
disagree with this... to me the blank line looks totally wrong, but maybe
I'm thinking to much in programming terms.  I also wonder if a lot of what
we see here is a sideeffect from pmwiki interpreting the markup line by
line?

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr






More information about the pmwiki-users mailing list