From: "Sean O'Dell" Date: 2003-09-09T06:59:48+09:00 Subject: Re: ANN: MetaTags 1.0 Ryan Pavlik wrote: > On Tue, 9 Sep 2003 04:59:32 +0900 > "Sean O'Dell" wrote: > > >>Ryan, for what it's worth, I like this pretty much how it works right >>now. If I were to change anything it would be: > > > Thanks... feedback is good. > > >>Make it so "!" is re-definable and ignore any text that appears before >>it. This could be used as a generic source code parser which extracts >>documentation, etc. from the source code (by parsing anything after a >>comment character + a semaphor). As a stand-alone library, that could >>have lots of other uses. > > > I'll definitely include this in the next release... probably on both a > global and a per-TagSet basis. Basically, it just splits the string on > a regexp, and the regexp is currently /^\s*!(\w+):?/. I just picked ! > because I believe javadoc and doxygen use it, so it might be familiar. > > In the next release I'll also try to include a basic tool that generates > HTML as an example. This wasn't my primary goal, but it'd probably be > useful. Or just dump it as XML and let people worry about transforming it into HTML themselves. Generating XML is pretty simple; you just bracket stuff by name and transform &, ', ", < and > character. That part is just: class String def escape_xml() result = self.clone result.gsub!(/[&'"<>]/) do | m | case m when "&" "&" when "'" "'" when "\"" "&quit;" when "<" "<" when ">" ">" end end end end .... or perhaps someone knows a Rubyism that would be more efficient. Sean O'Dell