Add tools/markdown.php

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2678 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-03-14 10:49:41 +00:00
parent b8aae32c59
commit a8b527fbf4

23
tools/markdown.php Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/php
<?php
require_once ("domframework/markdown.php");
if (! isset ($argv[1]))
{
file_put_contents ("php://stderr", "No file to convert in markdown provided\n");
exit (1);
}
if (! file_exists ($argv[1]))
{
file_put_contents ("php://stderr", "The file to convert in markdown doesn't exists\n");
exit (2);
}
if (! is_readable ($argv[1]))
{
file_put_contents ("php://stderr", "The file to convert in markdown is not readable\n");
exit (3);
}
$md = new markdown ();
echo $md->html (file_get_contents ($argv[1]));