Expanze strings v BibTeXovém souboru?

David Necas (Yeti) yeti at physics.muni.cz
Mon Sep 29 23:25:09 CEST 2003


On Mon, Sep 29, 2003 at 11:07:12PM +0200, Matej Cepl wrote:
> Nevíte, kde je problém?

--- bibtex-expand.py.orig       2003-09-29 23:20:42.000000000 +0200
+++ bibtex-expand.py    2003-09-29 23:23:53.000000000 +0200
@@ -2,7 +2,7 @@
 import re, sys, string
 
 strre = re.compile(r'@string\{(\S+)\s*=\s*"(.*)"\}')
-otherre = re.compile(r'([^=]+=\s*)[{]+(.*?)[}]+(,\s*)$')
+otherre = re.compile(r'([^=]+=\s*)[{]+(.*?)[}]+(,?\s*)$')
 
 nahrada = {}
 inf = sys.stdin
@@ -16,7 +16,7 @@
       nahrada[string.strip(co)] = string.strip(zaco)
    else:
       m = otherre.match(radek)
-      if (m and nahrada.has_key(string.strip(m.group(3)))):
+      if (m and nahrada.has_key(string.strip(m.group(2)))):
          vlevo,vpravo,oddel  = m.groups()
          vpravomark = string.strip(vpravo)
          out.write(vlevo+'{'+nahrada[vpravomark]+'}'+oddel+'\n')


Yeti


--
Do not use tab characters. Their effect is not predictable.




More information about the csTeX mailing list