From thiago.arrais at gmail.com Mon Feb 11 21:16:01 2008 From: thiago.arrais at gmail.com (Thiago Arrais) Date: Mon, 11 Feb 2008 23:16:01 -0300 Subject: [Mediacloth-devel] Shortcut method for customizing output Message-ID: I have been using a little method that looks like wiki_to_html inside the MediaCloth module for my projects. It helps to customize the HTML generator and link handlers and avoids the boiler-plate code. Here it is: def wiki_render(input, options={}) parser = MediaWikiParser.new parser.lexer = MediaWikiLexer.new tree = parser.parse(input) generator = options[:generator] || MediaWikiHTMLGenerator.new generator.link_handler = options[:link_handler] if options[:link_handler] generator.parse(tree) end With this in place, instead of explicitly creating the parser and lexer, I can provide a link handler and/or HTML generator within the options hash and keep my code cleaner. Maybe we can have this version as a starting point and improve from there if people find it useful. Cheers, Thiago Arrais -- Mergulhando no Caos - http://thiagoarrais.wordpress.com Pensamentos, id?ias e devaneios sobre desenvolvimento de software e tecnologia em geral From Gregory.Murphy at sun.com Wed Feb 13 10:35:13 2008 From: Gregory.Murphy at sun.com (Gregory Murphy) Date: Wed, 13 Feb 2008 07:35:13 -0800 Subject: [Mediacloth-devel] Shortcut method for customizing output In-Reply-To: References: Message-ID: <47B30E31.8010800@sun.com> Seems like a good idea. How about modifying the existing Mediacloth::wiki_to_html method to include support for options has you have done below? No existing code will break. // Gregory Thiago Arrais wrote: > I have been using a little method that looks like wiki_to_html inside the > MediaCloth module for my projects. It helps to customize the HTML > generator and link handlers and avoids the boiler-plate code. Here it > is: > > def wiki_render(input, options={}) > parser = MediaWikiParser.new > parser.lexer = MediaWikiLexer.new > tree = parser.parse(input) > generator = options[:generator] || MediaWikiHTMLGenerator.new > generator.link_handler = options[:link_handler] if options[:link_handler] > generator.parse(tree) > end > > With this in place, instead of explicitly creating the parser and lexer, I > can provide a link handler and/or HTML generator within the options hash > and keep my code cleaner. > > Maybe we can have this version as a starting point and improve from > there if people find it useful. > > Cheers, > > Thiago Arrais > From thiago.arrais at gmail.com Wed Feb 13 12:02:28 2008 From: thiago.arrais at gmail.com (Thiago Arrais) Date: Wed, 13 Feb 2008 14:02:28 -0300 Subject: [Mediacloth-devel] Shortcut method for customizing output In-Reply-To: <47B30E31.8010800@sun.com> References: <47B30E31.8010800@sun.com> Message-ID: On Feb 13, 2008 12:35 PM, Gregory Murphy wrote: > Seems like a good idea. How about modifying the existing > Mediacloth::wiki_to_html method to include support for options has you > have done below? No existing code will break. That seems nice too, Gregory. We'll have a revision by the end of the (my :-) day. Thanks, Thiago Arrais From thiago.arrais at gmail.com Fri Feb 29 15:04:33 2008 From: thiago.arrais at gmail.com (Thiago Arrais) Date: Fri, 29 Feb 2008 17:04:33 -0300 Subject: [Mediacloth-devel] New tracker for MediaCloth Message-ID: I have been using MediaCloth to build a project tracker called Motiro (http://www.motiro.org). It has hit version 0.6.9 this week and I thought I should thank MediaCloth somehow, so I managed to set up a Motiro tracker for MediaCloth at http://mediacloth.motiro.org/ Motiro allows MediaWiki markup to be used in feature requests, source code commits and, obviously, for wiki pages. Everything through MediCloth, of course. I took the liberty to write an initial main page for MediaCloth based on the text found at http://mediacloth.rubyforge.org and to transfer the open bugs there. This new site can be used as the project website ''and'' as a bug tracker also, if people feel like it. Please feel free to take a look and/or write something there. The URL (again) is http://mediacloth.rubyforge.org Many thanks, Thiago Arrais