diff options
author | Zvi ben Yaakov (a.k.a rdc) <coderzvi@infosoc.net> | 2012-06-23 23:51:08 +0300 |
---|---|---|
committer | Zvi ben Yaakov (a.k.a rdc) <coderzvi@infosoc.net> | 2012-06-23 23:51:08 +0300 |
commit | 00668aaa71336f48b141c443749a66c58a555503 (patch) | |
tree | bd8a9d029ddaebbd1d8385dfd522f689e5d3891c /include/markdownify/markdownify_cli.php | |
parent | 5e3e3915e347e4c298498ce0a8c493b9cd03201b (diff) | |
parent | 381d0912672cda6575368d242565310a93e202d4 (diff) | |
download | volse-hubzilla-00668aaa71336f48b141c443749a66c58a555503.tar.gz volse-hubzilla-00668aaa71336f48b141c443749a66c58a555503.tar.bz2 volse-hubzilla-00668aaa71336f48b141c443749a66c58a555503.zip |
Merge git://github.com/friendica/friendica
Diffstat (limited to 'include/markdownify/markdownify_cli.php')
-rwxr-xr-x | include/markdownify/markdownify_cli.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/markdownify/markdownify_cli.php b/include/markdownify/markdownify_cli.php new file mode 100755 index 000000000..b3fffbd5c --- /dev/null +++ b/include/markdownify/markdownify_cli.php @@ -0,0 +1,33 @@ +#!/usr/bin/php +<?php +require dirname(__FILE__) .'/markdownify_extra.php'; + +function param($name, $default = false) { + if (!in_array('--'.$name, $_SERVER['argv'])) + return $default; + reset($_SERVER['argv']); + while (each($_SERVER['argv'])) { + if (current($_SERVER['argv']) == '--'.$name) + break; + } + $value = next($_SERVER['argv']); + if ($value === false || substr($value, 0, 2) == '--') + return true; + else + return $value; +} + + +$input = stream_get_contents(STDIN); + +$linksAfterEachParagraph = param('links'); +$bodyWidth = param('width'); +$keepHTML = param('html', true); + +if (param('no_extra')) { + $parser = new Markdownify($linksAfterEachParagraph, $bodyWidth, $keepHTML); +} else { + $parser = new Markdownify_Extra($linksAfterEachParagraph, $bodyWidth, $keepHTML); +} + +echo $parser->parseString($input) ."\n";
\ No newline at end of file |