Add filter and create setup function
This commit is contained in:
parent
c0f2882310
commit
c3474d4f17
@ -1,31 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
Custom filter for Bopytex
|
|
||||||
"""
|
|
||||||
|
|
||||||
def do_calculus(steps, name="A", sep="=", end="", joining=" \\\\ \n"):
|
|
||||||
"""Display properly the calculus
|
|
||||||
|
|
||||||
Generate this form string:
|
|
||||||
"name & sep & a_step end joining"
|
|
||||||
|
|
||||||
:param steps: list of steps
|
|
||||||
:returns: latex string ready to be endbeded
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
ans = joining.join([
|
|
||||||
name + " & "
|
|
||||||
+ sep + " & "
|
|
||||||
+ str(s) + end for s in steps
|
|
||||||
])
|
|
||||||
return ans
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Reglages pour 'vim'
|
|
||||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
|
||||||
# cursor: 16 del
|
|
@ -13,6 +13,7 @@ import sys
|
|||||||
from path import Path
|
from path import Path
|
||||||
import pytex
|
import pytex
|
||||||
import pymath
|
import pymath
|
||||||
|
import opytex.filters as filters
|
||||||
|
|
||||||
formatter = logging.Formatter('%(name)s :: %(levelname)s :: %(message)s')
|
formatter = logging.Formatter('%(name)s :: %(levelname)s :: %(message)s')
|
||||||
steam_handler = logging.StreamHandler()
|
steam_handler = logging.StreamHandler()
|
||||||
@ -25,18 +26,20 @@ logger = logging.getLogger(__name__)
|
|||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
logger.addHandler(steam_handler)
|
logger.addHandler(steam_handler)
|
||||||
|
|
||||||
MAPYTEX_TOOLS = {
|
def setup():
|
||||||
"Expression": pymath.Expression,
|
mapytex_tools = {
|
||||||
"Polynom": pymath.Polynom,
|
"Expression": pymath.Expression,
|
||||||
"Fraction": pymath.Fraction,
|
"Polynom": pymath.Polynom,
|
||||||
"Equation": pymath.Equation,
|
"Fraction": pymath.Fraction,
|
||||||
"random_str": pymath.random_str,
|
"Equation": pymath.Equation,
|
||||||
"random_pythagore": pymath.random_pythagore,
|
"random_str": pymath.random_str,
|
||||||
"Dataset": pymath.Dataset,
|
"random_pythagore": pymath.random_pythagore,
|
||||||
"WeightedDataset": pymath.WeightedDataset,
|
"Dataset": pymath.Dataset,
|
||||||
}
|
"WeightedDataset": pymath.WeightedDataset,
|
||||||
|
}
|
||||||
|
pytex.update_export_dict(mapytex_tools)
|
||||||
|
|
||||||
pytex.update_export_dict(MAPYTEX_TOOLS)
|
pytex.add_filter("do_calculus", filters.do_calculus)
|
||||||
|
|
||||||
|
|
||||||
def get_working_dir(options):
|
def get_working_dir(options):
|
||||||
@ -168,6 +171,8 @@ def produce_and_compile(options):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
setup()
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
"-t",
|
"-t",
|
||||||
|
Loading…
Reference in New Issue
Block a user