From: Cherniavsky B. <cb...@us...> - 2003-11-26 23:10:16
|
Update of /cvsroot/docutils/sandbox/cben/rolehack In directory sc8-pr-cvs1:/tmp/cvs-serv23464/rolehack Modified Files: imgmathhack.py mathhack.py Log Message: - Mangling of all includes was a bad idea => made it trigerred by including ``.mathhack`` in included file name. - Switched to simple suffix extensions for pre/postprocessing intermediate files. - Added PDFLaTeX support. Index: imgmathhack.py =================================================================== RCS file: /cvsroot/docutils/sandbox/cben/rolehack/imgmathhack.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- imgmathhack.py 22 Nov 2003 22:10:36 -0000 1.5 +++ imgmathhack.py 26 Nov 2003 23:10:11 -0000 1.6 @@ -3,8 +3,10 @@ Convert latex math to images. Treats the default and ``texmath`` roles as inline LaTeX math and the ``texmath::`` directive as display latex math. -Mangles include directives, replacing ``.txt`` extension with -``.imgmathhack.txt`` to help arranging preprocessing of included files. +If you include a file which also needs mathhack/imgmathhack preprocessing, +write a name containing ``.mathhack`` in the include directive and it will be +replaced with ``.imgmathhack`` when preprocessed by this script (of course, +you should create both preprocessed versions of the file). .. note:: This runs external commands and leaves files after itself! To reduce @@ -89,9 +91,7 @@ texdisplay = child.texdisplay def mangle_include(text): - if text.endswith('.txt'): - text = text[:-4] + '.imgmathhack.txt' - return 'include:: ' + text + return 'include:: ' + text.replace('.mathhack', '.imgmathhack') main({'texmath': texmath}, texmath, {'texmath': texdisplay, 'include': mangle_include}) Index: mathhack.py =================================================================== RCS file: /cvsroot/docutils/sandbox/cben/rolehack/mathhack.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mathhack.py 22 Nov 2003 22:10:36 -0000 1.4 +++ mathhack.py 26 Nov 2003 23:10:12 -0000 1.5 @@ -26,10 +26,5 @@ \[ ''', ' \]\n') -def mangle_include(text): - if text.endswith('.txt'): - text = text[:-4] + '.mathhack.txt' - return 'include:: ' + text - main({'texmath': texmath}, texmath, - {'texmath': texdisplay, 'include': mangle_include}) + {'texmath': texdisplay}) |