commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/reports/samples/mailmerge README mailmerge...


From: Jason Cater
Subject: gnue/reports/samples/mailmerge README mailmerge...
Date: Thu, 04 Oct 2001 23:16:19 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/10/04 23:16:19

Modified files:
        reports/samples/mailmerge: README mailmerge.py merge-latex 

Log message:
        added escaping for special chars; misc cleanup

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/mailmerge/README.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/mailmerge/mailmerge.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/mailmerge/merge-latex.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/reports/samples/mailmerge/README
diff -u gnue/reports/samples/mailmerge/README:1.3 
gnue/reports/samples/mailmerge/README:1.4
--- gnue/reports/samples/mailmerge/README:1.3   Thu Oct  4 22:22:01 2001
+++ gnue/reports/samples/mailmerge/README       Thu Oct  4 23:16:19 2001
@@ -30,5 +30,15 @@
 If all goes well, you should be able to run sample.tex with the latex 
 command or open sample.tex with any LaTex importer (e.g., AbiWord & KWord) 
 
+How it works: 
+The merge-latex searches for a \begin{document} and \end{document} pair. 
+Everything in between is treated as a repeatable section. If multiple
+records exist in the mailmerge, then this repeatable section has a
+\newpage added between each instance. 
 
+For converters between LaTex and document formats, see the FAQ at: 
+   http://tug.org/utilities/texconv/
+
+This works with LaTex files created with the "Save As" (LaTex format) 
+commands of AbiWord and KWord. Your mileage may vary. 
 
Index: gnue/reports/samples/mailmerge/mailmerge.py
diff -u gnue/reports/samples/mailmerge/mailmerge.py:1.1 
gnue/reports/samples/mailmerge/mailmerge.py:1.2
--- gnue/reports/samples/mailmerge/mailmerge.py:1.1     Thu Oct  4 22:14:25 2001
+++ gnue/reports/samples/mailmerge/mailmerge.py Thu Oct  4 23:16:19 2001
@@ -51,6 +51,9 @@
     self.fieldre = re.compile("%s(\\w+)%s" % \
           (self.FIELD_ENCLOSURE, self.FIELD_ENCLOSURE))
 
+  def escape(self, s):
+    return string
+
   def printComment (self, out, comment):
     if self.COMMENTABLE:
       if not self.MULTILINE_COMMENTS:
@@ -123,7 +126,7 @@
   def getFieldValue(self, matchObject):
     name = string.lower(matchObject.group(1))
     try:
-      return self.values[name]
+      return self.escape(self.values[name])
     except KeyError:
       return ""
 
Index: gnue/reports/samples/mailmerge/merge-latex
diff -u gnue/reports/samples/mailmerge/merge-latex:1.1 
gnue/reports/samples/mailmerge/merge-latex:1.2
--- gnue/reports/samples/mailmerge/merge-latex:1.1      Thu Oct  4 22:14:25 2001
+++ gnue/reports/samples/mailmerge/merge-latex  Thu Oct  4 23:16:19 2001
@@ -50,9 +50,19 @@
   COMMENT_END = "\n"     # The ending of a comment
   MULTILINE_COMMENTS = 0 # Are these multiline comments?
 
+  # Escape special characters
+  def escape(self, s):
+    if not len(s): return s
+    parts = []
+    for part in string.split (s,"\\"):
+      for char in r'#$%{}&_':
+        part = string.replace(part,char,'\\' + char)
+      parts.append(part)
 
+    return string.join(parts,r'\ensuremath{\backslash}')
 
+
 if __name__ == "__main__":
   template = open(sys.argv[1])
   LatexMerge().merge(sys.stdin, template, sys.stdout)
-  template.close()
\ No newline at end of file
+  template.close()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]