Skip to content

Commit

Permalink
Add missing formatting tags to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
u01jmg3 committed Dec 30, 2018
1 parent cbb5de3 commit 9d1ee99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docx2md.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,10 @@ private function docx2md(array $args, $isTestMode = false)
// Remove whitespace between tags
$xml = preg_replace('/(\>)\s+(\<)/m', '\\1\\2', $xml);

// Ensure spacing exists between closing and opening tags
$xml = preg_replace('/(<\/i:(bold|italic)>)(<i:(bold|italic)>)([^\.,;:\?\!])/', '\\1 \\3\\5', $xml);
// Ensure spacing exists between closing and opening formatting tags
// unless punctuation is encountered
$anyFormattingTag = 'i:(bold|italic|strikethrough|line)';
$xml = preg_replace("/(<\/{$anyFormattingTag}>)(<{$anyFormattingTag}>)([^\.,;:\?\!])/", '\\1 \\3\\5', $xml);

$intermediaryDocument->loadXML($xml);

Expand Down

1 comment on commit 9d1ee99

@u01jmg3
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relates to 11d4e88

Please sign in to comment.