> Cool project. I'm considering taking it for a spin and port a site I wrote > in node.js over to it.
> What's the best way to get emacs configured so it uses python-mode for the > first two pages in a file, and html or django mode for the bottom page?
> I'm not an elisp whizz.. Does this involve configuring mmm?
> A sample .emacs gist would be stellar if anyone has one.
> cheers
> -- James
> -- > You received this message because you are subscribed to the Google Groups > "aspen-users" group. > To post to this group, send email to aspen-users@googlegroups.com. > To unsubscribe from this group, send email to > aspen-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/aspen-users?hl=en.
So nxhtml-mode is the default mode. That's probably what you want in case you have .html files that have no python.
Python blocks are any region that start with a # and end with a page break. The # was the best idea I had about how to delimit the start of a Python block. Open to better ideas.
Anyhow that seems to work pretty well.
___
tl;dr.. Grab the two-mode-mode.el file and configure your .emacs to load it.
Is there a way to tell aspen to use a different file extension for simplate files? I'd like to have something unique that I can tell emacs to associate with this mode. Right now I'm just invoking it manually when I open a buffer.
Is there a way to tell aspen to use a different file extension for simplate
> files? I'd like to have something unique that I can tell emacs to associate > with this mode. Right now I'm just invoking it manually when I open a > buffer.
Hmmm ... what about a knob in aspen.conf like simplates_extension? So that would get tacked onto all requests so if you used ".smpl" then a request for /foo.html would resolve to /path/to/my/site/foo.html.smpl. But then what about /path/to/my/site/bar.gif.smpl? You can serve simplates besides HTML, though certainly that's most common. I guess in non-HTML cases you're generally going to have a stub in the template part. Like w/ json you would just have {{ json_encode(out) }} or some such. No mode necessary (html mode would be fine).
Is there a way in Emacs to use simplates-mode if a file has a page break or two? This could mess you up if you're Barry Warsaw and you use page breaks all the time. But maybe as a workaround?
chad
On Sun, Apr 17, 2011 at 12:36 AM, James Cooper <jamespcoo...@gmail.com>wrote:
> So nxhtml-mode is the default mode. That's probably what you want in case > you have .html files that have no python.
> Python blocks are any region that start with a # and end with a page break. > The # was the best idea I had about how to delimit the start of a Python > block. Open to better ideas.
> Anyhow that seems to work pretty well.
> ___
> tl;dr.. Grab the two-mode-mode.el file and configure your .emacs to load > it.
> Is there a way to tell aspen to use a different file extension for simplate > files? I'd like to have something unique that I can tell emacs to associate > with this mode. Right now I'm just invoking it manually when I open a > buffer.
> -- James
> -- > You received this message because you are subscribed to the Google Groups > "aspen-users" group. > To post to this group, send email to aspen-users@googlegroups.com. > To unsubscribe from this group, send email to > aspen-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/aspen-users?hl=en.
Well, the file extension determines the Content-Type header that is returned--*unless* you manually set it using response.headers.set('Content-Type', 'text/foo') in your simplate. So you can have a simplate named foo.pdf that automatically returns application/pdf data, or bar.png that automatically returns image/png data. And you could have a foo.smpl file where you set the Content-Type manually to text/html.
The default value is text/plain. But you can change this with default_mimetype in aspen.conf.
That way any unknown extension, including *.smpl, would be sent as text/html.
Unfortunately, though, only index.html is currently supported as the default filename. I like the idea of adding a default_filenames knob to aspen.conf as well, which would take care of that, I think.
On the mimetypes issue, I'm inclined to read a mime.types file from .aspen. This would be in addition to a mime.types file that I would bundle with aspen itself; see:
> -- > You received this message because you are subscribed to the Google Groups > "aspen-users" group. > To post to this group, send email to aspen-users@googlegroups.com. > To unsubscribe from this group, send email to > aspen-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/aspen-users?hl=en.
> Yes, I think that combo would work well. I didn't realize the default mime > type was inferred from the file extension. pretty cool!
> -- James
> -- > You received this message because you are subscribed to the Google Groups > "aspen-users" group. > To post to this group, send email to aspen-users@googlegroups.com. > To unsubscribe from this group, send email to > aspen-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/aspen-users?hl=en.