----- Forwarded Message ----
From: All Things Related <no-r...@wordpress.com>
To: show...@yahoo.com
Sent: Wed, December 22, 2010 2:09:06 PM
Subject: [New post] daml 0.1.4 Release
![]()
daml 0.1.4 Release
dasacc22 | December 22, 2010 at 6:08 pm | Tags: daml, haml, Linux, Python, software development, web development | Categories: DAML, HAML, Linux, Python, Windows 7 | URL: http://wp.me/piHZk-29Since my initial post outlining daml as a haml-for-python, a lot has changed. Now it has become something more and plays a new role in a bigger project I am working on. Let's look at some of the new syntax changes.
CSS Selector Style Attributes
Declaring attributes now follows css selectors appended to a tag hash. For example,
%html %body #content.main[attr=val][apples=yes] some contentInlining Tag Hashes
One can now inline tag hashes. The functionality is still being worked on and is broken beyond a single tier. The intent is to handle use cases such as,
%html %body %ul#nav %li %a[href=/] Home %li %a[href=/contact] Contact #wrapper #container #top #contentImplicit Python Declaration
Since my last post, all python code had to be preceded with a colon (:). Now, this is only necessary when embedding a function call in plain text (or calling a filter). For Example,
def greet(s): return 'Hello, {0}.'.format(s) nav = ['www', 'www2', 'www3'] %html %body %p A greeting for you. :greet('Daniel') %ul for x in nav: %li {x}The trade off to the above is explicit line breaks for multiline text as similarly done in python,
%html %body This is some text \ that spans multiple \ lines.I am still putting alot of thought into this portion of the syntax and it will most likely see some changes in a number of months. Explicit line breaks can become rather confusing when handling complex mixed contents, but again, tools such as daml aren't particularly suited for writing page content, but rather establishing layout.
New Filters
I added two new filters as a test, these may be removed in future releases (and migrated to my personal set of daml extensions). They are for declaring css and js files. I think the syntax speaks for itself in function,
%html %head :css /css/ main.css extra.css lib/that_lib.css :js /js/lib/ utils.js js.js jquery.min.js etc.js %body %h1 I do enjoy filters!I think such filters could be upgraded to support appending additional files, but again, I dont really have a place for such things that aren't a necessity to a fully featured template engine.
In Summary
This release requires cython >= 0.13 and lxml. I use this regularly on Windows 7 x64 and linux. The 0.1.4 release can be found on pypi, http://pypi.python.org/pypi/DAML/0.1.4 and you can follow development at github, https://github.com/dasacc22/daml
![]()
WordPress.com | Thanks for flying with WordPress!
Manage Subscriptions | Unsubscribe | Publish text, photos, music, and videos by email using our Post by Email feature.Trouble clicking? Copy and paste this URL into your browser: http://subscribe.wordpress.com
At the time, there was some consensus that you would rely on the outer
templating language to provide filtering capability, not shpaml.
The mechanism you have sounds simple and sensible, though, and there's a use
case for shpaml where you're mostly using it to generate static HTML content,
but you might want some additional sugar for the JS and CSS parts of your
document.
----- Original Message ----
> From: dasacc22 <dasa...@gmail.com>
> To: shpaml <shp...@googlegroups.com>
https://bitbucket.org/showell/shpaml_website/src/tip/shpaml.py
Then the next challenge would be to pass in your own list of extensions from the
outside. I think in daml, you just use convention, not configuration, right?
The extension mechanism just uses the name after the colon to determine which
module to load? Without getting too elaborate, I could see something like this:
1) look for a method in shpaml.py
2) look for a method in shpaml_extensions.py
3) look for a module with the appropriate name and call extend() on it
https://github.com/p/shpaml-jinja/blob/master/src/aml_jinja.py
It's a pretty elegant extension of shpaml. It takes advantage of the
"consenting adults" features of Python, hooking directly into LINE_METHODS and
overwriting html_block_tag.
I think the author was subscribed to this list at one point, so maybe he can
chime in.
The other thing about shpaml is that it's truly meant to be preprocessed. In
prod mode you shouldn't be running it at all. In dev mode you just need some
logic to cache the output for files that haven't changed. The recipes for doing
that vary from environment to environment, but they're easy to build. For my
small sphaml-based site, I reprocess the entire suite of files every time under
a second.
----- Original Message ----
> From: dasacc22 <dasa...@gmail.com>
> To: shpaml <shp...@googlegroups.com>
> Sent: Mon, December 27, 2010 10:25:59 AM
> Subject: Re: Fw: [New post] daml 0.1.4 Release
>