* Add test to demonstrate empty strings not creating runs
* Fix Run not creating Text child for empty strings
* Simplify TextRun constructor
Since `Run` already has a option for instantiating a `Text` element, we don't need to push children here.
* Add replacer test for empty runs
* Add replacer test for empty runs
* replacer: handle patches with empty runs
* Fix incorrect test name
* Adjust test to demo duplicated br tags
* Fix patchDocument duplicating br tags
* Only include w:Pr
* Fix tag condition
---------
Co-authored-by: Dolan <dolan_miu@hotmail.com>
* Turn patch document into options object
Add outputType to options
* Set keep styles to true by default
* Simplify method
* Rename variable
* #2267 Multiple patches of same key
* Remove path which won't be visited
There were scenarios in which patching a document would result in loss
of style for the template runs and, possibly, their right-adjacent run
as well (post-splitting). That was due to the run style elements not
being added to the newly created runs.
This commit addresses this issue by introducing a new, optional, flag
for the `patchDocument` function: `keepOriginalStyles`. It defaults to
`false` (current behavior) and, when `true`, ensures that there is no
loss of styling.
This should address https://github.com/dolanmiu/docx/issues/2293.