lesscode.org


02 Jul 05
21
08

Launching real soon now…  Comments Off

By Ryan Tomayko under Talk

The site is getting there. I spent an hour or so skinning Trac. I have to say, whoever did the HTML for Trac did a really good job. It’s all very simple and you can tell they were anal about semantics, which makes my life a ton easier. I modified a small bit of the header.cs template but other than that, the redesign was done purely with CSS.

I’ll have to announce this place over at naeblis.cx/rtomayko/ but as of right now, it is imperative that I get shitfaced as soon as possible. 8)

Comments are closed.

01 Jul 05
23
21

Wanted: eglob.py  5

By Ryan Tomayko under Wanted, Python

I’d really like to see an enhanced glob module. Nothing too crazy, just support for recursive wildcards and maybe a nice filtering API. Here’s your test case:

>>> import eglob

… or whatever.

A find function should return an iterator over all matching files and directories. Note that it should be possible to do recursive searches as the iterator is moving. yield kicks so much ass right here.

>>> eglob.find('/etc/**')
<generator object at ...>

Being able to filter the initial glob with such operations as exclude and include (needed?) would be nice. Designing this will be fun - try to abuse chaining generators as much as possible. :)

>>> list(eglob.find('/etc/**').exclude('passwd', 'group', 'init.d/*'))
['/etc/hosts', '/etc/httpd', '/etc/httpd/conf/httpd.conf']

I should be able to pass a extended glob (str, unicode) or a compiled regular expression (sre.SRE_Pattern) to any finding or filtering functions:

>>> list(eglob.find(re.compile(r'^/tmp/.*')))
['/tmp/mysql.sock', '/tmp/foo/bling']

I’d like to filter for directories only or files only:

>>> list(eglob.find('/home/*', directories=1))
['/home/hurly', '/home/curly', '/home/moe']
>>> eglob.find('**/.cvsignore', files=1)

This would be hugely useful in about four projects I’m currently working on.

5 Comments...

11
40

An Emacs kid-mode  3

By Ryan Tomayko under Python

I’ve been meaning to take a look at using mmm-mode to get support for < ?python?> blocks in kid templates.

After playing around with wordpress for a few hours, I grabbed php-mode and saw just how easy it is to do sub-modes in emacs. Here’s a simple variation on php-mode’s suggested emacs setup that enables python block support in templates (note that you’ll also need python-mode.el):

;; kid-html-mode
(mmm-add-mode-ext-class nil "\\.kid?\\'" 'html-kid)
(mmm-add-classes
 '((html-kid
    :submode python-mode
    :front "< \\?\\(python\\)?"
    :back "\\?>")))
(add-to-list 'auto-mode-alist '("\\.kid?\\'" . html-mode))

Add that to your .emacs file and then load up a kid template.

Not only do you get syntax coloring but all the other great python-mode.

What sucks about this is that I can’t seem to get it to work reliably with James Clark’s excellent nxml-mode, which I prefer when working with kid templates. I’m trying something like this but it seems flaky:

;; kid-nxml-mode
(mmm-add-mode-ext-class nil "\\.kid?\\'" 'nxml-kid)
(mmm-add-classes
 '((nxml-kid
    :submode python-mode
    :front "< \\?\\(python\\)?"
    :back "\\?>")))
(add-to-list 'auto-mode-alist '("\\.kid?\\'" . nxml-mode))

My suspicion is that this has something to do with the way nxml-mode is loaded, which is kind of weird because I believe it sniffs for a DOCTYPE and/or < ?xml?> declaration.

3 Comments...

30 Jun 05
03
07

Why clean HTML and CSS are important  Comments Off

By Ryan Tomayko under Theory

We’re not using the web right.

I’m in the midst of gluing together a bunch of tools into a seemingly coherent whole. If you’d like a lesson in why clean HTML / CSS are important, take Wordpress, Trac, mailman, Docutils, and a homegrown Python documentation generating utility and try to make them all feel like a single integrated app. You’ve got 5 template languages, entirely different applications of HTML semantics, and more redundant CSS then should be dealt with by a sane person whose wish is to remain sane.

But is there really a better way? I sometimes wonder, if all of these systems exposed resources in a more pure data format (e.g. “web services”), would things be any easier? Sure, I’d be able to do a lot more and integrate them at a lower level but I don’t need that. Right now I need everyone to use really clean and basic HTML with some basic conventions on class and id attributes. I should be able to crank out 50-60 lines of CSS and easily attach it to each app.

XSLT could help here, but then again, it’s XSLT. And that’s the kind of complexity and correctness I’m trying to get away from.

Anyway, I should be launching in the next week or so. I’ve got two utilities cooking right now that just need some polish and then I hope have this thing off the ground.

Comments are closed.

03
07

Hello, my name is Ryan Tomayko…  1

By Ryan Tomayko under First they ignore you..

… and I’m a recovering Enterprise Software Developer.

One comment so far...