From: Michael Wallner Date: Tue, 17 Dec 2013 10:47:01 +0000 (+0100) Subject: rm -rf X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=bfb8546430adaa9e5d0a97d8e992839726bbb598;p=mdref%2Fmdref rm -rf --- diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 1d3e813..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -geany_run_script.sh diff --git a/.htaccess b/.htaccess deleted file mode 100644 index df161a8..0000000 --- a/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -RewriteEngine On -RewriteRule ^ index.php [L] diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 67bbd91..0000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Michael Wallner diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 816ff40..0000000 --- a/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2013, Michael Wallner . -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/VERSION b/VERSION deleted file mode 100644 index a163131..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.0alpha diff --git a/index.css b/index.css deleted file mode 100644 index a48ac00..0000000 --- a/index.css +++ /dev/null @@ -1,162 +0,0 @@ -* { - font-size: 99.9%; -} - -body, code { - font-family: Inconsolata, Monospace, 'Courier New', Courier, monospace; -} -body { - font-size: 1.5em; - margin: 0; - padding: 0; - color: #3f3f3f; -} - -body>* { - margin-left: 1em; -} -body>ul { - margin-left: 2em; -} - -.sidebar { - font-size: .9em; - float: right; - background: #f0f0f0; - border-bottom-left-radius: 10px; - padding: 0; - width: auto; - padding-right: 1em; -} -.sidebar>ul { -} -.sidebar ul { - margin-left: 1em; - padding: 0; - list-style-type: none; -} - -code { - display: inline-block; - border-radius: 2px; - padding: 0px 2px 2px 2px; - background: #e0e0e0; - color: #606060; - box-shadow: 0 0 1px #999; -} - -code code { - display: inline; - padding: 0; - background: transparent; - border: none; - box-shadow: none; -} - -pre>code { - padding: 1em; -} -pre>code, pre>code code { - background: #333; - color: #eee; -} - -p, pre { - margin: 1em 2em; -} - -blockquote { - border-top: 1px solid #800000; - border-bottom: 1px solid #800000; - background: #ffe4e1; - margin: 2em 0; -} - -ul { - margin-bottom: 2em; -} -li { - margin-bottom: .5em; -} -a, h1 code>a { - color: #2f4f4f; -} -a:hover { - text-decoration: none; -} - -.var { - color: #800000; -} -.constant { - color: #2e8b57; -} - -h1 { - line-height: 1.5; -} -h1 code { - font-weight: normal; - font-size: .9em; - line-height: 1.33; -} - -footer, h1, li h3 { - background: #708090; - color: #f5f5dc; -} - -footer, h1 { - margin: 0; - padding: 1em; -} - -li h3 { - border-radius: 4px; - display: inline-block; - width: auto; - padding: .2em; - margin: .5em 0 0 0; -} - -h1 .constant, pre>code .consant, li h3 .constant { - color: #98fb98; -} - -h1 .var, pre>code .var, li h3 .var { - color: #f4a460; -} - -footer a, h1 a, pre>code a, li h3 a { - color: #b0e0e6; -} - -li h3 a { - text-decoration: none; -} -li h3 a:hover { - text-decoration: underline; -} - -#disqus_thread { - margin-top: 8em; - margin-right: 2em; -} - -footer { - font-size: smaller; - text-align: center; - clear: both; - margin-top: 8em; -} - -footer ul { - margin: 0; - padding: 0; -} - -footer li { - list-style-type: none; - display: inline-block; - margin: 0 1em; -} diff --git a/index.js b/index.js deleted file mode 100644 index e0f3ccf..0000000 --- a/index.js +++ /dev/null @@ -1,200 +0,0 @@ -function log() { - // console.log.apply(console, arguments); -} - -function is_constant(s) { - s = s.replace(/v\d+(_\d+)?$/, ""); - if (s.length < 2) { - return false; - } - return s.toUpperCase(s) === s; -} - -function is_variable(s) { - return s.substring(0,1) === "$"; -} - -var is_in_string = false; - -function type(s, nn) { - var i, j, t; - //log("type", s); - // nothing - if (!s.match(/[a-zA-Z]/)) { - return; - } - - switch (s) { - // types - case "void": - case "bool": - case "int": - case "float": - case "string": - case "resource": - case "array": - case "object": - case "callable": - case "mixed": - // Zend/SPL - case "stdClass": - case "Exception": - case "ErrorException": - case "RuntimeException": - case "UnexpectedValueException": - case "DomainException": - case "InvalidArgumentException": - case "BadMethodCallException": - case "Closure": - case "Generator": - case "Countable": - case "Serializable": - case "Traversable": - case "Iterator": - case "IteratorAggregate": - case "ArrayAccess": - case "ArrayObject": - case "ArrayIterator": - case "RecursiveArrayIterator": - case "SplObserver": - case "SplSubject": - case "SplObjectStorage": - return ""; - - // keywords - case "is": - if (nn !== "H1") { - return; - } - case "extends": - case "implements": - if (nn === "H1") { - return "
 "; - } - case "class": - case "interface": - case "namespace": - case "public": - case "protected": - case "private": - case "static": - case "final": - case "abstract": - case "self": - case "parent": - // phrases - case "Optional": - case "optional": - return ""; - } - - // class members - if (-1 !== (i = s.indexOf("::"))) { - t = s.substring(i+2); - if (!is_constant(t) && !is_variable(t)) { - // methods - return ""; - } - } - if (-1 !== (j = s.indexOf("\\")) && s.substr(j+1,1) !== "n") { - return ""; - } - - switch (s.toLowerCase()) { - // variables - default: - if (!is_variable(s)) { - break; - } - // special constants - case "null": - case "true": - case "false": - return ""; - } - - // constants - if (is_constant(s)) { - return ""; - } -} - -function node(s, nn) { - //log("node", s); - - var t; - - if ((t = type(s, nn))) { - return $(t).text(s); - } - return document.createTextNode(s); -} -function wrap(n, nn) { - var $n = $(n) - var a = []; - - $n.text().split(/([^a-zA-Z0-9_\\\$:]+)/).forEach(function(v) { - a.push(node(v, nn)); - }); - $n.replaceWith(a); -} -function walk(i, e) { - log("walk", i, e); - - $.each($.makeArray(e.childNodes), function(i, n) { - switch (n.nodeName) { - case "A": - case "BR": - case "HR": - break; - case "#text": - wrap(n, e.nodeName); - break; - default: - walk(-1, n); - break; - } - }); -} - -function blink(c) { - var $c = $(c); - - $c.fadeOut("fast").queue(function(next) { - this.style.color = "red"; - next(); - }).fadeIn("fast").fadeOut("slow").queue(function(next) { - this.style.color = ""; - next(); - }).fadeIn("slow"); -} - -function hashchange() { - if (location.hash.length > 1) { - var hash = location.hash.substring(1); - var name = is_variable(hash) ? ".var" : ".constant"; - var scrolled = false; - - $(name).each(hash.substring(hash.length-1) === "_" ? function(i, c) { - if (c.textContent.substring(0, hash.length) === hash) { - if (!scrolled) { - $(window).scrollTop($(c).offset().top - 100); - scrolled = true; - } - blink(c); - } - } : function(i, c) { - if (c.textContent === hash) { - $(window).scrollTop($(c).offset().top - 100); - blink(c); - return false; - } - }); - } -} - -$(function() { - $("h1,h2,h3,h4,h5,h6,p,li,code").each(walk); - $(window).on("hashchange", hashchange); - hashchange(); -}); diff --git a/index.php b/index.php deleted file mode 100644 index 5124243..0000000 --- a/index.php +++ /dev/null @@ -1,256 +0,0 @@ - $value) { - switch ($spec) { - case "d": - $delim = $value; - break; - case "b": - $bytes = $value; - break; - case "f": - $fields = $value; - break; - } - } - - $result = []; - if ($bytes) { - $func = "substr"; - } else { - $func = function($a, $o = 0, $l = 0) { - return join(" ", array_slice($a, $o, $l ? $l+1 : count($a)-$o)); - }; - } - foreach ($lines as $line) { - if ($bytes) { - $spec = $bytes; - } else { - $line = split($delim, $line); - $spec = $fields; - } - - if ($spec[0] == "-") { - $result[] = $func($line, 0, $spec[1]); - } elseif ($spec[1] == "-") { - if (empty($spec[2])) { - $result[] = $func($line, $spec[0]); - } else { - $result[] = $func($line, $spec[0], $spec[2]-$spec[0]); - } - } else { - $result[] = $line{$spec[0]}; - } - } - return $result; -} - -function head($file, $lines = 1) { - $ld = []; - if (is_resource($file) || ($file = fopen($file, "r"))) { - while ($lines--) { - $ld[] = fgets($file); - } - } - return $ld; -} - -function ns($path) { - $ns = ""; - $parts = explode("/", $path); - $upper = ctype_upper($path[0]); - for ($i = 0; $i < count($parts); ++$i) { - if (!strlen($parts[$i]) || $parts[$i] === ".") { - continue; - } - if (strlen($ns)) { - if ($upper && !ctype_upper($parts[$i][0])) { - $ns .= "::"; - } else { - $ns .= "\\"; - } - } - $ns .= $parts[$i]; - $upper = ctype_upper($parts[$i][0]); - } - return $ns; - return str_replace("/", "\\", str_replace("//", "/", trim($file, "/."))); -} - -function urlpath($dir, $file) { - return (strlen($dir) ? $dir . "/" : "") . basename($file, ".md"); -} - -function email($email) { - if (preg_match("/^([^<]+) <([^>]+)>/", $email, $matches)) { - list(, $name, $mail) = $matches; - return sprintf('%s', - htmlspecialchars($mail), - htmlspecialchars($name)); - } - var_dump(sscanf($email, "%s <%s>")); -} - -function ls($dir) { - $dir = rtrim(is_dir($dir) ? $dir : dirname($dir) ."/". basename($dir, ".md"), "/"); - printf("
    \n"); - printf("
  • Home
  • \n"); - if ($dir !== "." && ($dn = dirname($dir)) !== ".") { - printf("
  • %s
  • \n", - urlpath($dir, ".."), - ns($dn)); - } - if (is_dir($dir)) { - if ($dir !== ".") { - printf("
      \n
    •   %s
    • \n", ns($dir)); - } - if (($glob = glob("$dir/[_a-zA-Z]*.md"))) { - printf("
        \n"); - foreach ($glob as $file) { - printf("
      • %s
      • \n", - urlpath($dir, $file), - ns("$dir/".basename($file, ".md"))); - } - printf("
      \n"); - } - if ($dir !== ".") { - printf("
    \n"); - } - } - - printf("
\n"); -} - -function ml($file) { - $pi = pathinfo($file); - if (!isset($pi["extension"])) { - return; - } - if ($pi["extension"] !== "md") { - return; - } - $dir = $pi["dirname"] . "/" . $pi["filename"]; - if (($glob = glob("$dir/[_a-z]*.md"))) { - printf("

%s:

\n", !ctype_upper($pi["filename"][0]) ? - "Functions" : "Methods"); - printf("
    \n"); - foreach ($glob as $file) { - printf("
  • %s

    %s

    %s

  • \n", - urlpath($dir, $file), - basename($file, ".md"), - @end(head($file, 3)), - join(" ", cut(head($file), ["f"=>"1-"])) - ); - } - printf("
\n"); - } -} - -function md($file, $res) { - $file = rtrim($file, "/"); - if (is_file($file) || is_file($file .= ".md")) { - $pi = pathinfo($file); - - switch (@$pi["extension"]) { - case "md": - $r = fopen($file, "r"); - $md = MarkdownDocument::createFromStream($r); - $md->compile(MarkdownDocument::AUTOLINK|MarkdownDocument::TOC); - print $md->getHtml(); - fclose($r); - ml($file); - break; - case null: - printf("

%s

", basename($file)); - printf("
%s
\n", htmlspecialchars(file_get_contents($file))); - break; - } - } else { - $res->setResponseCode(404); - printf("

Not Found

\n"); - printf("

Sorry, I could not find %s/%s.

", dirname($file), basename($file, ".md")); - } -} - -chdir(__DIR__); -$t = ["css"=>"text/css", "js"=>"application/javascript"]; -$r = new http\Env\Request; -$u = new http\Url($r->getRequestUrl()); -$s = new http\Env\Response; -$b = dirname($_SERVER["SCRIPT_NAME"]); -$p = ".". substr($u->path, strlen($b)); - -switch($p) { -case "./index.php": - exit; -case "./index.js": -case "./index.css": - $s->setHeader("Content-type", $t[pathinfo($p, PATHINFO_EXTENSION)]); - $s->setBody(new http\Message\Body(fopen($p, "r"))); - $s->send(); - exit; -} - -ob_start($s); - -?> - - - - - <?=ns($p)?> - - - - - - - -

Quick Markdown Documentation Browser

-

mdref-v

-
- - - - -
- - - - - - - - -send();