aboutsummaryrefslogtreecommitdiffstats
path: root/include/markdownify/markdownify_cli.php
diff options
context:
space:
mode:
authorMichael <icarus@dabo.de>2012-06-18 08:51:12 +0200
committerMichael <icarus@dabo.de>2012-06-18 08:51:12 +0200
commit6eaca19f4195a5f8f2c1b6b1e51c6e52bad67d96 (patch)
tree2dd0bdf8d76dac54b69c2abdf7be661146fd630b /include/markdownify/markdownify_cli.php
parentd53414a333964026c26c3acee0d953e742a9a633 (diff)
parentcc56f33b80bdd871b8a1245e3c4bd3a31ed49330 (diff)
downloadvolse-hubzilla-6eaca19f4195a5f8f2c1b6b1e51c6e52bad67d96.tar.gz
volse-hubzilla-6eaca19f4195a5f8f2c1b6b1e51c6e52bad67d96.tar.bz2
volse-hubzilla-6eaca19f4195a5f8f2c1b6b1e51c6e52bad67d96.zip
Merge branch 'master' of github.com:annando/friendica
Conflicts: include/oembed.php
Diffstat (limited to 'include/markdownify/markdownify_cli.php')
-rwxr-xr-xinclude/markdownify/markdownify_cli.php33
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