Last active
August 29, 2015 14:01
Revisions
-
wouterj revised this gist
May 10, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,12 +37,12 @@ function remove_dollars(Editor $editor, File $file) { $editor->moveDown($file); while ((bool) preg_match('/^ /', $line = $lines[$file->getCurrentLineNumber()]) || '' === $line) { if ('' !== $line) { $editor->replaceWith($file, '/\$ /', ''); } $editor->moveDown($file); } remove_dollars($editor, $file); } -
wouterj revised this gist
May 10, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,6 @@ require_once __DIR__.'/../vendor/autoload.php'; use Gnugat\Redaktilo\Filesystem; use Gnugat\Redaktilo\Editor; use Gnugat\Redaktilo\File; -
wouterj created this gist
May 10, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ <?php require_once __DIR__.'/../vendor/autoload.php'; use Wj\fn as f; use Gnugat\Redaktilo\Filesystem; use Gnugat\Redaktilo\Editor; use Gnugat\Redaktilo\File; use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem; $symfonyFilesystem = new SymfonyFilesystem(); $filesystem = new Filesystem($symfonyFilesystem); $editor = new Editor($filesystem); $files = new \RegexIterator( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator(__DIR__.'/../') ), '/\.rst(?:\.inc)?$/', \RegexIterator::MATCH ); foreach ($files as $filename) { $file = $editor->open($filename); try { remove_dollars($editor, $file); } catch (\Exception $e) { } echo $filename, PHP_EOL; $editor->save($file); } function remove_dollars(Editor $editor, File $file) { $editor->jumpDownTo($file, '.. code-block:: bash'); $lines = $file->readlines(); $editor->moveDown($file); while ((bool) preg_match('/^ /', $line = $lines[$file->getCurrentLineNumber()]) || '' === $line) { if ('app' === substr(trim($line), 0, 3)) { $editor->replaceWith($file, '/app/', 'php app'); } $editor->moveDown($file); } remove_dollars($editor, $file); }