Reorganize source tree and add a setup script

This commit is contained in:
Sven Slootweg 2013-04-22 01:06:28 +02:00
parent d4f3a2cff0
commit b97cec6aaa
16 changed files with 66 additions and 6 deletions

3
.gitignore vendored
View file

@ -1 +1,4 @@
*.pyc
build/
dist/
zippydoc.egg-info/

1
MANIFEST.in Normal file
View file

@ -0,0 +1 @@
include src/zippydoc/data/*

49
setup.py Normal file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env python
"""
distutils/setuptools install script. See inline comments for packaging documentation.
"""
import os
import sys
try:
from setuptools import setup
# hush pyflakes
setup
except ImportError:
from distutils.core import setup
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
packages = ['zippydoc']
package_dir = {"zippydoc": "src/zippydoc"}
package_data = {"zippydoc": ["data/template.html"]}
scripts = [
'zpy2html'
]
print repr(package_data)
setup(
name='zippydoc',
version='1.0',
maintainer='Sven Slootweg',
maintainer_email='admin@cryto.net',
description='Documentation markup language and library, including HTML converter.',
url='http://www.cryto.net/zippydoc',
packages=packages,
package_dir=package_dir,
package_data=package_data,
include_package_data=True,
scripts=scripts,
install_requires=['argparse'],
cmdclass={'build_py': build_py}
)

View file

@ -172,6 +172,6 @@
$ my_function("ZippyDoc", "awesome")
&gt; "ZippyDoc is awesome!"</pre><h7>Result:</h7><div class="definition"><a name="my_functionargument1argument2">my_function(argument1, argument2) <div class="children"><div class="exclamation"><strong>Important:</strong> This is just an example! <div class="children"></div></div><div class="text">This is a function.</div><dl><dt>argument1</dt><dd>This is the first argument.<div class="children"></div></dd></dl><dl><dt>argument2</dt><dd>This is the second argument.<div class="children"></div></dd></dl><div class="example">Example: How to call my_function <div class="children"><h7>Code:</h7><pre class="code">my_function("ZippyDoc", "awesome")</pre><h7>Output:</h7><pre class="output">"ZippyDoc is awesome!"</pre></div></div></div></a></div><h2>Documentation</h2><div class="text">The documentation for ZippyDoc can be found <a href="documentation.html">here</a>.</div><h2>Downloading ZippyDoc</h2><div class="text">ZippyDoc is still in a pretty messy stage, but it should already work reliably according to the current documentation. GitHub repository is coming soon, until that time you can <a href="zpy2html.py">download the conversion script here</a>. It's a Python script, so you'll need a Python interpreter of some sort. No dependencies are necessary, it only uses standard library functionality. Simply run it with all files you wish to convert as arguments, and it will convert each of them into a file with the same name, but a <em>.html</em> extension instead of the original extension. It's strongly recommended to name your ZippyDoc source files with the <em>.zpy</em> extension.</div></div>
&gt; "ZippyDoc is awesome!"</pre><h7>Result:</h7><div class="definition"><a name="my_functionargument1argument2">my_function(argument1, argument2) <div class="children"><div class="exclamation"><strong>Important:</strong> This is just an example! <div class="children"></div></div><div class="text">This is a function.</div><dl><dt>argument1</dt><dd>This is the first argument.<div class="children"></div></dd></dl><dl><dt>argument2</dt><dd>This is the second argument.<div class="children"></div></dd></dl><div class="example">Example: How to call my_function <div class="children"><h7>Code:</h7><pre class="code">my_function("ZippyDoc", "awesome")</pre><h7>Output:</h7><pre class="output">"ZippyDoc is awesome!"</pre></div></div></div></a></div><h2>Documentation</h2><div class="text">The documentation for ZippyDoc can be found <a href="documentation.html">here</a>.</div><h2>Downloading ZippyDoc</h2><div class="text">ZippyDoc is now a PyPi package! To install it, make sure you have pip installed, and run <span class="fixed">pip install zippydoc</span>. You can then use the <span class="fixed">zpy2html</span> command anywhere, to convert your ZippyDoc source files to HTML. The GitHub repository can be found <a href="https://github.com/joepie91/ZippyDoc">here</a>.</div></div>
</body>
</html>

View file

@ -56,7 +56,5 @@ The documentation for ZippyDoc can be found {>documentation}(here).
## Downloading ZippyDoc
ZippyDoc is still in a pretty messy stage, but it should already work reliably according to the current documentation. GitHub repository is coming soon, until that time you can
{<zpy2html.py}(download the conversion script here). It's a Python script, so you'll need a Python interpreter of some sort. No dependencies are necessary, it only uses standard
library functionality. Simply run it with all files you wish to convert as arguments, and it will convert each of them into a file with the same name, but a **.html** extension
instead of the original extension. It's strongly recommended to name your ZippyDoc source files with the **.zpy** extension.
ZippyDoc is now a PyPi package! To install it, make sure you have pip installed, and run `pip install zippydoc`. You can then use the `zpy2html` command
anywhere, to convert your ZippyDoc source files to HTML. The GitHub repository can be found {https://github.com/joepie91/ZippyDoc}(here).

11
zpy2html.py → zpy2html Normal file → Executable file
View file

@ -1,6 +1,15 @@
#!/usr/bin/env python
import os, argparse, sys, re
import zippydoc
import os
_ROOT = os.path.abspath(os.path.dirname(zippydoc.__file__))
def get_data(path):
return os.path.join(_ROOT, 'data', path)
parser = argparse.ArgumentParser(description='Converts ZippyDoc source files to HTML.')
parser.add_argument('files', metavar='FILE', type=str, nargs='+',
@ -93,7 +102,7 @@ class HtmlRuleset(zippydoc.TransformationRuleset):
files = options["files"]
template = open("template.html").read()
template = open(get_data("template.html")).read()
for zpy in files:
destination = os.path.splitext(zpy)[0] + ".html"