Delimiting and #arraymap: with a newline

28 views
Skip to first unread message

tosfos

unread,
May 9, 2009, 11:09:28 PM5/9/09
to Semantic Forms
There is an old thread about getting the <gallery> tag to work with
SF:
http://groups.google.com/group/semantic-forms/browse_thread/thread/6c4efae5255ada34/a84c94a6ee3c6b5c?lnk=gst&q=gallery#a84c94a6ee3c6b5c

Reviving an old topic, there may be some possibilities here for anyone
who still needs it. I'm one of them. :)

There is now a #tag: parser function which could help. It would
work something like this:

{{#tag:gallery|
Image:Example.jpg
Image:Example2.jpg
Image:Example3.jpg
Image:Example4.jpg
Image:Example5.jpg
}}

Translating into Semantic Forms, the template definition would look
like this:
{{#tag:gallery|
{{#arraymap:{{{Photos|}}}|,|x|Image:x}}
}}

I haven't tested the above code but it should be the right idea. The
only reason why this does not work is because I can't get #arraymap to
delimit with a newline character in order to match the gallery tag's
syntax. Any ideas for this would be greatly appreciated.

Thanks!

Daniel Friesen

unread,
May 9, 2009, 11:55:11 PM5/9/09
to semanti...@googlegroups.com
{{#tag:gallery|
{{#arraymap:{{{Photos|}}}|,|x|Image:x|<nowiki>
</nowiki>}}
}}

~Daniel Friesen (Dantman, Nadir-Seen-Fire)

tosfos

unread,
May 10, 2009, 12:49:18 AM5/10/09
to Semantic Forms
I thought this would work too but for some reason it's no go. Unless
I'm messing something up. Thanks!

On May 9, 11:55 pm, Daniel Friesen <nadir.seen.f...@gmail.com> wrote:
> {{#tag:gallery|
> {{#arraymap:{{{Photos|}}}|,|x|Image:x|<nowiki>
> </nowiki>}}
>
> }}
>
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire)
>
> tosfos wrote:
> > There is an old thread about getting the <gallery> tag to work with
> > SF:
> >http://groups.google.com/group/semantic-forms/browse_thread/thread/6c...

Dan Bolser

unread,
May 10, 2009, 10:37:52 AM5/10/09
to semanti...@googlegroups.com
One of the nice things about DPL is that it respects "\n". Although
this can be a pain for debugging (the wiki code can get complex) its a
nice feature to have. I don't know how technically difficult it would
be to implement in #ask: and/or #arraymap.

The alternative is to stick newlines in templates with something like

Template:n
<includeonly>
</includeonly>


The <includeonly> tags should perform the same (guaranteed?) function
as the <nowiki> tags in the previous example.

I think you should then be able to say something like ...

{{#tag:gallery|
{{#arraymap:{{{Photos|}}}|,|x|Image:x| {{n}} }}
}}


If that doesn't work, I'm sure #arraymaptemplate should.


Dan.

2009/5/10 tosfos <tos...@gmail.com>:

tosfos

unread,
May 10, 2009, 2:23:20 PM5/10/09
to Semantic Forms
Thanks Dan!

The template trick didn't work but after some playing around, I got
#arraymaptemplate to work. Here's the basic code for anyone who needs
it:

In the template definition:
{{#tag:gallery|
{{#arraymaptemplate:{{{Photos|}}}|GalleryNewline|,|}}
}}

In Template:GalleryNewline
(a blank line goes here)
File:{{{1}}}

I tried some more routine and obvious tricks in the template but this
is the only I could get to work.

Be careful. Every time you edit Template:GalleryNewline, it will
remove that blank line. I think there's a way to prevent that, but
this works for now.

Again thanks to everyone.

Dan Bolser

unread,
May 10, 2009, 3:07:28 PM5/10/09
to semanti...@googlegroups.com
2009/5/10 tosfos <tos...@gmail.com>:
>
> Thanks Dan!
>
> The template trick didn't work but after some playing around, I got
> #arraymaptemplate to work. Here's the basic code for anyone who needs
> it:
>
> In the template definition:
> {{#tag:gallery|
> {{#arraymaptemplate:{{{Photos|}}}|GalleryNewline|,|}}
> }}
>
> In Template:GalleryNewline
> (a blank line goes here)
> File:{{{1}}}
>
> I tried some more routine and obvious tricks in the template but this
> is the only I could get to work.
>
> Be careful. Every time you edit Template:GalleryNewline, it will
> remove that blank line. I think there's a way to prevent that, but
> this works for now.
>
> Again thanks to everyone.

That's awesome!

You might like to add this to the collection of tips here:

http://smw.referata.com/wiki/Special:BrowseData/Tips


Just click 'Add a tip' in the box on the left.


All the best,
Dan.


--
... people generally show up expecting and looking for social norms.
That's just how humans are built. In any group unified by a common
endeavor, people who join instinctively search for behaviors that will
mark them as part of the group. The goal of setting precedents early
is to make those "in-group" behaviors be ones that are useful to the
project; for once established, they will be largely self-perpetuating.
~ http://producingoss.com/en/setting-tone.html

Yaron Koren

unread,
May 10, 2009, 10:44:59 PM5/10/09
to semanti...@googlegroups.com
It's great that you managed to get this working, despite all obstacles. :) There should be an easier solution soon - I changed the parsing of #arraymap and #arraymaptemplate a while ago so that "\n" represents a newline in the "delimiter" value, but for some reason I never made that same change in the "new delimiter" value. It's a very simple change, that should go into the next version of SF.

-Yaron

tosfos

unread,
May 11, 2009, 8:05:03 PM5/11/09
to Semantic Forms
Thanks Yaron. Looking forward to it. :)

On May 10, 10:44 pm, Yaron Koren <yaro...@gmail.com> wrote:
> It's great that you managed to get this working, despite all obstacles. :)
> There should be an easier solution soon - I changed the parsing of #arraymap
> and #arraymaptemplate a while ago so that "\n" represents a newline in the
> "delimiter" value, but for some reason I never made that same change in the
> "new delimiter" value. It's a very simple change, that should go into the
> next version of SF.
>
> -Yaron
>
> >   ~http://producingoss.com/en/setting-tone.html

Guoqian Jiang

unread,
May 12, 2009, 10:40:38 AM5/12/09
to semanti...@googlegroups.com
Hi,

I am using header tabs in a page and partial form for editing. After I finish editing a field under a specific header tab (say the third header tab) and save the form, the page returns to the first header tab. Is there any way to make the saved page still keeps in original working header tab?

Thanks,

-Guoqian

Sergey Chernyshev

unread,
May 12, 2009, 1:13:52 PM5/12/09
to semanti...@googlegroups.com
Hmm. Probably not...

        Sergey


--
Sergey Chernyshev
http://www.sergeychernyshev.com/


2009/5/12 Guoqian Jiang <gqj...@hotmail.com>
Reply all
Reply to author
Forward
0 new messages