From 4f2f4171c06022a8d4c8645e46e96801a73e9937 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 9 Jan 2011 18:31:45 -0500 Subject: [PATCH 1/3] -Added support for web2py style templates *added optional template_type argument to command line arguments and all relevant classes/functions; django is always default *generalized identifiers; replaced 'django' with 'template' in all relevant variables *added full range of tests for web2py *added optional template_type argument to hamlpy- watcher, defaults to django *no django-based functionality was changed (except tag_name split, see final bullet) -Added support for inline CoffeeScript tags with :coffeescript; works same as :javascript - Converted tag_name split to use '\w+' regex instead of plain ' ' so it won't break if extra spaces are inserted --- .project | 17 +++++++++++++++++ .pydevproject | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 .project create mode 100644 .pydevproject diff --git a/.project b/.project new file mode 100644 index 0000000..fda81c6 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + HamlPy + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..dd7248e --- /dev/null +++ b/.pydevproject @@ -0,0 +1,7 @@ + + + + +Default +python 2.7 + From 0604eda124e2f7f6299bf2f334abc8f04d76533e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 9 Jan 2011 19:01:16 -0500 Subject: [PATCH 2/3] -Added support for web2py style templates *added optional template_type argument to command line arguments and all relevant classes/functions; django is always default *generalized identifiers; replaced 'django' with 'template' in all relevant variables *added full range of tests for web2py *added optional template_type argument to hamlpy- watcher, defaults to django *no django-based functionality was changed (except tag_name split, see final bullet) -Added support for inline CoffeeScript tags with :coffeescript; works same as :javascript - Converted tag_name split to use 'w+' regex instead of plain ' ' so it won't break if extra spaces are inserted --- hamlpy/elements.py | 6 +- hamlpy/hamlpy.py | 19 +++- hamlpy/hamlpy_watcher.py | 10 +- hamlpy/nodes.py | 90 +++++++++++++----- hamlpy/test/hamlpy_test.py | 93 +++++++++++++++++++ hamlpy/test/node_factory_test.py | 4 + hamlpy/test/template_compare_test.py | 14 ++- hamlpy/test/templates/nestedWeb2pyTags.hamlpy | 10 ++ hamlpy/test/templates/nestedWeb2pyTags.html | 16 ++++ .../test/templates/selfClosingWeb2py.hamlpy | 3 + hamlpy/test/templates/selfClosingWeb2py.html | 5 + hamlpy/test/templates/web2pyCombo.hamlpy | 13 +++ hamlpy/test/templates/web2pyCombo.html | 16 ++++ hamlpy/test/test_elements.py | 8 +- 14 files changed, 266 insertions(+), 41 deletions(-) create mode 100644 hamlpy/test/templates/nestedWeb2pyTags.hamlpy create mode 100644 hamlpy/test/templates/nestedWeb2pyTags.html create mode 100644 hamlpy/test/templates/selfClosingWeb2py.hamlpy create mode 100644 hamlpy/test/templates/selfClosingWeb2py.html create mode 100644 hamlpy/test/templates/web2pyCombo.hamlpy create mode 100644 hamlpy/test/templates/web2pyCombo.html diff --git a/hamlpy/elements.py b/hamlpy/elements.py index d54521f..227bf8c 100644 --- a/hamlpy/elements.py +++ b/hamlpy/elements.py @@ -10,7 +10,7 @@ class Element(object): ID = '#' CLASS = '.' - HAML_REGEX = re.compile(r"(?P%\w+)?(?P#\w*)?(?P\.[\w\.-]*)*(?P\{.*\})?(?P/)?(?P=)?(?P[^\w\.#\{].*)?") + HAML_REGEX = re.compile(r"(?P%\w+)?(?P#\w*)?(?P\.[\w\.-]*)*(?P\{.*\})?(?P/)?(?P