[Moin-user] Res: Help on macro.formatter

Robert Seeger (OR Soft) robert.seeger at orsoft.de
Thu Sep 13 04:49:00 EDT 2007


This is not recommended. You should try to avoid injecting raw HTML unless it is some complicated, non-standard stuff.
Use the formatter API for all output. In your case iterate over the list, use fomatter.text() and formatter.linebreak(preformatted=1).

See MoinMoin\formatter\text_html.py for the formatter API

Kind Regards,
Robert





> -----Original Message-----
> From: mail at heavy.ch [mailto:mail at heavy.ch]
> Sent: Wednesday, September 12, 2007 9:56 PM
> To: moin-user
> Subject: Re: [Moin-user] Res: Help on macro.formatter
> 
> 
> Hi there
> 
> You could use the "macro.formatter.rawHTML(string)". This will return
> your html-code. 
> 
> bye
> Marcel
> 
> 
> to return html. But maybe need to be aware
> Am Mittwoch, den 12.09.2007, 10:11 -0700 schrieb Marcão:
> > Hi Ted and All
> > 
> > The '\n' in the expression 'return 
> macro.formatter.text("%s\n" % (lista))' does not work because 
> the 'new line' is put only in the lista's end, not inside it.
> > 
> > I also tried the following:
> > 
> >     lista = "aaa bbb ccc ddd"
> >     lre = re.compile(' ')
> >     listafinal = lre.sub('\n',lista)
> >     return macro.formatter.text("%s" % (listafinal))
> > 
> > But it still does not work, although it works in the following code:
> > 
> >     lista = "aaa bbb ccc ddd eee kkk"
> >     lre = re.compile(' ')
> >     x = lre.sub('\n',lista)
> >     print x
> > 
> >     The result of it is:
> >     aaa
> >     bbb
> >     ccc
> >     ddd
> >     kkk
> > 
> > So i think que problem is how the Moin Engine works with '\n'.
> > 
> > Is there a way to send a html code directly to a wiki's page ?
> > 
> > So I could send some thing like 
> "<br>aaa</br><br>bbb</br><br>ccc</br>"
> > 
> > Thanks
> > 
> > Marco
> > 
> > 
> > 
> > 
> > ----- Mensagem original ----
> > De: Ted Stern <dodecatheon at gmail.com>
> > Para: Marcão <marcoalher at yahoo.com.br>
> > Enviadas: Terça-feira, 11 de Setembro de 2007 19:15:46
> > Assunto: Re: [Moin-user] Help on macro.formatter
> > 
> > On 11 Sep 2007 12:58:10 -0700, Marcão wrote:
> > >
> > > Hi All.
> > >
> > > I'm new in Moin and Python and I'm facing some problems 
> that I think is very simple.
> > >
> > > I have a list "aaa bbb ccc ddd eee" that I print with 
> this command: 
> > >
> > >     lista = "aaa bbb ccc ddd eee"
> > >     return macro.formatter.text("%s" % (lista))
> > 
> > What happens if you put "%s\n" instead?
> > 
> > >
> > > The result is:
> > >
> > >     aaa bbb ccc ddd eee
> > >
> > > But I need to print this like:
> > >
> > >     aaa
> > >     bbb
> > >     ccc
> > >     ddd
> > >     eee
> > >
> > >
> > > I don't know how to print like this.
> > > Could someone help me ?
> > >
> > > Thanks
> > >
> > > Marco
> > >
> > >
> > >
> > >
> > >       Flickr agora em português. Você clica, todo mundo vê.
> > > http://www.flickr.com.br/
> > >
> > > 
> --------------------------------------------------------------
> -----------
> > > This SF.net email is sponsored by: Microsoft
> > > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > > _______________________________________________
> > > Moin-user mailing list
> > > Moin-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/moin-user
> > >
> > 
> 
> 
> 
> 






More information about the Moin-user mailing list