package opytex!

This commit is contained in:
lafrite 2015-05-16 10:42:39 +02:00
parent 03ed2b3f12
commit 44a2934c2d
9 changed files with 61 additions and 6 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
tests/ tests/
__pycache__/ __pycache__/
*.pyc *.pyc
build/
dist/
Opytex.egg-info/

2
MANIFEST.in Normal file
View File

@ -0,0 +1,2 @@
incude *.rst
recursive-include documentation *.txt *.rst

14
opytex/__init__.py Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
# encoding: utf-8
__version__ = "0.1"
from .texenv import texenv
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

15
opytex/__main__.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
# encoding: utf-8
from .opytex import main
main()
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del

View File

@ -7,7 +7,7 @@ import optparse
import csv import csv
from path import path from path import path
from texenv import texenv from .texenv import texenv
import math as m import math as m
import random as rd import random as rd
@ -29,7 +29,7 @@ export_dict.update({"Expression":Expression,\
"random_str": random_str,\ "random_str": random_str,\
}) })
def main(options): def produce_and_compile(options):
#template = report_renderer.get_template(options.template) #template = report_renderer.get_template(options.template)
template = texenv.get_template(options.template) template = texenv.get_template(options.template)
@ -82,9 +82,7 @@ def main(options):
cwd.cd() cwd.cd()
if __name__ == '__main__': def main():
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.add_option("-t","--template",action="store",type="string",dest="template", help="File with the template. The name should have the following form tpl_... .") parser.add_option("-t","--template",action="store",type="string",dest="template", help="File with the template. The name should have the following form tpl_... .")
parser.add_option("-o","--output",action="store",type="string",dest="output",help="Base name for output )") parser.add_option("-o","--output",action="store",type="string",dest="output",help="Base name for output )")
@ -101,7 +99,12 @@ if __name__ == '__main__':
print("I need a template!") print("I need a template!")
sys.exit(0) sys.exit(0)
main(options) produce_and_compile(options)
if __name__ == '__main__':
main()
# ----------------------------- # -----------------------------
# Reglages pour 'vim' # Reglages pour 'vim'

View File

@ -3,6 +3,8 @@
import jinja2, os import jinja2, os
__all__ = ["texenv"]
# Definition of jinja syntax for latex # Definition of jinja syntax for latex
texenv = jinja2.Environment( texenv = jinja2.Environment(
block_start_string = '\Block{', block_start_string = '\Block{',

16
setup.py Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
#from distutils.core import setup
from setuptools import setup
setup(name='Opytex',
version='0.1',
description='Jinja environment for latex with computing macros',
author='Benjamin Bertrand',
author_email='lafrite@poneyworld.net',
packages=['opytex'],
install_requiers=['jinja2', 'pyMath', 'path'],
entry_points = {
"console_scripts": ['opytex= opytex.opytex:main']
},
)