Skip to content

Commit 2434620

Browse files
committed
Streamline the directory separator used throughout the script
1 parent b677f46 commit 2434620

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docx2md.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ private function docx2md(array $args, $isTestMode = false)
283283
$imageFolder = "{$destination}\\images";
284284
if (file_exists($imageFolder) && is_dir($imageFolder)) {
285285
// Clean-up existing images only associated with the defined markdown file
286-
$images = glob("{$imageFolder}/" . basename($mdFilename, '.md') . '.*.{bmp,gif,jpg,jpeg,png}', GLOB_BRACE);
286+
$images = glob("{$imageFolder}\\" . basename($mdFilename, '.md') . '.*.{bmp,gif,jpg,jpeg,png}', GLOB_BRACE);
287287
foreach ($images as $image) {
288288
if (is_file($image)) {
289289
unlink($image);
@@ -394,7 +394,7 @@ private function docx2md(array $args, $isTestMode = false)
394394
// Ensure spacing exists between closing and opening formatting tags
395395
// unless punctuation is encountered
396396
$anyFormattingTag = 'i:(bold|italic|strikethrough|line)';
397-
$xml = preg_replace("/(<\/{$anyFormattingTag}>)(<{$anyFormattingTag}>)([^" . self::REGEX_PUNCTUATION . "])/", '\\1 \\3\\5', $xml);
397+
$xml = preg_replace("/(<\/{$anyFormattingTag}>)(<{$anyFormattingTag}>)([^" . self::REGEX_PUNCTUATION . '])/', '\\1 \\3\\5', $xml);
398398

399399
$intermediaryDocument->loadXML($xml);
400400

@@ -549,7 +549,7 @@ private function extractFolder($zip, $folderName, $destination, $imageFolder = n
549549
if (!is_null($imageFolder) && !is_null($mdFilename)) {
550550
// Save matching images to disk
551551
if (preg_match('([^\s]+(\.(?i)(bmp|gif|jpe?g|png))$)', $fileName)) {
552-
file_put_contents("{$imageFolder}/" . basename($mdFilename, '.md') . '.' . basename($fileName), $zip->getFromIndex($i));
552+
file_put_contents("{$imageFolder}\\" . basename($mdFilename, '.md') . '.' . basename($fileName), $zip->getFromIndex($i));
553553
}
554554
}
555555

@@ -566,7 +566,7 @@ private function extractFolder($zip, $folderName, $destination, $imageFolder = n
566566
*/
567567
private function rrmdir($directory)
568568
{
569-
foreach (glob("{$directory}/*") as $file) {
569+
foreach (glob("{$directory}\\*") as $file) {
570570
if (is_dir($file)) {
571571
$this->rrmdir($file);
572572
} else {
@@ -687,7 +687,7 @@ private function runTests(array $args)
687687
$formatter = ' %s. %s' . self::WHITE . ': %s' . PHP_EOL;
688688
$output = self::WHITE;
689689

690-
$files = glob("{$src}/docx/*.docx");
690+
$files = glob("{$src}\\docx\\*.docx");
691691
$size = sizeof($files);
692692
$charCount = 0;
693693

@@ -700,7 +700,7 @@ private function runTests(array $args)
700700

701701
$markdown = $this->docx2md(array('', '-i', $file1, $file2), true)
702702
->markdown;
703-
$md = "{$src}/md/{$file2}";
703+
$md = "{$src}\\md\\{$file2}";
704704

705705
$fileHash1 = sha1(preg_replace('/\v+/', PHP_EOL . PHP_EOL, $markdown));
706706
$fileHash2 = sha1(preg_replace('/\v+/', PHP_EOL . PHP_EOL, file_get_contents($md)));

0 commit comments

Comments
 (0)