summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-10-20 17:06:12 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-10-20 17:06:12 -0700
commit2d645d6db83ebaa5dc40df654983809b0abd4114 (patch)
treebf5d9db63f0b04c5d5c731a5db5f792fca614256
parentb93b546955c9e9842cbca545c33c1cd1f24e5247 (diff)
downloadpystache-2d645d6db83ebaa5dc40df654983809b0abd4114.tar.gz
Create gh-pages branch via GitHub
-rw-r--r--index.html93
-rw-r--r--javascripts/main.js5
-rw-r--r--params.json2
3 files changed, 78 insertions, 22 deletions
diff --git a/index.html b/index.html
index db0b06a..d9e54a9 100644
--- a/index.html
+++ b/index.html
@@ -41,7 +41,27 @@
<section>
<h1>Pystache</h1>
-<p><img src="https://s3.amazonaws.com/webdev_bucket/pystache.png" alt="" title="mustachioed, monocled snake by David Phillips"></p>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<p><img src="https://raw.github.com/defunkt/pystache/master/gh/images/logo_phillips.png" alt="" title="mustachioed, monocled snake by David Phillips"></p>
+
+<p><img src="https://secure.travis-ci.org/defunkt/pystache.png" alt=""></p>
<p><a href="https://github.com/defunkt/pystache">Pystache</a> is a Python
implementation of <a href="http://mustache.github.com/">Mustache</a>. Mustache is a
@@ -61,8 +81,6 @@ on <a href="http://pypi.python.org/pypi/pystache">PyPI</a>. This version of
Pystache passes all tests in <a href="https://github.com/mustache/spec/tree/v1.1.2">version
1.1.2</a> of the spec.</p>
-<p>Logo: <a href="http://davidphillips.us/">David Phillips</a></p>
-
<h2>Requirements</h2>
<p>Pystache is tested with--</p>
@@ -76,7 +94,16 @@ Pystache passes all tests in <a href="https://github.com/mustache/spec/tree/v1.1
<li> Python 2.7</li>
<li> Python 3.1</li>
<li> Python 3.2</li>
-</ul><p>JSON support is needed only for the command-line interface and to run
+<li> Python 3.3</li>
+<li> <a href="http://pypy.org/">PyPy</a>
+</li>
+</ul><p><a href="http://packages.python.org/distribute/">Distribute</a> (the setuptools fork)
+is recommended over <a href="http://pypi.python.org/pypi/setuptools">setuptools</a>,
+and is required in some cases (e.g. for Python 3 support).
+If you use <a href="http://www.pip-installer.org/">pip</a>, you probably already satisfy
+this requirement.</p>
+
+<p>JSON support is needed only for the command-line interface and to run
the spec tests. We require simplejson for earlier versions of Python
since Python's <a href="http://docs.python.org/library/json.html">json</a> module
was added in Python 2.6.</p>
@@ -92,7 +119,11 @@ as follows:</p>
<h2>Install It</h2>
<pre><code>pip install pystache
-pystache-test
+</code></pre>
+
+<p>And test it--</p>
+
+<pre><code>pystache-test
</code></pre>
<p>To install and test from source (e.g. from GitHub), see the Develop
@@ -165,8 +196,8 @@ slightly differently between Python 2 and 3, as follows:</p>
<ul>
<li> In Python 2, the default html-escape function <code>cgi.escape()</code> does
-not escape single quotes; whereas in Python 3, the default escape
-function <code>html.escape()</code> does escape single quotes.</li>
+not escape single quotes. In Python 3, the default escape function
+<code>html.escape()</code> does escape single quotes.</li>
<li> In both Python 2 and 3, the string and file encodings default to
<code>sys.getdefaultencoding()</code>. However, this function can return
different values under Python 2 and 3, even when run from the same
@@ -217,7 +248,8 @@ default to values set in Pystache's <code>defaults</code> module.</p>
<p>To test Pystache with multiple versions of Python (with a single
command!), you can use <a href="http://pypi.python.org/pypi/tox">tox</a>:</p>
-<pre><code>pip install tox
+<pre><code>pip install 'virtualenv&lt;1.8' # Version 1.8 dropped support for Python 2.4.
+pip install 'tox&lt;1.4' # Version 1.4 dropped support for Python 2.4.
tox
</code></pre>
@@ -248,18 +280,37 @@ parses the json files. To install PyYAML--</p>
nosetests --tests pystache/tests/test_context.py:GetValueTests.test_dictionary__key_present
</code></pre>
-<p><strong>Running Pystache from source with Python 3.</strong> Pystache is written in
-Python 2 and must be converted with
-<a href="http://docs.python.org/library/2to3.html">2to3</a> prior to running under
-Python 3. The installation process (and tox) do this conversion
+<h3>Using Python 3 with Pystache from source</h3>
+
+<p>Pystache is written in Python 2 and must be converted to Python 3 prior to
+using it with Python 3. The installation process (and tox) do this
automatically.</p>
+<p>To convert the code to Python 3 manually (while using Python 3)--</p>
+
+<pre><code>python setup.py build
+</code></pre>
+
+<p>This writes the converted code to a subdirectory called <code>build</code>.
+By design, Python 3 builds
+<a href="https://bitbucket.org/tarek/distribute/issue/292/allow-use_2to3-with-python-2">cannot</a>
+be created from Python 2.</p>
+
+<p>To convert the code without using setup.py, you can use
+<a href="http://docs.python.org/library/2to3.html">2to3</a> as follows (two steps)--</p>
+
+<pre><code>2to3 --write --nobackups --no-diffs --doctests_only pystache
+2to3 --write --nobackups --no-diffs pystache
+</code></pre>
+
+<p>This converts the code (and doctests) in place.</p>
+
<p>To <code>import pystache</code> from a source distribution while using Python 3, be
sure that you are importing from a directory containing a converted
-version (e.g. from your site-packages directory after manually
-installing) and not from the original source directory. Otherwise, you
-will get a syntax error. You can help ensure this by not running the
-Python IDE from the project directory when importing Pystache.</p>
+version of the code (e.g. from the <code>build</code> directory after converting),
+and not from the original (unconverted) source directory. Otherwise, you will
+get a syntax error. You can help prevent this by not running the Python
+IDE from the project directory when importing Pystache while using Python 3.</p>
<h2>Mailing List</h2>
@@ -267,20 +318,26 @@ Python IDE from the project directory when importing Pystache.</p>
that there is a bit of a delay between posting a message and seeing it
appear in the mailing list archive.</p>
-<h2>Authors</h2>
+<h2>Credits</h2>
<pre><code>&gt;&gt;&gt; context = { 'author': 'Chris Wanstrath', 'maintainer': 'Chris Jerdonek' }
&gt;&gt;&gt; print pystache.render("Author: {{author}}\nMaintainer: {{maintainer}}", context)
Author: Chris Wanstrath
Maintainer: Chris Jerdonek
</code></pre>
+
+<p>Pystache logo by <a href="http://davidphillips.us/">David Phillips</a> is licensed
+under a <a href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">Creative Commons Attribution-ShareAlike 3.0 Unported
+License</a>.
+<img src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" alt="" title="Creative
+Commons Attribution-ShareAlike 3.0 Unported License"></p>
</section>
<footer>
<p>Project maintained by <a href="https://github.com/cjerdonek">cjerdonek</a></p>
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="http://twitter.com/#!/michigangraham">mattgraham</a></small></p>
</footer>
</div>
- <!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
+ <!--[if !IE]><script>fixScale(document);</script><![endif]-->
</body>
</html> \ No newline at end of file
diff --git a/javascripts/main.js b/javascripts/main.js
index 82ef28a..c57e54c 100644
--- a/javascripts/main.js
+++ b/javascripts/main.js
@@ -19,9 +19,9 @@ $(document).ready(function(){
$("nav ul li:first-child a").parent().addClass("active");
});
- $("nav ul li a").live("click",function(event) {
+ $("nav ul li").on("click", "a", function(event) {
var position = $($(this).attr("href")).offset().top - 190;
- $("html").animate({scrollTop: position},400);
+ $("html, body").animate({scrollTop: position}, 400);
$("nav ul li a").parent().removeClass("active");
$(this).parent().addClass("active");
event.preventDefault();
@@ -50,5 +50,4 @@ fixScale = function(doc) {
scales = [.25, 1.6];
doc[addEvent](type, fix, true);
}
-
}; \ No newline at end of file
diff --git a/params.json b/params.json
index 0b5904c..e3ae2a8 100644
--- a/params.json
+++ b/params.json
@@ -1 +1 @@
-{"name":"Pystache","body":"Pystache\r\n========\r\n\r\n![](https://s3.amazonaws.com/webdev_bucket/pystache.png \"mustachioed, monocled snake by David Phillips\")\r\n\r\n[Pystache](https://github.com/defunkt/pystache) is a Python\r\nimplementation of [Mustache](http://mustache.github.com/). Mustache is a\r\nframework-agnostic, logic-free templating system inspired by\r\n[ctemplate](http://code.google.com/p/google-ctemplate/) and\r\n[et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html).\r\nLike ctemplate, Mustache \"emphasizes separating logic from presentation:\r\nit is impossible to embed application logic in this template language.\"\r\n\r\nThe [mustache(5)](http://mustache.github.com/mustache.5.html) man page\r\nprovides a good introduction to Mustache's syntax. For a more complete\r\n(and more current) description of Mustache's behavior, see the official\r\n[Mustache spec](https://github.com/mustache/spec).\r\n\r\nPystache is [semantically versioned](http://semver.org) and can be found\r\non [PyPI](http://pypi.python.org/pypi/pystache). This version of\r\nPystache passes all tests in [version\r\n1.1.2](https://github.com/mustache/spec/tree/v1.1.2) of the spec.\r\n\r\nLogo: [David Phillips](http://davidphillips.us/)\r\n\r\nRequirements\r\n------------\r\n\r\nPystache is tested with--\r\n\r\n- Python 2.4 (requires simplejson [version\r\n 2.0.9](http://pypi.python.org/pypi/simplejson/2.0.9) or earlier)\r\n- Python 2.5 (requires\r\n [simplejson](http://pypi.python.org/pypi/simplejson/))\r\n- Python 2.6\r\n- Python 2.7\r\n- Python 3.1\r\n- Python 3.2\r\n\r\nJSON support is needed only for the command-line interface and to run\r\nthe spec tests. We require simplejson for earlier versions of Python\r\nsince Python's [json](http://docs.python.org/library/json.html) module\r\nwas added in Python 2.6.\r\n\r\nFor Python 2.4 we require an earlier version of simplejson since\r\nsimplejson stopped officially supporting Python 2.4 in simplejson\r\nversion 2.1.0. Earlier versions of simplejson can be installed manually,\r\nas follows:\r\n\r\n pip install 'simplejson<2.1.0'\r\n\r\nInstall It\r\n----------\r\n\r\n pip install pystache\r\n pystache-test\r\n\r\nTo install and test from source (e.g. from GitHub), see the Develop\r\nsection.\r\n\r\nUse It\r\n------\r\n\r\n >>> import pystache\r\n >>> print pystache.render('Hi {{person}}!', {'person': 'Mom'})\r\n Hi Mom!\r\n\r\nYou can also create dedicated view classes to hold your view logic.\r\n\r\nHere's your view class (in .../examples/readme.py):\r\n\r\n class SayHello(object):\r\n def to(self):\r\n return \"Pizza\"\r\n\r\nInstantiating like so:\r\n\r\n >>> from pystache.tests.examples.readme import SayHello\r\n >>> hello = SayHello()\r\n\r\nThen your template, say\\_hello.mustache (by default in the same\r\ndirectory as your class definition):\r\n\r\n Hello, {{to}}!\r\n\r\nPull it together:\r\n\r\n >>> renderer = pystache.Renderer()\r\n >>> print renderer.render(hello)\r\n Hello, Pizza!\r\n\r\nFor greater control over rendering (e.g. to specify a custom template\r\ndirectory), use the `Renderer` class like above. One can pass attributes\r\nto the Renderer class constructor or set them on a Renderer instance. To\r\ncustomize template loading on a per-view basis, subclass `TemplateSpec`.\r\nSee the docstrings of the\r\n[Renderer](https://github.com/defunkt/pystache/blob/master/pystache/renderer.py)\r\nclass and\r\n[TemplateSpec](https://github.com/defunkt/pystache/blob/master/pystache/template_spec.py)\r\nclass for more information.\r\n\r\nYou can also pre-parse a template:\r\n\r\n >>> parsed = pystache.parse(u\"Hey {{#who}}{{.}}!{{/who}}\")\r\n >>> print parsed\r\n [u'Hey ', _SectionNode(key=u'who', index_begin=12, index_end=18, parsed=[_EscapeNode(key=u'.'), u'!'])]\r\n\r\nAnd then:\r\n\r\n >>> print renderer.render(parsed, {'who': 'Pops'})\r\n Hey Pops!\r\n >>> print renderer.render(parsed, {'who': 'you'})\r\n Hey you!\r\n\r\nPython 3\r\n--------\r\n\r\nPystache has supported Python 3 since version 0.5.1. Pystache behaves\r\nslightly differently between Python 2 and 3, as follows:\r\n\r\n- In Python 2, the default html-escape function `cgi.escape()` does\r\n not escape single quotes; whereas in Python 3, the default escape\r\n function `html.escape()` does escape single quotes.\r\n- In both Python 2 and 3, the string and file encodings default to\r\n `sys.getdefaultencoding()`. However, this function can return\r\n different values under Python 2 and 3, even when run from the same\r\n system. Check your own system for the behavior on your system, or do\r\n not rely on the defaults by passing in the encodings explicitly\r\n (e.g. to the `Renderer` class).\r\n\r\nUnicode\r\n-------\r\n\r\nThis section describes how Pystache handles unicode, strings, and\r\nencodings.\r\n\r\nInternally, Pystache uses [only unicode\r\nstrings](http://docs.python.org/howto/unicode.html#tips-for-writing-unicode-aware-programs)\r\n(`str` in Python 3 and `unicode` in Python 2). For input, Pystache\r\naccepts both unicode strings and byte strings (`bytes` in Python 3 and\r\n`str` in Python 2). For output, Pystache's template rendering methods\r\nreturn only unicode.\r\n\r\nPystache's `Renderer` class supports a number of attributes to control\r\nhow Pystache converts byte strings to unicode on input. These include\r\nthe `file_encoding`, `string_encoding`, and `decode_errors` attributes.\r\n\r\nThe `file_encoding` attribute is the encoding the renderer uses to\r\nconvert to unicode any files read from the file system. Similarly,\r\n`string_encoding` is the encoding the renderer uses to convert any other\r\nbyte strings encountered during the rendering process into unicode (e.g.\r\ncontext values that are encoded byte strings).\r\n\r\nThe `decode_errors` attribute is what the renderer passes as the\r\n`errors` argument to Python's built-in unicode-decoding function\r\n(`str()` in Python 3 and `unicode()` in Python 2). The valid values for\r\nthis argument are `strict`, `ignore`, and `replace`.\r\n\r\nEach of these attributes can be set via the `Renderer` class's\r\nconstructor using a keyword argument of the same name. See the Renderer\r\nclass's docstrings for further details. In addition, the `file_encoding`\r\nattribute can be controlled on a per-view basis by subclassing the\r\n`TemplateSpec` class. When not specified explicitly, these attributes\r\ndefault to values set in Pystache's `defaults` module.\r\n\r\nDevelop\r\n-------\r\n\r\nTo test from a source distribution (without installing)--\r\n\r\n python test_pystache.py\r\n\r\nTo test Pystache with multiple versions of Python (with a single\r\ncommand!), you can use [tox](http://pypi.python.org/pypi/tox):\r\n\r\n pip install tox\r\n tox\r\n\r\nIf you do not have all Python versions listed in `tox.ini`--\r\n\r\n tox -e py26,py32 # for example\r\n\r\nThe source distribution tests also include doctests and tests from the\r\nMustache spec. To include tests from the Mustache spec in your test\r\nruns:\r\n\r\n git submodule init\r\n git submodule update\r\n\r\nThe test harness parses the spec's (more human-readable) yaml files if\r\n[PyYAML](http://pypi.python.org/pypi/PyYAML) is present. Otherwise, it\r\nparses the json files. To install PyYAML--\r\n\r\n pip install pyyaml\r\n\r\nTo run a subset of the tests, you can use\r\n[nose](http://somethingaboutorange.com/mrl/projects/nose/0.11.1/testing.html):\r\n\r\n pip install nose\r\n nosetests --tests pystache/tests/test_context.py:GetValueTests.test_dictionary__key_present\r\n\r\n**Running Pystache from source with Python 3.** Pystache is written in\r\nPython 2 and must be converted with\r\n[2to3](http://docs.python.org/library/2to3.html) prior to running under\r\nPython 3. The installation process (and tox) do this conversion\r\nautomatically.\r\n\r\nTo `import pystache` from a source distribution while using Python 3, be\r\nsure that you are importing from a directory containing a converted\r\nversion (e.g. from your site-packages directory after manually\r\ninstalling) and not from the original source directory. Otherwise, you\r\nwill get a syntax error. You can help ensure this by not running the\r\nPython IDE from the project directory when importing Pystache.\r\n\r\nMailing List\r\n------------\r\n\r\nThere is a [mailing list](http://librelist.com/browser/pystache/). Note\r\nthat there is a bit of a delay between posting a message and seeing it\r\nappear in the mailing list archive.\r\n\r\nAuthors\r\n-------\r\n\r\n >>> context = { 'author': 'Chris Wanstrath', 'maintainer': 'Chris Jerdonek' }\r\n >>> print pystache.render(\"Author: {{author}}\\nMaintainer: {{maintainer}}\", context)\r\n Author: Chris Wanstrath\r\n Maintainer: Chris Jerdonek\r\n","tagline":"Mustache in Python","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file
+{"body":"Pystache\r\n========\r\n\r\n<!-- Since PyPI rejects reST long descriptions that contain HTML, -->\r\n<!-- HTML comments must be removed when converting this file to reST. -->\r\n<!-- For more information on PyPI's behavior in this regard, see: -->\r\n<!-- http://docs.python.org/distutils/uploading.html#pypi-package-display -->\r\n<!-- The Pystache setup script strips 1-line HTML comments prior -->\r\n<!-- to converting to reST, so all HTML comments should be one line. -->\r\n<!-- -->\r\n<!-- We leave the leading brackets empty here. Otherwise, unwanted -->\r\n<!-- caption text shows up in the reST version converted by pandoc. -->\r\n![](https://raw.github.com/defunkt/pystache/master/gh/images/logo_phillips.png \"mustachioed, monocled snake by David Phillips\")\r\n\r\n![](https://secure.travis-ci.org/defunkt/pystache.png)\r\n\r\n[Pystache](https://github.com/defunkt/pystache) is a Python\r\nimplementation of [Mustache](http://mustache.github.com/). Mustache is a\r\nframework-agnostic, logic-free templating system inspired by\r\n[ctemplate](http://code.google.com/p/google-ctemplate/) and\r\n[et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html).\r\nLike ctemplate, Mustache \"emphasizes separating logic from presentation:\r\nit is impossible to embed application logic in this template language.\"\r\n\r\nThe [mustache(5)](http://mustache.github.com/mustache.5.html) man page\r\nprovides a good introduction to Mustache's syntax. For a more complete\r\n(and more current) description of Mustache's behavior, see the official\r\n[Mustache spec](https://github.com/mustache/spec).\r\n\r\nPystache is [semantically versioned](http://semver.org) and can be found\r\non [PyPI](http://pypi.python.org/pypi/pystache). This version of\r\nPystache passes all tests in [version\r\n1.1.2](https://github.com/mustache/spec/tree/v1.1.2) of the spec.\r\n\r\n\r\nRequirements\r\n------------\r\n\r\nPystache is tested with--\r\n\r\n- Python 2.4 (requires simplejson [version\r\n 2.0.9](http://pypi.python.org/pypi/simplejson/2.0.9) or earlier)\r\n- Python 2.5 (requires\r\n [simplejson](http://pypi.python.org/pypi/simplejson/))\r\n- Python 2.6\r\n- Python 2.7\r\n- Python 3.1\r\n- Python 3.2\r\n- Python 3.3\r\n- [PyPy](http://pypy.org/)\r\n\r\n[Distribute](http://packages.python.org/distribute/) (the setuptools fork)\r\nis recommended over [setuptools](http://pypi.python.org/pypi/setuptools),\r\nand is required in some cases (e.g. for Python 3 support).\r\nIf you use [pip](http://www.pip-installer.org/), you probably already satisfy\r\nthis requirement.\r\n\r\nJSON support is needed only for the command-line interface and to run\r\nthe spec tests. We require simplejson for earlier versions of Python\r\nsince Python's [json](http://docs.python.org/library/json.html) module\r\nwas added in Python 2.6.\r\n\r\nFor Python 2.4 we require an earlier version of simplejson since\r\nsimplejson stopped officially supporting Python 2.4 in simplejson\r\nversion 2.1.0. Earlier versions of simplejson can be installed manually,\r\nas follows:\r\n\r\n pip install 'simplejson<2.1.0'\r\n\r\nInstall It\r\n----------\r\n\r\n pip install pystache\r\n\r\nAnd test it--\r\n\r\n pystache-test\r\n\r\nTo install and test from source (e.g. from GitHub), see the Develop\r\nsection.\r\n\r\nUse It\r\n------\r\n\r\n >>> import pystache\r\n >>> print pystache.render('Hi {{person}}!', {'person': 'Mom'})\r\n Hi Mom!\r\n\r\nYou can also create dedicated view classes to hold your view logic.\r\n\r\nHere's your view class (in .../examples/readme.py):\r\n\r\n class SayHello(object):\r\n def to(self):\r\n return \"Pizza\"\r\n\r\nInstantiating like so:\r\n\r\n >>> from pystache.tests.examples.readme import SayHello\r\n >>> hello = SayHello()\r\n\r\nThen your template, say\\_hello.mustache (by default in the same\r\ndirectory as your class definition):\r\n\r\n Hello, {{to}}!\r\n\r\nPull it together:\r\n\r\n >>> renderer = pystache.Renderer()\r\n >>> print renderer.render(hello)\r\n Hello, Pizza!\r\n\r\nFor greater control over rendering (e.g. to specify a custom template\r\ndirectory), use the `Renderer` class like above. One can pass attributes\r\nto the Renderer class constructor or set them on a Renderer instance. To\r\ncustomize template loading on a per-view basis, subclass `TemplateSpec`.\r\nSee the docstrings of the\r\n[Renderer](https://github.com/defunkt/pystache/blob/master/pystache/renderer.py)\r\nclass and\r\n[TemplateSpec](https://github.com/defunkt/pystache/blob/master/pystache/template_spec.py)\r\nclass for more information.\r\n\r\nYou can also pre-parse a template:\r\n\r\n >>> parsed = pystache.parse(u\"Hey {{#who}}{{.}}!{{/who}}\")\r\n >>> print parsed\r\n [u'Hey ', _SectionNode(key=u'who', index_begin=12, index_end=18, parsed=[_EscapeNode(key=u'.'), u'!'])]\r\n\r\nAnd then:\r\n\r\n >>> print renderer.render(parsed, {'who': 'Pops'})\r\n Hey Pops!\r\n >>> print renderer.render(parsed, {'who': 'you'})\r\n Hey you!\r\n\r\nPython 3\r\n--------\r\n\r\nPystache has supported Python 3 since version 0.5.1. Pystache behaves\r\nslightly differently between Python 2 and 3, as follows:\r\n\r\n- In Python 2, the default html-escape function `cgi.escape()` does\r\n not escape single quotes. In Python 3, the default escape function\r\n `html.escape()` does escape single quotes.\r\n- In both Python 2 and 3, the string and file encodings default to\r\n `sys.getdefaultencoding()`. However, this function can return\r\n different values under Python 2 and 3, even when run from the same\r\n system. Check your own system for the behavior on your system, or do\r\n not rely on the defaults by passing in the encodings explicitly\r\n (e.g. to the `Renderer` class).\r\n\r\nUnicode\r\n-------\r\n\r\nThis section describes how Pystache handles unicode, strings, and\r\nencodings.\r\n\r\nInternally, Pystache uses [only unicode\r\nstrings](http://docs.python.org/howto/unicode.html#tips-for-writing-unicode-aware-programs)\r\n(`str` in Python 3 and `unicode` in Python 2). For input, Pystache\r\naccepts both unicode strings and byte strings (`bytes` in Python 3 and\r\n`str` in Python 2). For output, Pystache's template rendering methods\r\nreturn only unicode.\r\n\r\nPystache's `Renderer` class supports a number of attributes to control\r\nhow Pystache converts byte strings to unicode on input. These include\r\nthe `file_encoding`, `string_encoding`, and `decode_errors` attributes.\r\n\r\nThe `file_encoding` attribute is the encoding the renderer uses to\r\nconvert to unicode any files read from the file system. Similarly,\r\n`string_encoding` is the encoding the renderer uses to convert any other\r\nbyte strings encountered during the rendering process into unicode (e.g.\r\ncontext values that are encoded byte strings).\r\n\r\nThe `decode_errors` attribute is what the renderer passes as the\r\n`errors` argument to Python's built-in unicode-decoding function\r\n(`str()` in Python 3 and `unicode()` in Python 2). The valid values for\r\nthis argument are `strict`, `ignore`, and `replace`.\r\n\r\nEach of these attributes can be set via the `Renderer` class's\r\nconstructor using a keyword argument of the same name. See the Renderer\r\nclass's docstrings for further details. In addition, the `file_encoding`\r\nattribute can be controlled on a per-view basis by subclassing the\r\n`TemplateSpec` class. When not specified explicitly, these attributes\r\ndefault to values set in Pystache's `defaults` module.\r\n\r\nDevelop\r\n-------\r\n\r\nTo test from a source distribution (without installing)--\r\n\r\n python test_pystache.py\r\n\r\nTo test Pystache with multiple versions of Python (with a single\r\ncommand!), you can use [tox](http://pypi.python.org/pypi/tox):\r\n\r\n pip install 'virtualenv<1.8' # Version 1.8 dropped support for Python 2.4.\r\n pip install 'tox<1.4' # Version 1.4 dropped support for Python 2.4.\r\n tox\r\n\r\nIf you do not have all Python versions listed in `tox.ini`--\r\n\r\n tox -e py26,py32 # for example\r\n\r\nThe source distribution tests also include doctests and tests from the\r\nMustache spec. To include tests from the Mustache spec in your test\r\nruns:\r\n\r\n git submodule init\r\n git submodule update\r\n\r\nThe test harness parses the spec's (more human-readable) yaml files if\r\n[PyYAML](http://pypi.python.org/pypi/PyYAML) is present. Otherwise, it\r\nparses the json files. To install PyYAML--\r\n\r\n pip install pyyaml\r\n\r\nTo run a subset of the tests, you can use\r\n[nose](http://somethingaboutorange.com/mrl/projects/nose/0.11.1/testing.html):\r\n\r\n pip install nose\r\n nosetests --tests pystache/tests/test_context.py:GetValueTests.test_dictionary__key_present\r\n\r\n### Using Python 3 with Pystache from source\r\n\r\nPystache is written in Python 2 and must be converted to Python 3 prior to\r\nusing it with Python 3. The installation process (and tox) do this\r\nautomatically.\r\n\r\nTo convert the code to Python 3 manually (while using Python 3)--\r\n\r\n python setup.py build\r\n\r\nThis writes the converted code to a subdirectory called `build`.\r\nBy design, Python 3 builds\r\n[cannot](https://bitbucket.org/tarek/distribute/issue/292/allow-use_2to3-with-python-2)\r\nbe created from Python 2.\r\n\r\nTo convert the code without using setup.py, you can use\r\n[2to3](http://docs.python.org/library/2to3.html) as follows (two steps)--\r\n\r\n 2to3 --write --nobackups --no-diffs --doctests_only pystache\r\n 2to3 --write --nobackups --no-diffs pystache\r\n\r\nThis converts the code (and doctests) in place.\r\n\r\nTo `import pystache` from a source distribution while using Python 3, be\r\nsure that you are importing from a directory containing a converted\r\nversion of the code (e.g. from the `build` directory after converting),\r\nand not from the original (unconverted) source directory. Otherwise, you will\r\nget a syntax error. You can help prevent this by not running the Python\r\nIDE from the project directory when importing Pystache while using Python 3.\r\n\r\n\r\nMailing List\r\n------------\r\n\r\nThere is a [mailing list](http://librelist.com/browser/pystache/). Note\r\nthat there is a bit of a delay between posting a message and seeing it\r\nappear in the mailing list archive.\r\n\r\nCredits\r\n-------\r\n\r\n >>> context = { 'author': 'Chris Wanstrath', 'maintainer': 'Chris Jerdonek' }\r\n >>> print pystache.render(\"Author: {{author}}\\nMaintainer: {{maintainer}}\", context)\r\n Author: Chris Wanstrath\r\n Maintainer: Chris Jerdonek\r\n\r\nPystache logo by [David Phillips](http://davidphillips.us/) is licensed\r\nunder a [Creative Commons Attribution-ShareAlike 3.0 Unported\r\nLicense](http://creativecommons.org/licenses/by-sa/3.0/deed.en_US).\r\n![](http://i.creativecommons.org/l/by-sa/3.0/88x31.png \"Creative\r\nCommons Attribution-ShareAlike 3.0 Unported License\")\r\n","tagline":"Mustache in Python","google":"","note":"Don't delete this file! It's used internally to help with page regeneration.","name":"Pystache"} \ No newline at end of file