[pmwiki-users] Re: Undesired space combined with (:if ...:)
Patrick R. Michaud
pmichaud at pobox.com
Sun Aug 7 10:32:00 CDT 2005
On Sun, Aug 07, 2005 at 09:50:56AM +0200, chr at home.se wrote:
> 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.
I looked into this possibility once and decided it doesn't quite work.
But thinking about it more, perhaps it can. The problem is knowing
when to do the conversion step -- consider:
Some text
(:include SomePage:)
More text
If we do the blank-line markers only once before the (:include:),
then the included text's blank lines aren't marked. If we do it
after an (:include:) has been processed which is what currently
happens), then the (:include:) itself generates extra blank lines
that get marked. More directly, consider:
Text
(:if false:)
Text
(:ifend:)
More text
(:include SomePage:)
Still more text
The processing basically goes like:
1. Mark blank lines (there are none, initially)
2. Process the (:if:)...(:ifend:). This results in an unmarked
blank line, so far so good.
3. Process the (:include:)
4. The (:include:) requires reprocessing the text, to mark its
blank lines and process any [=...=] and (:if:) markups in
the included text, which ends up marking the blank line
that formed in step 2.
The answer appears to be to have step 4 do the reprocessing of previous
markups only on the included text, but it's not entirely that simple.
However, the possibility I hadn't considered until now is to do the
marking of blank lines only on the included text, and then start
the reprocessing from the top. That might work.
> > * Item A
> > (:if false:)* Item never shown
> > (:ifend:)* Item B
>
> I don't understand why you place extra space in front of (:ifend:)?
Well, I didn't -- the first two lines have a tab, the last used spaces,
so they don't appear to align properly when quoted. They aligned
properly in my original.
> > 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.
PmWiki doesn't have (:else:) in any form. What you see as (:elseif:)
is really more like
* Item A
(:if auth edit:)* Item B
(:ifend:)(:if auth attr:)* Item C
(:ifend:)
Each (:if:) automatically terminates any previous (:if:).
Pm
More information about the pmwiki-users
mailing list