Skip to content

Commit

Permalink
update to hy 0.13.0
Browse files Browse the repository at this point in the history
defreader is changed to defsharp
  • Loading branch information
markomanninen committed Aug 3, 2017
1 parent 34d75bb commit 8adb318
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion HyML - XML & (X)HTML generator for Hy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
"source": [
"It is not possible to define other `ML` macro to be used with the `#㎖` shorthand reader macro. You could however define your own shorthands following next quidelines:\n",
"\n",
"<code>(defreader {unicode-char} [code] (parse-{parser} code))</code>\n",
"<code>(defsharp {unicode-char} [code] (parse-{parser} code))</code>\n",
"\n",
"`{unicode-char}` can be any [unicode char](https://unicode-table.com/en/) you want. `{parser}` must be one of the following available parsers: xml, xhtml, xhtml5, html4, or html5.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ It is not possible to define other ``ML`` macro to be used with the
``#㎖`` shorthand reader macro. You could however define your own
shorthands following next quidelines:
(defreader {unicode-char} [code] (parse-{parser} code))
(defsharp {unicode-char} [code] (parse-{parser} code))
``{unicode-char}`` can be any `unicode
char <https://unicode-table.com/en/>`__ you want. ``{parser}`` must be
Expand Down
38 changes: 19 additions & 19 deletions doc/full.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ First the tag class:
for key, val in kw.items():
self.__dict__['attributes'][key.lower()] = val
def __getattr__(self, key):
"""
"""
Get attribute by key by dot notation: tag.attr. This is a short and nice way, but
drawback is that Python has some reserved words, that can't be used this way. Method
is also not-case-sensitive, because key is transformed to lower letters. Returning
None if attribute is not found.
drawback is that Python has some reserved words, that can't be used this way. Method
is also not-case-sensitive, because key is transformed to lower letters. Returning
None if attribute is not found.
"""
return self.__dict__['attributes'].get(key.lower(), None)
def __str__(self):
Expand Down Expand Up @@ -135,7 +135,7 @@ I also made a PHP version of the HTML generator even earlier in 2007. That progr
$arg2 = $element['omitted'] ? 'true' : 'false';
$arg3 = $element['nocontent'] ? 'true' : 'false';
$arg4 = $element['strict'] ? 'true' : 'false';
$evalstr .= <<<EOF
class HE_$abbreviation extends HtmlElement
{
Expand Down Expand Up @@ -270,8 +270,8 @@ One of the core parts of the HyML implementation is where to catch a tag name. B
(try
; code can be a symbol or a sub program
; thats why try to evaluate it. internal symbols like "input"
; for example are handled here too. just about anything can be
; a tag name
; for example are handled here too. just about anything can be
; a tag name
(name (eval code))
; because evaluation most probably fails when code contains
; a symbol name that has not been specified on the global namespace,
Expand Down Expand Up @@ -302,7 +302,7 @@ Templating feature requires using globals variable dictionary as a registry for
(import [hy.importer [tokenize]])
(with [f (open ~template)]
; funky ~@` part is needed as a prefix to the template code
; so that code on template wont get directly expanded but only
; so that code on template wont get directly expanded but only
; after everything had been collected by the macro for final evaluation
    (tokenize (+ "~@`(" (f.read) ")")))))
Expand Down Expand Up @@ -356,7 +356,7 @@ You should check that your environment meets the same requirements than mine. My
Hy version: 0.12.1
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
So this module has been run on Hy 0.12.1 and Python 3.5.2 installed by Anaconda package in Windows. If any problems occurs, you should report them to: https://github.com/markomanninen/hyml/issues
Expand Down Expand Up @@ -458,7 +458,7 @@ This will output:
</div>
</body>
</html>
XML, HTML4, HTML5, XHTML, and XHTML5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -492,7 +492,7 @@ Output:
<node attribute="value"/>
<node attribute="value"></node>
<node attribute="value">Content</node>
However in ``html4`` and ``html5`` there are certain tags that cannot
have endings so they will be rendered in correct form by the parser.
Expand Down Expand Up @@ -563,7 +563,7 @@ It is not possible to define other ``ML`` macro to be used with the
``#㎖`` shorthand reader macro. You could however define your own
shorthands following next quidelines:
(defreader {unicode-char} [code] (parse-{parser} code))
(defsharp {unicode-char} [code] (parse-{parser} code))
``{unicode-char}`` can be any `unicode
char <https://unicode-table.com/en/>`__ you want. ``{parser}`` must be
Expand Down Expand Up @@ -746,7 +746,7 @@ table head generation snippet:

.. code-block:: hylang
(xhtml
(xhtml
(table (thead
(tr ~@(list-comp
`(th :class (if (even? ~i) "even" "odd") ~label " " ~i)
Expand All @@ -769,7 +769,7 @@ example:

.. code-block:: hylang
(xml>
(xml>
~@(list-comp `(ul (b "List")
~@(list-comp `(li item " " ~li)
[li uls]))
Expand Down Expand Up @@ -844,7 +844,7 @@ and ``cell``) are referenced by quoting them:
`(tr
~@(list-comp* [cell (range 3)]
`(td ~row "." ~cell)))))
(tfoot
(tfoot
(tr
(td :colspan "3" "Footer")))))
Expand All @@ -862,12 +862,12 @@ try with a short csv file:

.. code-block:: hylang
(xhtml>
(xhtml>
(table.data
(caption "Contacts")
~@(list-comp*
[[idx row] (enumerate (.split (.read (open "data.csv" "r")) "\n"))]
(if (pos? idx)
(if (pos? idx)
`(tbody
~@(list-comp* [item (.split row ",")]
`(td ~item)))
Expand Down Expand Up @@ -901,7 +901,7 @@ Output:
(head (title ~title))
(body
(p ~body)))
Then I use ``include`` macro to read and process the content:

Expand All @@ -910,7 +910,7 @@ Then I use ``include`` macro to read and process the content:
(defvar lang "en"
title "Page title"
body "Content")
(xhtml ~@(include "template.hy"))
Output:
Expand Down
2 changes: 1 addition & 1 deletion hyml/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# special reader macro symbol for translating string less verbose way.
# instead of (_ "message") in hy you can do i"message" as long as you have
# defined: (defreader i [args] `(_ ~args)) in your program
# defined: (defsharp i [args] `(_ ~args)) in your program
readermacro, dispatch_reader_macro = hy.HySymbol("i"), hy.HySymbol("dispatch_reader_macro")
# lazy_gettext is a special keyword for flask babel
gettext, lazy_gettext = hy.HySymbol("gettext"), hy.HySymbol("lazy_gettext")
Expand Down
2 changes: 1 addition & 1 deletion hyml/macros.hy
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
; unicode Square Ml U+3396 is a shorthand for parsing tags. note that
; html* and similar macros will accept multiple expressions, not just
; an expression with a single root node
(defreader ㎖ [code] (parse-xml code))
(defsharp ㎖ [code] (parse-xml code))

; parser creator
(defmacro defml [name parser]
Expand Down
2 changes: 1 addition & 1 deletion hyml/minimal.hy
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@
None))
; bhybel macro shortcut for babel/gettext localization and internalization
; explanation to set up it here is same as for macro -macro
(defreader i [args] `(_ ~args))
(defsharp i [args] `(_ ~args))
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from distutils.core import setup

install_requires = ['hy>=0.12.1']
install_requires = ['hy>=0.13.0']

#python setup.py register -r pypitest
#python setup.py register -r pypi
Expand All @@ -10,23 +10,23 @@

setup(
name = 'hyml',

packages = ['hyml'],
package_dir = {'hyml': 'hyml'},
package_data = {
'hyml': ['*.hy']
},
version = 'v0.2.11',

version = 'v0.2.12',
description = 'HyML - XML / (X)HTML generator for Hy',
author = 'Marko Manninen',
author_email = '[email protected]',

url = 'https://github.com/markomanninen/hyml',
download_url = 'https://github.com/markomanninen/hyml/archive/v0.2.11.tar.gz',
download_url = 'https://github.com/markomanninen/hyml/archive/v0.2.12.tar.gz',
keywords = ['hylang', 'python', 'lisp', 'macros', 'markup language', 'dsl', 'xml', 'html', 'xhtml'],
platforms = ['any'],

classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
Expand Down

0 comments on commit 8adb318

Please sign in to comment.