Commit 15743bfd3abaf3e35b9f9a3a2e1f92fb6b67a839

Authored by Etienne Stalmans
Committed by GitHub
2 parents 2e161003 281a2e3c

Merge branch 'master' into ddedev

Showing 1 changed file with 4 additions and 4 deletions
oletools/msodde.py
@@ -89,8 +89,8 @@ TAG_W_P = "{%s}p" % NS_WORD @@ -89,8 +89,8 @@ TAG_W_P = "{%s}p" % NS_WORD
89 TAG_W_R = "{%s}r" % NS_WORD 89 TAG_W_R = "{%s}r" % NS_WORD
90 ATTR_W_INSTR = '{%s}instr' % NS_WORD 90 ATTR_W_INSTR = '{%s}instr' % NS_WORD
91 ATTR_W_FLDCHARTYPE = '{%s}fldCharType' % NS_WORD 91 ATTR_W_FLDCHARTYPE = '{%s}fldCharType' % NS_WORD
92 -  
93 LOCATIONS = ['word/document.xml','word/endnotes.xml','word/footnotes.xml','word/header1.xml','word/footer1.xml','word/header2.xml','word/footer2.xml','word/comments.xml'] 92 LOCATIONS = ['word/document.xml','word/endnotes.xml','word/footnotes.xml','word/header1.xml','word/footer1.xml','word/header2.xml','word/footer2.xml','word/comments.xml']
  93 +
94 # === FUNCTIONS ============================================================== 94 # === FUNCTIONS ==============================================================
95 95
96 def process_args(): 96 def process_args():
@@ -119,6 +119,7 @@ def process_file(data): @@ -119,6 +119,7 @@ def process_file(data):
119 # fldChar can be in either a w:r element, floating alone in the w:p or spread accross w:p tags 119 # fldChar can be in either a w:r element, floating alone in the w:p or spread accross w:p tags
120 # escape DDE if quoted etc 120 # escape DDE if quoted etc
121 # (each is a chunk of a DDE link) 121 # (each is a chunk of a DDE link)
  122 +
122 for subs in root.iter(TAG_W_P): 123 for subs in root.iter(TAG_W_P):
123 elem = None 124 elem = None
124 for e in subs: 125 for e in subs:
@@ -150,13 +151,11 @@ def process_file(data): @@ -150,13 +151,11 @@ def process_file(data):
150 #expand field code if QUOTED 151 #expand field code if QUOTED
151 ddetext += unquote(elem.text) 152 ddetext += unquote(elem.text)
152 153
153 -  
154 for elem in root.iter(TAG_W_FLDSIMPLE): 154 for elem in root.iter(TAG_W_FLDSIMPLE):
155 # concatenate the attribute of the field, if present: 155 # concatenate the attribute of the field, if present:
156 if elem.attrib is not None: 156 if elem.attrib is not None:
157 fields.append(elem.attrib[ATTR_W_INSTR]) 157 fields.append(elem.attrib[ATTR_W_INSTR])
158 -  
159 - 158 +
160 return fields 159 return fields
161 160
162 def unquote(field): 161 def unquote(field):
@@ -173,6 +172,7 @@ def unquote(field): @@ -173,6 +172,7 @@ def unquote(field):
173 ddestr += ch 172 ddestr += ch
174 return ddestr 173 return ddestr
175 174
  175 +
176 #=== MAIN ================================================================= 176 #=== MAIN =================================================================
177 177
178 def main(): 178 def main():