Created
January 30, 2017 21:24
-
-
Save Grummfy/5fe09c79f7a86dd9b2495d2d2eec502e to your computer and use it in GitHub Desktop.
markdown link to restructured (rst) synthax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$oldFileContent = file($argv[1]); | |
$newFileContent = array(); | |
foreach ($oldFileContent as $line) | |
{ | |
$pattern = '#(.*)\[([[:print:]]*)\]\((https?://.*)\)(.*)#'; | |
$newFileContent[] = preg_replace($pattern, '$1`$2 <$3>`_$4', $line); | |
} | |
file_put_contents($argv[1], implode('', $newFileContent)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -name *.rst -exec php php.php {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment