[pmwiki-users] PageList vs WikiForm for multi-line variables

John Rankin john.rankin at affinity.co.nz
Sun Oct 4 15:52:53 CDT 2015


Yes, just writing natural text would be better for the authors.

You could possibly add a markup rule that is processed before page text
variables are evaluated, to create a hidden pseudo page text variable for
the Abstract.

Something like:

1. match on (:Abstract:)(.*?)(\n:) (you'll need the /s modifier to make
the match span multiple newlines)

2. make the rule replace this with
$m[1].$m[2]."\n".'(:pseudoAbstract:'.str_replace("\n\n",' :+
',$m[1]).':)'.$m[3]

3. This should mean a pagelist can reference pseudoAbstract and get the
full contents of the Abstract field.

Hope that makes sense.

JR

> Thanks. Somehow, i currently use the same trick since, with the creole
> markup, i can use \\ to mean "new line". However, i would like the user to
> just write some text without caring about staying on a single line.
>
> Ciao,
> Thierry
>
>
> On Sun, Oct 04, 2015 at 12:38:57PM +1300, John Rankin wrote:
>> This may not be a good answer, but it may be an answer.
>>
>> In the wikiform entry screen, try using the following markup in the
>> Abstract field:
>>
>> The first line of the abstract. :+ The second line of the abstract. :+
>> The
>> third line of the abstract.
>>
>> In the view template, this should produce the following HTML:
>>
>> <dt>Abstract</dt><dd>The first line of the abstract</dd><dd>The second
>> line of the abstract.</dd><dd>The third line of the abstract.</dd>
>>
>> That is, each line should present as a separate paragraph in the
>> display.
>>
>> Then, the pagelist template should correctly pick up the whole field for
>> the ptv.
>>
>> The code to interpret :+ in this way is part of the markup extensions
>> recipe.
>>
>> Hope this helps.
>>
>> JR
>>
>> > Thanks for your answer. The problem with the solutions discussed in
>> the
>> > 2006 thread is that i have to stick to the WikiForm syntax to define
>> page
>> > text variables, in particular, the (:...:) way seems not possible.
>> >
>> > Ciao,
>> > Thierry
>> >
>> >
>> >
>> > On Sat, Oct 03, 2015 at 10:25:51PM +0200, ABClf wrote:
>> >> To my knowledge, this :ptv: is not multiline
>> >> (see
>> >> http://pmichaud.com/pipermail/pmwiki-users/2006-September/033404.html)
>> >>
>> >> It might be possible (not by me though) to rewrite the :ptv: regex to
>> >> get the result you are expecting (but, how to treat the last
>> >> occurence, when there is not anymore :ptv: ?)
>> >>
>> >>
>> >>
>> >> 2015-10-03 21:06 GMT+02:00 Thierry <pmwiki at lma.metelu.net>:
>> >> > Hi,
>> >> >
>> >> > i am using pmwiki to manage various things for a while now and,
>> well,
>> >> > thanks a lot for this great tool!
>> >> >
>> >> > I encountered a problem that i was not able to fix by myself: i am
>> >> using
>> >> > WikiForm to let the users create pages that define some page text
>> >> > variables automatically. In particular, one of the variables is
>> named
>> >> > 'Abstract', and the corresponding entry in the FormTemplate is
>> >> >
>> >> > :Abstract:abstract (text=10*62)
>> >> >
>> >> > so that the user can enter a small multi-lines text, not a single
>> line
>> >> > (and the ViewTemplate understands that well).
>> >> >
>> >> > In my PageList template, i want to list those pages according to
>> some
>> >> > variables (e.g. "Date", "Room", ...) and also print the content of
>> the
>> >> > "Abstract" variable, so i am using "{=$:Abstract}" in the
>> >> > PageListTemplates.
>> >> >
>> >> > The problem is that, PageList only prints the first line of the
>> >> abstract,
>> >> > since, unlike WikiForm, it probably considers that only what is on
>> the
>> >> > same line that "^:Abstract:" is the content of the "Abstract"
>> >> variable,
>> >> > not the following lines.
>> >> >
>> >> > My question is: how to let PageList understand that the content of
>> the
>> >> > "Abstract" field is all the lines that appear between ":Abstract:"
>> and
>> >> the
>> >> > definition of the next variable in the page ?
>> >> >
>> >> > Ciao,
>> >> > Thierry
>> >> >
>> >> >
>> >
>> > _______________________________________________
>> > pmwiki-users mailing list
>> > pmwiki-users at pmichaud.com
>> > http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>> >
>>
>>
>> --
>> John Rankin
>


-- 
John Rankin




More information about the pmwiki-users mailing list