@@ -695,19 +695,28 @@ public function testFixBrokenMacros()
695
695
$ this ->assertEquals ('<w:r><w:t>${documentContent}</w:t></w:r> ' , $ fixed );
696
696
697
697
$ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>$</w:t><w:t>{documentContent}</w:t></w:r> ' );
698
- $ this ->assertEquals ('<w:r><w:t>${documentContent}</w:t></w:r> ' , $ fixed );
698
+ $ this ->assertEquals ('<w:r><w:t>${documentContent}</w:t><w:t xml:space="preserve"></w:t>< /w:r> ' , $ fixed );
699
699
700
700
$ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>$1500</w:t><w:t>${documentContent}</w:t></w:r> ' );
701
701
$ this ->assertEquals ('<w:r><w:t>$1500</w:t><w:t>${documentContent}</w:t></w:r> ' , $ fixed );
702
702
703
703
$ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>$1500</w:t><w:t>$</w:t><w:t>{documentContent}</w:t></w:r> ' );
704
- $ this ->assertEquals ('<w:r><w:t>$1500</w:t><w:t>${documentContent}</w:t></w:r> ' , $ fixed );
704
+ $ this ->assertEquals ('<w:r><w:t>$1500</w:t><w:t>${documentContent}</w:t><w:t xml:space="preserve"></w:t>< /w:r> ' , $ fixed );
705
705
706
706
$ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>25$ plus some info {hint}</w:t></w:r> ' );
707
707
$ this ->assertEquals ('<w:r><w:t>25$ plus some info {hint}</w:t></w:r> ' , $ fixed );
708
708
709
709
$ fixed = $ templateProcessor ->fixBrokenMacros ('<w:t>$</w:t></w:r><w:bookmarkStart w:id="0" w:name="_GoBack"/><w:bookmarkEnd w:id="0"/><w:r><w:t xml:space="preserve">15,000.00. </w:t></w:r><w:r w:rsidR="0056499B"><w:t>$</w:t></w:r><w:r w:rsidR="00573DFD" w:rsidRPr="00573DFD"><w:rPr><w:iCs/></w:rPr><w:t>{</w:t></w:r><w:proofErr w:type="spellStart"/><w:r w:rsidR="00573DFD" w:rsidRPr="00573DFD"><w:rPr><w:iCs/></w:rPr><w:t>variable_name</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r w:rsidR="00573DFD" w:rsidRPr="00573DFD"><w:rPr><w:iCs/></w:rPr><w:t>}</w:t></w:r> ' );
710
- $ this ->assertEquals ('<w:t>$</w:t></w:r><w:bookmarkStart w:id="0" w:name="_GoBack"/><w:bookmarkEnd w:id="0"/><w:r><w:t xml:space="preserve">15,000.00. </w:t></w:r><w:r w:rsidR="0056499B"><w:t>${variable_name}</w:t></w:r> ' , $ fixed );
710
+ $ this ->assertEquals ('<w:t>$</w:t></w:r><w:bookmarkStart w:id="0" w:name="_GoBack"/><w:bookmarkEnd w:id="0"/><w:r><w:t xml:space="preserve">15,000.00. </w:t></w:r><w:r w:rsidR="0056499B"><w:t>${variable_name}</w:t></w:r><w:r w:rsidR="00573DFD" w:rsidRPr="00573DFD"><w:rPr><w:iCs/></w:rPr><w:t xml:space="preserve"></w:t></w:r><w:proofErr w:type="spellStart"/><w:r w:rsidR="00573DFD" w:rsidRPr="00573DFD"><w:rPr><w:iCs/></w:rPr><w:t xml:space="preserve"></w:t></w:r><w:proofErr w:type="spellEnd"/><w:r w:rsidR="00573DFD" w:rsidRPr="00573DFD"><w:rPr><w:iCs/></w:rPr><w:t xml:space="preserve"></w:t></w:r> ' , $ fixed );
711
+
712
+ $ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>before ${</w:t></w:r><w:r><w:t xml:space="preserve">variable} </w:t></w:r><w:r><w:t>after</w:t></w:r> ' );
713
+ $ this ->assertEquals ('<w:r><w:t>before ${variable}</w:t></w:r><w:r><w:t xml:space="preserve"> </w:t></w:r><w:r><w:t>after</w:t></w:r> ' , $ fixed );
714
+
715
+ $ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>before ${</w:t></w:r><w:r><w:t>variable</w:t></w:r><w:r><w:t xml:space="preserve">} </w:t></w:r><w:r><w:t>after</w:t></w:r> ' );
716
+ $ this ->assertEquals ('<w:r><w:t>before ${variable}</w:t></w:r><w:r><w:t xml:space="preserve"></w:t></w:r><w:r><w:t xml:space="preserve"> </w:t></w:r><w:r><w:t>after</w:t></w:r> ' , $ fixed );
717
+
718
+ $ fixed = $ templateProcessor ->fixBrokenMacros ('<w:r><w:t>${</w:t></w:r><w:r><w:t>variable1</w:t></w:r><w:r><w:t>} ${</w:t></w:r><w:r><w:t>variable2</w:t></w:r><w:r><w:t>}</w:t></w:r> ' );
719
+ $ this ->assertEquals ('<w:r><w:t>${variable1}</w:t></w:r><w:r><w:t xml:space="preserve"></w:t></w:r><w:r><w:t xml:space="preserve"> ${variable2}</w:t></w:r><w:r><w:t xml:space="preserve"></w:t></w:r><w:r><w:t xml:space="preserve"></w:t></w:r> ' , $ fixed );
711
720
}
712
721
713
722
/**
0 commit comments