2008-10-11T01:57:16  <dreimark> re
2008-10-11T02:10:50  <dreimark> gn
2008-10-11T09:26:11  <dreimark> moin
2008-10-11T11:45:46  <ThomasWaldmann> moin
2008-10-11T13:34:48  <dreimark> re
2008-10-11T14:05:37  <ThomasWaldmann> anyone running a mod_wsgi wiki with https?
2008-10-11T14:07:57  * dreimark not yet
2008-10-11T14:46:22  <CIA-26> Thomas Waldmann <tw AT waldmann-edv DOT de> default * 3836:3e019f6ae381 1.7/MoinMoin/request/__init__.py: fixing https detection for servers using HTTPS=1 and also for wsgi servers not using HTTPS/SSL_ environment, but just wsgi.url_scheme
2008-10-11T15:16:05  <ThomasWaldmann> TheSheep: pyg is nice. did you test it with all the stuff we already have in parser/ ?
2008-10-11T15:18:26  <TheSheep> ThomasWaldmann: no, I still have trouble with it
2008-10-11T15:18:34  <TheSheep> ThomasWaldmann: with multi-line tokens
2008-10-11T15:18:49  <ThomasWaldmann> because if that doesn't introduce regressions, we could just drop our code highlighting stuff and use pygments
2008-10-11T15:19:29  <ThomasWaldmann> my only argument against pygments was that outputting html is no option because we need to use our formatter
2008-10-11T15:19:37  <ThomasWaldmann> but I see you have solved that
2008-10-11T15:20:58  <ThomasWaldmann> (we also should check the dom refactoring repo then and see if it can also made working there)
2008-10-11T15:22:09  <ThomasWaldmann> btw, using pygments as parser name makes trouble?
2008-10-11T15:22:55  <TheSheep> ThomasWaldmann: no, but there is one with that name already
2008-10-11T15:23:18  <TheSheep> ThomasWaldmann: actually it might make trouble, not sure how the import logic would handle it
2008-10-11T15:24:38  <ThomasWaldmann> TheSheep: I'll talk to Georg
2008-10-11T15:26:13  * ThomasWaldmann invited Georg to this channel (nick: birkenfeld).
2008-10-11T15:27:44  <ThomasWaldmann> TheSheep: georg suggest renaming his parser to e.g. code.py, so #!code python works
2008-10-11T15:28:11  * ThomasWaldmann finds that more natural than using #!pyg
2008-10-11T15:28:24  <TheSheep> yes
2008-10-11T15:28:28  <TheSheep> good idea
2008-10-11T15:28:53  <ThomasWaldmann> could be also "highlight"
2008-10-11T15:28:55  * TheSheep solves the problem with multi-line tokens
2008-10-11T15:29:00  <TheSheep> or "syntax"
2008-10-11T15:29:08  <ThomasWaldmann> or "hilite" or that, yeah
2008-10-11T15:29:13  <TheSheep> or "beautify" :)
2008-10-11T15:29:38  <ThomasWaldmann> pyg would be rather strange for everyone not knowing it is based on pygments and what that is
2008-10-11T15:30:01  <TheSheep> yes, it's a working name
2008-10-11T15:30:21  <TheSheep> I didn't expect this to be so simple
2008-10-11T15:31:40  <ThomasWaldmann> if we get it working, maybe even with dom, that'll be parser of the year :))
2008-10-11T15:32:01  <TheSheep> I wonder about the class names
2008-10-11T15:32:30  <TheSheep> right now I reuse existing class names when they exist, and just use empty spans when no apropriae class
2008-10-11T15:32:45  <TheSheep> maybe I should use the token's name instead?
2008-10-11T15:34:38  <ThomasWaldmann> you mean Constant instead of ConsWord?
2008-10-11T15:35:11  <TheSheep> no, use the existing ones where apropriate, but use Pygmentnts' one when no existing one is apropriate
2008-10-11T15:35:38  <TheSheep> so html gets highlighted with class="Token Tag" and class="Token Attribute", for example
2008-10-11T15:35:48  <ThomasWaldmann> well, i guess if we adopt pygments, we can also have appropriate css
2008-10-11T15:35:57  <ThomasWaldmann> so no need to reuse old stuff
2008-10-11T15:36:01  <TheSheep> pygments can also generate css
2008-10-11T15:37:17  <ThomasWaldmann> that also would make the code simpler
2008-10-11T15:38:50  <ThomasWaldmann> btw, typo on line 69
2008-10-11T15:39:01  <ThomasWaldmann> brb
2008-10-11T15:54:32  <ThomasWaldmann> re
2008-10-11T15:56:29  <ThomasWaldmann> TheSheep: looking at the list of supported formats, "code" seems not to be generic enough
2008-10-11T15:57:16  <ThomasWaldmann> they also support po files, groff, irc logs, ...
2008-10-11T15:57:23  <TheSheep> highlight it is then?
2008-10-11T15:57:46  <TheSheep> will even sound cool with the keyword argument
2008-10-11T15:57:57  <TheSheep> {{{#!highlight syntax=html
2008-10-11T15:57:58  <ThomasWaldmann> yes, i think that is generic enough.
2008-10-11T15:58:19  * ThomasWaldmann looks in the dict about h.l. spelling
2008-10-11T15:58:23  <TheSheep> I'm not sure how to use the arg parser to allow {{{#!highlight html
2008-10-11T15:59:45  <ThomasWaldmann> i don't think this is a problem if it is a required, positional argument
2008-10-11T16:00:09  <ThomasWaldmann> ok, highlight seems to be the one and only spelling
2008-10-11T16:00:24  * ThomasWaldmann was unsure about hilite maybe being AE
2008-10-11T16:02:18  <TheSheep> let's take the Perl way and call it _ ;)
2008-10-11T16:02:32  <TheSheep> {{{#!_ html
2008-10-11T16:03:21  <ThomasWaldmann> :P
2008-10-11T16:03:53  <TheSheep> attachment, not highlight -- they are hard to spell
2008-10-11T16:04:00  <TheSheep> s/not/now
2008-10-11T16:04:08  <TheSheep> maybe "syntax"?
2008-10-11T16:04:26  <ThomasWaldmann> not attachment, definitely :)
2008-10-11T16:05:04  * ThomasWaldmann prefers highlight over syntax
2008-10-11T16:05:17  <TheSheep> I mean I often see users have troblue with 'attachment', so maybe introducing another troublesome word is not a good idea
2008-10-11T16:05:47  <TheSheep> {{{#!color
2008-10-11T16:05:57  <ThomasWaldmann> colour
2008-10-11T16:06:09  <TheSheep> right, let'shave both ;)
2008-10-11T16:06:27  <TheSheep> {{{#!colourize
2008-10-11T16:07:19  * dreimark thinks syntax is better (highlight is something different)
2008-10-11T16:07:27  <ThomasWaldmann> there could be the case of output having no colours, depending on your css and your users
2008-10-11T16:08:06  <ThomasWaldmann> syntax is ok for rather formal stuff like programming languages, but stuff like irc logs and syntax?
2008-10-11T16:08:22  <dreimark> well it needs a mimetype too
2008-10-11T16:09:10  <dreimark> colour and highlight are someway occupied by the people using textformatting tools
2008-10-11T16:09:14  * TheSheep tries to think of the worst name possible, so that everyone could be equally unhappy
2008-10-11T16:09:21  <ThomasWaldmann> also, non-geek people maybe don't know what syntax means in that context
2008-10-11T16:09:47  <TheSheep> {{{#!pretty
2008-10-11T16:09:59  <TheSheep> from 'pretty-print'
2008-10-11T16:10:13  <ThomasWaldmann> that could raise wrong expectations :)
2008-10-11T16:10:16  <dreimark> no, how is #format
2008-10-11T16:10:23  <dreimark> when format is gone
2008-10-11T16:10:44  <TheSheep> {{{#!exquisite
2008-10-11T16:11:18  <ThomasWaldmann> dreimark: that is too generic. it would look like just telling what format the parser content is. but we also like to tell what the parser does.
2008-10-11T16:12:05  <ThomasWaldmann> so, without looking at spelling trouble, highlight is the best term yet
2008-10-11T16:12:32  <TheSheep> {{{#!hi html
2008-10-11T16:12:47  <ThomasWaldmann> :)
2008-10-11T16:13:05  <ThomasWaldmann> hi jack :)
2008-10-11T16:13:30  <TheSheep> {{{#!hi python \n print "hello world!"\n }}}
2008-10-11T16:13:52  * TheSheep has a brilliant idea
2008-10-11T16:14:00  <TheSheep> let's call it '/usr/bin/'
2008-10-11T16:14:24  <dreimark> no then we can make it more ironically lets call it IE
2008-10-11T16:15:17  * dreimark likes highlighter more than only highlight
2008-10-11T16:15:56  <ThomasWaldmann> http://video.google.de/videosearch?q=hi+jack&emb=0&aq=f# < hi jack!
2008-10-11T16:18:23  <TheSheep> highlightenizer
2008-10-11T16:18:36  <TheSheep> highlightenizer'o'matic
2008-10-11T16:18:40  <ThomasWaldmann> blinkenlights
2008-10-11T16:18:55  <TheSheep> highlightenizeromaticator
2008-10-11T16:19:27  <TheSheep> you Germans have a strange taste for words :/
2008-10-11T16:21:35  <ThomasWaldmann> maybe #!highlight python  is the most natural
2008-10-11T16:21:51  <ThomasWaldmann> and those who can't spell don't have code anyway
2008-10-11T16:23:11  <ThomasWaldmann> (this is for moin <= 1.8)
2008-10-11T16:23:46  <ThomasWaldmann> for later, we first should get clear about that we have 3 different things:
2008-10-11T16:24:01  <ThomasWaldmann> 1. a input file format (mimetype)
2008-10-11T16:24:25  <ThomasWaldmann> 2. some specification of what we want to do (e.g. highlight)
2008-10-11T16:24:37  <ThomasWaldmann> 3. an output format
2008-10-11T16:25:48  <ThomasWaldmann> e.g. for 1. == text/html there can be different 2., e.g. 2a) render or 2b) highlight
2008-10-11T16:30:41  <TheSheep> 2c validate
2008-10-11T16:30:45  <TheSheep> etc.
2008-10-11T16:33:37  <TheSheep> oops, it's slooooow
2008-10-11T16:34:04  <TheSheep> mere 4000 lines of perl need almost 20 seconds to get highlighted
2008-10-11T16:35:33  <ThomasWaldmann> ugh.
2008-10-11T16:36:39  <TheSheep> ah, no, that's how long firefox needs to render it
2008-10-11T16:37:12  <TheSheep> maybe I should just skip tags that have no class :)
2008-10-11T16:40:22  <ThomasWaldmann> TheSheep: you transform Token.Name.Constant now to class="Token Name Constant", right?
2008-10-11T16:42:44  <TheSheep> yes, now that I removed it it seems to work much faster
2008-10-11T16:43:09  <ThomasWaldmann> do you have it running somewhere?
2008-10-11T16:43:34  <TheSheep> ThomasWaldmann: this class structure makes sense, because you can then style bboth .Token.Name and add some style to .Token.Name.Constant
2008-10-11T16:43:46  <TheSheep> http://moin.sheep.art.pl
2008-10-11T16:46:48  <ThomasWaldmann> span class="ResWord">use</span> <span class="ID"></span><span class="ID">strict</span>
2008-10-11T16:47:07  <ThomasWaldmann> that first ID looks superfluous somehow
2008-10-11T16:47:40  <TheSheep> yes, I noticed that too, maybe it's something with pygment's parser for perl
2008-10-11T16:47:53  <TheSheep> I can remove empty spans though
2008-10-11T16:48:38  <ThomasWaldmann> btw, looking at the recent trouble with name clashes, we should have more specific (prefixed) names for that stuff
2008-10-11T16:49:40  <TheSheep> ThomasWaldmann: you can prefix them with pre.code anyways
2008-10-11T16:49:52  <TheSheep> ThomasWaldmann: in css, I mean
2008-10-11T16:50:00  <ThomasWaldmann> ah, ok, that should avoid trouble
2008-10-11T16:50:25  <TheSheep> I think that's how it's done already
2008-10-11T16:51:11  <ThomasWaldmann> that perl parser seems to be a bit poor
2008-10-11T16:51:30  <TheSheep> perl is difficult
2008-10-11T16:52:50  <TheSheep> btw, feel free to play in that wiki
2008-10-11T16:53:59  <dreimark> hmm it doesn't know gdl or idl
2008-10-11T16:54:40  <TheSheep> http://pygments.org/docs/lexers/ <-- only these
2008-10-11T16:57:20  <ThomasWaldmann> TheSheep: del l[-1]
2008-10-11T16:58:10  <TheSheep> ThomasWaldmann: yeah, but somehow empty string feels safer ;)
2008-10-11T16:58:47  <ThomasWaldmann> and maybe use fmt = self.formatter at the beginning of format()
2008-10-11T16:58:55  <TheSheep> it still outputs one line too many
2008-10-11T16:59:25  <TheSheep> argh, and I broke the attrs parsing
2008-10-11T17:00:20  <TheSheep> ThomasWaldmann: I use two formatters, I don't want to introduce confusion
2008-10-11T17:01:26  <ThomasWaldmann> i just thought so you don't have to type self.formatter.foo all the time
2008-10-11T17:01:39  <TheSheep> it;s just six lines
2008-10-11T17:01:57  <TheSheep> and I copy-pasted them anyways ;)
2008-10-11T17:10:44  <TheSheep> cool, it has parser for formatting python errors :)
2008-10-11T17:21:28  <ThomasWaldmann> can you temporarily add some div or id so one sees when the pygments based parser did it?
2008-10-11T17:21:51  <ThomasWaldmann> I added a python attachment transclusion, but I am unsure about which parser handled it.
2008-10-11T17:25:07  <TheSheep> sure
2008-10-11T17:26:38  <dreimark> extensions = []
2008-10-11T17:26:57  * dreimark thinks it won't be called 
2008-10-11T17:28:02  <TheSheep> hmm... I already pass the parser name to formatter.code_area, but it doesn't use it for anything :/
2008-10-11T17:28:08  * TheSheep adds a div around it
2008-10-11T17:31:53  <TheSheep> ThomasWaldmann: added
2008-10-11T17:38:02  <ThomasWaldmann> does pygments have a complete list of the mimetypes it can handle? and the file extensions?
2008-10-11T17:39:27  <ThomasWaldmann> btw, the moin highlighter is for moin < 1.6
2008-10-11T17:40:34  <dreimark> why isn't the javscript part not in common.js ?
2008-10-11T17:40:54  <TheSheep> wy is it for moin < 1.6?
2008-10-11T17:41:38  <TheSheep> ThomasWaldmann: there is the list: http://pygments.org/docs/lexers/
2008-10-11T17:44:07  <ThomasWaldmann> i mean as python data structure, accessible from moin code
2008-10-11T17:44:29  <TheSheep> aah
2008-10-11T17:45:31  <TheSheep> it has get_lexer_for_mimetype and get_lexer_for_filename...
2008-10-11T17:46:33  <TheSheep> yup
2008-10-11T17:46:44  <TheSheep> it has pygments.lexers.get_all_lexers()
2008-10-11T17:46:53  <TheSheep> which returns a generator of tuples
2008-10-11T17:47:40  <TheSheep> (lexer_name, tuple_of_short_names, tuple_of_filename_patterns, tuple_of_mimetypes)
2008-10-11T17:48:51  <TheSheep> you want me to fille the mimetypes and extensions lists from it?
2008-10-11T17:49:48  <TheSheep> fill*
2008-10-11T17:51:42  <TheSheep> the problem is that it still needs the parameter to tell it which lexer to use
2008-10-11T17:52:42  <dreimark> it needs to be added for it's known mimetypes to AttachFile.send_viewfile
2008-10-11T17:53:27  <TheSheep> you culd subclass it...
2008-10-11T17:53:30  <dreimark> mt = wikiutil.MimeType(filename=filename) get's the mimetype of the file there
2008-10-11T17:54:21  <dreimark> currently we do ext = os.path.splitext(filename)[1]
2008-10-11T17:54:35  <dreimark> and call the Parser by the definied extensions
2008-10-11T17:54:41  <dreimark> by Parser = wikiutil.getParserForExtension(request.cfg, ext)
2008-10-11T17:56:09  <TheSheep> sure, I can just extract the extensions from '*.foo' and just discard any patterns that don't match this
2008-10-11T17:56:35  <TheSheep> the problem is that this parser needs to be called with different arguments depending on the type
2008-10-11T17:57:01  <dreimark> how do they differ
2008-10-11T17:57:05  <TheSheep> that is, it has to know the mime type or extension or parser name for what it is being called
2008-10-11T17:57:47  <TheSheep> one solution I'm thinking is to generate a zillion of wrapper classes, one for every lexer
2008-10-11T17:57:51  <TheSheep> and register those
2008-10-11T17:59:33  <dreimark> you mean it needs e.g. the argument python?
2008-10-11T18:00:04  <TheSheep> yes
2008-10-11T18:01:56  <TheSheep> of course it doesn't have to be passed as an rgument
2008-10-11T18:01:59  <TheSheep> argument
2008-10-11T18:02:22  <TheSheep> it could get it from **kw or anywhere
2008-10-11T18:02:37  <TheSheep> and it doesn't have to be the name, it can be mime type or extenssion
2008-10-11T18:07:32  <dreimark> ok, then it can compare if the mime type is in the list of handled by  pygments mimetypes
2008-10-11T18:08:56  <dreimark> and could then call the pygment parser just with that mimetype ?
2008-10-11T18:09:44  <TheSheep> dreimark: hw do I get the mimetype?
2008-10-11T18:09:48  <TheSheep> how*
2008-10-11T18:10:49  * dreimark looks
2008-10-11T18:20:33  <dreimark> TheSheep: for modname, name, _, _, mimetypes in pygments.lexers.LEXERS.itervalues():
2008-10-11T18:20:49  <dreimark> collect mimetypes in a list
2008-10-11T18:23:59  <TheSheep> dreimark: yes, I know how to do it from the pygments side
2008-10-11T18:24:03  <TheSheep> dreimark: sorry
2008-10-11T18:24:18  <TheSheep> dreimark: I mean, how can the parser know the mimetype for which it is called/
2008-10-11T18:24:58  <dreimark> extensions = []
2008-10-11T18:25:10  <dreimark> needs to be a list of those mimetypes
2008-10-11T18:25:40  <TheSheep> mime types or file extensions?
2008-10-11T18:26:01  <dreimark> ah you are right it is currently extension
2008-10-11T18:26:40  <TheSheep> ok, I can do it
2008-10-11T18:26:46  <TheSheep> but the the praser is called
2008-10-11T18:27:01  <TheSheep> how can it know the mime type or extension for which it is being called
2008-10-11T18:29:43  <dreimark> AttachFile needs to be changed if you look into send_viewfile
2008-10-11T18:29:58  <dreimark> it does currently only handle mt.major == 'image'
2008-10-11T18:30:04  <dreimark> and mt.major == 'text'
2008-10-11T18:30:55  <dreimark> so it could be changed if mt.major + '/' + mt.minor in pygmentslist
2008-10-11T18:31:47  <dreimark> and it calls then the pygment parser and does not need to search for it using  wikiutil.getParserForExtension
2008-10-11T18:32:04  <TheSheep> so no way currently to know that without modifying the attachfile?
2008-10-11T18:32:28  <dreimark> only for mimetypes of mt.major == 'text'
2008-10-11T18:32:58  <dreimark> for those it enough to add the extensions to the extensions list in the parser
2008-10-11T18:33:02  <dreimark> +is
2008-10-11T18:33:17  <dreimark> line 86
2008-10-11T18:34:29  <dreimark> (but then I have no idea which one of two possible parsers do render)
2008-10-11T18:42:20  <dreimark> in the parser it is the same
2008-10-11T18:42:49  <dreimark> if pygments is added optionally to the current ones I think it is not such a big change that it is not worth to do it
2008-10-11T18:43:34  * dreimark has to leave for dinner
2008-10-11T18:52:22  * ThomasWaldmann reads backlog
2008-10-11T19:00:04  <TheSheep> aargh, sombody changed the looks of the python stdlib docs!
2008-10-11T19:00:17  <TheSheep> the world will never be the same anymore
2008-10-11T19:00:32  * TheSheep panics
2008-10-11T19:01:03  <TheSheep> oh my god, it uses ajax
2008-10-11T19:01:13  <TheSheep> we are doomed
2008-10-11T19:01:38  <grzywacz> wth?
2008-10-11T19:03:24  <TheSheep> http://www.python.org/doc/current/library/re.html
2008-10-11T20:01:28  <TheSheep> strange, I filled in extansions, and even removed parser/text_python.py
2008-10-11T20:01:38  <TheSheep> but it's still not picked
2008-10-11T20:13:18  <ThomasWaldmann> pyc?
2008-10-11T20:13:49  <TheSheep> nope
2008-10-11T20:14:04  <TheSheep> hmm.. where is the ext->parser cache saved?
2008-10-11T20:14:42  <ThomasWaldmann> iirc no
2008-10-11T20:15:36  <TheSheep> now it uses the text parser
2008-10-11T20:15:42  <TheSheep> so I guess it has fallen back
2008-10-11T20:16:27  <TheSheep> I added extensions=['py']
2008-10-11T20:16:32  <TheSheep> exlicitly
2008-10-11T20:16:45  <ThomasWaldmann> wasn't it ['.py']?
2008-10-11T20:17:24  <TheSheep> hrm
2008-10-11T20:17:27  * TheSheep tries
2008-10-11T20:17:41  <ThomasWaldmann> see the old parsers
2008-10-11T20:18:07  <TheSheep> no bonus
2008-10-11T20:21:20  <ThomasWaldmann> well, that kind of parser is a bit special, because it handles a very broad scope of mimetypes
2008-10-11T20:21:39  <ThomasWaldmann> usually moin does lookup the parser module by mimetype
2008-10-11T20:21:39  <TheSheep> success
2008-10-11T20:21:48  <TheSheep> I was modyfying the wrong place :)
2008-10-11T20:24:23  <ThomasWaldmann> maybe we could just replace the text.py fallback parser
2008-10-11T20:29:46  <TheSheep> it works as expected
2008-10-11T20:30:03  <TheSheep> and I get the filename in the parser, so I can find teh lexer for it
2008-10-11T20:32:08  <ThomasWaldmann> TheSheep: > moin/1.9 when you think it can replace some of parser/*.py
2008-10-11T20:34:04  <ThomasWaldmann> if the pygments name > moin css name mapping is done in a separate (deprecated) function, we could use about the same code for moin 1.7 and 1.8 (using the mapping function) and for 1.9 (using new names in the css)
2008-10-11T20:36:19  <ThomasWaldmann> pygments package > MoinMoin/support/
2008-10-11T20:36:40  <TheSheep> good idea
2008-10-11T20:36:46  <TheSheep> and outsource parser maintenqance :)
2008-10-11T20:37:13  <ThomasWaldmann> we have still more than enough parsers to maintain
2008-10-11T20:58:00  * TheSheep combats The Last Empty Line
2008-10-11T21:03:33  <TheSheep> is it normal that the attachment preview is not cahced?
2008-10-11T21:03:37  <TheSheep> cached
2008-10-11T21:04:20  <ThomasWaldmann> no idea. but attachments will go away anyway...
2008-10-11T21:05:00  <TheSheep> I can't really get rid of that last empty line other than manually removing it
2008-10-11T21:05:08  <TheSheep> it seems like it's there in the input
2008-10-11T21:06:20  <TheSheep> anyways, the current version works with attachments
2008-10-11T21:07:15  <ThomasWaldmann> ok, commit it :)
2008-10-11T21:09:55  * TheSheep downloads fres version of pygments and fresh 1.9 repo
2008-10-11T21:15:19  <TheSheep> ThomasWaldmann: shall I put the whole tree of pygments into support, or just the python module?
2008-10-11T21:15:30  <TheSheep> s/module/package
2008-10-11T21:16:04  <ThomasWaldmann> the package
2008-10-11T21:16:20  <TheSheep> the docs, tests, scripts and such are out then
2008-10-11T21:21:09  <ThomasWaldmann> TheSheep: please do the pygments code / stuff commit as a separate commit
2008-10-11T21:21:41  <ThomasWaldmann> LICENSE and AUTHORS need to go to docs/licenses/pygments/*
2008-10-11T21:22:49  <ThomasWaldmann> or ../LICENSE.pygments and AUTHORS.pygments maybe would be also ok
2008-10-11T21:28:44  <CIA-26> Radomir Dopieralski <moindev@sheep.art.pl> default * 4377:00b1307bd9c2 1.9/ (60 files in 6 dirs): Adding Pygments to MoinMoin/support
2008-10-11T21:28:45  <CIA-26> Radomir Dopieralski <moindev@sheep.art.pl> default * 4378:e1877a60f46d 1.9/MoinMoin/parser/highlight.py:
2008-10-11T21:28:45  <CIA-26> New parser, highlight.py, using Pygments to highlight a number of different
2008-10-11T21:28:45  <CIA-26> markups
2008-10-11T21:32:01  * ThomasWaldmann pulls and tries
2008-10-11T21:42:20  <ThomasWaldmann> TheSheep: i do some cosmetic fixes
2008-10-11T21:46:02  <TheSheep> sure :)
2008-10-11T21:46:23  <TheSheep> I think I left the ['.py'] in there :(
2008-10-11T21:49:26  <TheSheep> http://master.moinmo.in/ <-- Error 500
2008-10-11T21:50:06  <TheSheep> plus, it wants me to send an e-mail to webmaster@localhost
2008-10-11T21:50:47  <ThomasWaldmann> TheSheep: i removed the .py already
2008-10-11T21:50:55  <TheSheep> ThomasWaldmann: thanks
2008-10-11T21:57:16  <CIA-26> Thomas Waldmann <tw AT waldmann-edv DOT de> default * 4379:9ba5c65b18c0 1.9/MoinMoin/parser/highlight.py: highlight parser: some cosmetic fixes
2008-10-11T22:04:58  <ThomasWaldmann> ok, master wiki works again
2008-10-11T22:11:16  <ThomasWaldmann> TheSheep: i look at text/irssi parser and compare it with pygments irc parser now
2008-10-11T22:16:15  <ThomasWaldmann> output is quite different: #!irc -> table, #!highlight irc -> just highlighting, no table (linenumbers by default are wrong for this)
2008-10-11T22:19:26  <ThomasWaldmann> #!text and #!highlight text are rather similar, but same here: linenumbers by default are wrong. maybe even that toggle link is a bit annoying here.
2008-10-11T22:23:53  <TheSheep> maybe it could have a list of defaults for some of the lexers
2008-10-11T22:24:36  <ThomasWaldmann> cplusplus stuff is very similar, just some different colors
2008-10-11T22:25:26  <ThomasWaldmann> TheSheep: can you check the mapping for #include <foo.h> highlighting?
2008-10-11T22:26:13  <ThomasWaldmann> Preprc vs. comment
2008-10-11T22:31:18  <TheSheep> <span class="Token Comment Preproc">
2008-10-11T22:31:23  <TheSheep> moonshine and madness
2008-10-11T22:31:43  * TheSheep fixes
2008-10-11T22:33:35  <CIA-26> Radomir Dopieralski <moindev@sheep.art.pl> default * 4380:2a3ffc2dc9cf 1.9/MoinMoin/parser/highlight.py: parser/highlight.py: use .Preprc css class for Token.Comment.Preproc
2008-10-11T22:34:56  <ThomasWaldmann> #!highlight diff doesn't do any highlighting!?
2008-10-11T22:35:57  <TheSheep> ThomasWaldmann: I suppose none of the classes fits
2008-10-11T22:36:40  <TheSheep> ThomasWaldmann: spans that don't have a fitting class are skipped now
2008-10-11T22:40:58  <ThomasWaldmann> ah, ok. that is it, there are no highlighting-spans in the diff listing.
2008-10-11T22:42:18  <TheSheep> you can add    return str(ttype).replace('.', ' ')  at top of get_class()  for debugging
2008-10-11T22:43:47  <TheSheep> btw, did you know that C has a "goes to" operator? :)  http://moin.sheep.art.pl/
2008-10-11T22:45:24  <ThomasWaldmann> haha
2008-10-11T22:58:22  <ThomasWaldmann> TheSheep: Kill:
2008-10-11T22:58:22  <ThomasWaldmann> TheSheep: text_cplusplus
2008-10-11T22:58:22  <ThomasWaldmann> text_java
2008-10-11T22:58:22  <ThomasWaldmann> text_pascal
2008-10-11T22:58:22  <ThomasWaldmann> text_python
2008-10-11T22:59:05  <ThomasWaldmann> it looks like there is no difference between pygments and what moin parsers do for these parsers
2008-10-11T23:03:28  <ThomasWaldmann> TheSheep: highlight:111 shouldn't that be ' '.join(...)?
2008-10-11T23:08:52  <TheSheep> ThomasWaldmann: no difference, it's adacent tags anyways
2008-10-11T23:09:25  <TheSheep> ThomasWaldmann: on a second thought, no, I think it *must* be ''.join()
2008-10-11T23:11:06  <TheSheep> aaarg
2008-10-11T23:11:08  <TheSheep> wrong join
2008-10-11T23:11:16  <TheSheep> you are right, it should be ' '.join
2008-10-11T23:11:20  * TheSheep fixes
2008-10-11T23:11:36  * ThomasWaldmann tries to replace text_pascal by a small wrapper
2008-10-11T23:12:38  <CIA-26> Radomir Dopieralski <moindev@sheep.art.pl> default * 4381:67f263c94bcb 1.9/MoinMoin/parser/highlight.py: highlight.py: fix a bug in argument parsing that removed spaces between arguments
2008-10-11T23:15:58  <ThomasWaldmann> class Parser(HighlightParser):
2008-10-11T23:15:58  <ThomasWaldmann>     def __init__(self, raw, request, **kw):
2008-10-11T23:15:58  <ThomasWaldmann>         kw['format_args'] = 'pascal ' + kw.get('format_args', '')
2008-10-11T23:15:58  <ThomasWaldmann>         HighlightParser.__init__(self, raw, request, **kw)
2008-10-11T23:16:11  <ThomasWaldmann> that should do it, right?
2008-10-11T23:16:51  <ThomasWaldmann> (just for existing content using {{{#!pascal
2008-10-11T23:16:56  <ThomasWaldmann> )
2008-10-11T23:19:38  <TheSheep> yes
2008-10-11T23:21:58  <TheSheep> ThomasWaldmann: it could be done even simplier
2008-10-11T23:22:46  <TheSheep> ThomasWaldmann: I could check the parser name when looking for the lexer, and not require format_args if it's different than 'highlight'
2008-10-11T23:23:13  <TheSheep> ThomasWaldmann: then you don't need that __init__
2008-10-11T23:25:01  <ThomasWaldmann> ok, I try that
2008-10-11T23:26:33  <TheSheep> if self.parsername!=highlight: self.syntax=self.parsername; params = kw.get('format_args', ''); else <the old code here>
2008-10-11T23:34:08  <ThomasWaldmann> yeah
2008-10-11T23:42:50  <ThomasWaldmann> TheSheep: did you look at the Dependencies stuff?
2008-10-11T23:43:36  <TheSheep> ThomasWaldmann: no, I just assumed that code is pretty much static
2008-10-11T23:44:22  <TheSheep> fonny, text_csv has Dependencies = ['time']
2008-10-11T23:44:25  <TheSheep> funny
2008-10-11T23:45:12  <TheSheep> Dependencies = ['user'] # the "Toggle line numbers link" depends on user's language
2008-10-11T23:45:16  <TheSheep> Dependencies = ['user'] # the "Toggle line numbers link" depends on user's language
2008-10-11T23:45:20  <TheSheep> now this is wrong
2008-10-11T23:45:31  <TheSheep> that js should go into th header :/
2008-10-11T23:50:13  <ThomasWaldmann> TheSheep: i just import Dependencies from highlight parser
2008-10-11T23:50:22  <ThomasWaldmann> so we can modify it at that place
2008-10-11T23:50:41  <TheSheep> yeah, all of them will have them the same
2008-10-11T23:51:11  <TheSheep> ThomasWaldmann: I would like to patch that js in html_formatter tomorrow, if you don't mind
2008-10-11T23:51:50  * ThomasWaldmann just modified the parsers, shouldn't conflict
2008-10-11T23:54:37  <CIA-26> Thomas Waldmann <tw AT waldmann-edv DOT de> default * 4382:5eb02932f387 1.9/MoinMoin/parser/ (5 files): replace the python/pascal/java/cpp parser by a thin wrapper around the highlight parser (to keep syntax like {{{#python ... working)
2008-10-11T23:55:26  <ThomasWaldmann> ehrm, something killed the ! on the road...
2008-10-11T23:56:57  <TheSheep> ยก!
2008-10-11T23:57:37  <dreimark> TheSheep: the csv parser has this extra line too.
2008-10-11T23:58:04  <TheSheep> dreimark: I think it actually comes from the wiki parser
2008-10-11T23:58:17  <ThomasWaldmann> TheSheep: only text_diff parser still depends on ParserBase
2008-10-11T23:58:23  <dreimark> ok
2008-10-11T23:58:28  <dreimark> brb
2008-10-11T23:58:42  <TheSheep> ThomasWaldmann: I will add the classes from moin's buildin diff for it
2008-10-11T23:58:58  <TheSheep> tomorrow
2008-10-11T23:59:06  <TheSheep> good nigh, thanks for help
2008-10-11T23:59:17  <ThomasWaldmann> gn TheSheep
2008-10-11T23:59:28  * ThomasWaldmann just wanted to say tomorrow is in 1 minute :)

MoinMoin: MoinMoinChat/Logs/moin-dev/2008-10-11 (last edited 2008-10-11 00:00:02 by IrcLogImporter)