Redirect docs

This commit is contained in:
Matthias Richter 2015-10-12 08:27:32 +02:00
parent 9cdc5f440b
commit a35781e2e5
18 changed files with 1 additions and 5391 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "doctool"]
path = doctool
url = https://github.com/vrld/doctool.git

View File

@ -1,2 +0,0 @@
index.html: README.md doctool-theme.lua
./doctool/doctool.lua README.md doctool-theme.lua > index.html

2713
README.md

File diff suppressed because it is too large Load Diff

@ -1 +0,0 @@
Subproject commit 72f4c13759edf79a6780096a3278bfedbb4ed3e7

View File

@ -1,257 +0,0 @@
local discount_ = function(s) return (require 'discount')(s, "nopants") end
local actions = {}
-- keep <script>...</script> blocks intact
local function discount(str)
local p,out = 0, {}
for plain, script in str:gmatch("(.-)(<script.-</script>)") do
out[#out+1], out[#out+2] = discount_(plain), script
p = p + #plain + #script
end
out[#out+1] = discount_(str:sub(p+1))
return table.concat(out)
end
local function filter(t, p)
local r = {}
for _,v in ipairs(t) do
if p(v) then r[#r+1] = v end
end
return r
end
local function anchorname(s)
return s:gsub('%s$', ''):gsub('%s','_')
end
-- generic
function actions.textblock(info)
return discount(info[1])
end
function actions.section(info)
local htype = 'h'..(info[3]+1)
if info[3] >= 3 then
return table.concat{
'<div class="section-block" id="{{MODULE}}', anchorname(info[1]), '">',
'<',htype,'>', info[1], '<a class="top" href="#{{MODULE}}">^top</a></',htype,'>',
discount(info[4]),
'</div>'
}
end
return table.concat{
'<div class="outer-block" id="{{MODULE}}', anchorname(info[1]), '">',
'<',htype,'>', info[1], '<a class="top" href="#top">^top</a></',htype,'>',
'<div class="preamble">', discount(info[4]), '</div>',
'</div>'
}
end
-- function
function actions.parameters(info)
return discount(info[1]):gsub('<dt>([^<]+)</dt>', function(m)
local type, what, optional = m:match("(%S+) ([^%(]+)( %b())")
if not type then
optional, type, what = '', m:match("(%S+) ([^%(]+)%s*")
end
assert(type and what and optional, "Invalid parameter description: " .. m)
return table.concat{'<dt>', type, ' <code>', what, '</code>', optional, '</dt>'}
end)
end
function actions.returns(info)
return discount(info[1])
end
function actions.example(info)
return discount(info[1])
end
function actions.sketch(info)
return discount(info[1])
end
actions['function'] = function(info)
local arg_delim = info.has_table_args and {'{','}'} or {'(',')'}
local out = {
'<div class="ref-block" id="{{MODULE}}', anchorname(info[1]), '">',
'<h4>',
'function <span class="name">', info[1], '</span>',
'<span class="arglist">', arg_delim[1], info[2], arg_delim[2], '</span>',
'<a class="top" href="#{{MODULE}}">^top</a></h4>',
discount(info[4])
}
-- parameter list
local parameters = filter(info[5], function(v) return v.type == 'parameters' end)
out[#out+1] = '<div class="arguments">'
out[#out+1] = 'Parameters:'
if #parameters == 0 then
out[#out+1] = '<dl><dt>None</dt></dl>'
else
for _, r in ipairs(parameters) do
out[#out+1] = actions.parameters(r)
end
end
out[#out+1] = '</div>'
-- returns list
local returns = filter(info[5], function(v) return v.type == 'returns' end)
out[#out+1] = '<div class="returns">'
out[#out+1] = 'Returns:'
if #returns == 0 then
out[#out+1] = '<dl><dt>Nothing</dt></dl>'
else
for _, r in ipairs(returns) do
out[#out+1] = actions.returns(r)
end
end
out[#out+1] = '</div>'
-- examples
local examples = filter(info[5], function(v) return v.type == 'example' end)
assert(#examples > 0, "No examples given for function " .. info[1] .. "()")
out[#out+1] = '<div class="example">'
out[#out+1] = #examples > 1 and 'Examples:' or 'Example:'
for _,s in ipairs(examples) do
out[#out+1] = actions.example(s)
end
out[#out+1] = '</div>'
-- sketch
local sketch = filter(info[5], function(v) return v.type == 'sketch' end)
if #sketch > 0 then
out[#out+1] = '<div class="example">'
out[#out+1] = #sketch > 1 and 'Sketches:' or 'Sketch:'
for _,s in ipairs(sketch) do
out[#out+1] = actions.sketch(s)
end
out[#out+1] = '</div>'
end
out[#out+1] = '</div>'
return table.concat(out)
end
-- module
function actions.module(info)
local modname = info[1]
local out = {
'<div class="outer-block" id="', anchorname(modname), '">',
'<h3>', modname, '<a class="top" href="#top">^top</a></h3>',
'<div class="preamble">', discount(info[3]), '</div>'
}
-- create module overview
out[#out+1] = '<div class="overview">'
out[#out+1] = '<h4>Module overview</h4>'
out[#out+1] = '<dl>'
for _,info in ipairs(info[4]) do
if info.type == 'function' then
out[#out+1] = table.concat{
'<dt>',
'<a href="#', anchorname(modname), anchorname(info[1]), '">',
info[1], '()',
'</a>',
'</dt><dd>',
info[3],
'</dd>',
}
elseif info.type == 'section' then
out[#out+1] = table.concat{
'<dt>',
'<a href="#', anchorname(modname), anchorname(info[1]), '">',
info[1],
'</a>',
'</dt><dd>',
info[2],
'</dd>',
}
else
error("Unhandled module subtype: " .. info.type)
end
end
out[#out+1] = '</dl>'
out[#out+1] = '</div>'
-- create detailed reference
for _,info in ipairs(info[4]) do
local s = actions[info.type](info)
out[#out+1] = s:gsub('{{MODULE}}', modname)
end
out[#out+1] = '</div>'
return table.concat(out)
end
-- title
function actions.title(info)
--return table.concat{'<h1>', info[1], '</h1>'}
return ""
end
-- build module overview
function actions.preprocess(doctree)
local out = {}
out[#out+1] = '<dl>'
for _, info in ipairs(filter(doctree, function(v) return v.type == 'module' end)) do
out[#out+1] = table.concat{
'<dt><a href="#', anchorname(info[1]), '">', info[1], '</a></dt>',
'<dd>', info[2], '</dd>',
}
end
out[#out+1] = '</dl>'
local mod_overview = {type = 'section', 'Modules', '', 2, table.concat(out)}
for i = 1,#doctree do
if doctree[i][1] == 'Introduction' then
table.insert(doctree, i+1, mod_overview)
break
end
end
return doctree
end
function actions.postprocess(out)
return table.concat{[[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>hump - L&Ouml;VE Helper Utilities for More Productivity</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="highlight.css" />
<script type="text/javascript" src="highlight.pack.js"></script>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script type="text/javascript">
window.onload = function() {
var examples = document.getElementsByTagName("code");
for (i = 0; i < examples.length; ++i) {
if (examples[i].className == "lua")
hljs.highlightBlock(examples[i], " ");
}
};
</script>
</head>
<body><a name="top"></a>
<div id="header">
<h1><a href="http://github.com/vrld/hump">hump</a>
<span class="small"> Helper Utilities for More Productivity</span></h1>
<ul id="main-nav">
<li><a href="#Introduction">Introduction</a></li>
<li><a href="#Modules">Modules</a></li>
<li><a href="#License">License</a></li>
<li><a href="#Download">Download</a></li>
</ul>
<h2>&nbsp;</h2>
</div>]],
out:gsub('{{MODULE}}', ''):gsub('<code>', '<code class="lua">'),
"</body></html>"
}
end
return actions

View File

@ -1,218 +0,0 @@
(function() {
"use strict";
// DISCLAIMER: I just started learning d3, so this is certainly not good
// idiomatic d3 code. But hey, it works (kinda).
var tweens = {
'out': function(f) { return function(s) { return 1-f(1-s) } },
'chain': function(f1, f2) { return function(s) { return ((s<.5) ? f1(2*s) : 1+f2(2*s-1)) * .5 } },
'linear': function(s) { return s },
'quad': function(s) { return s*s },
'cubic': function(s) { return s*s*s },
'quart': function(s) { return s*s*s*s },
'quint': function(s) { return s*s*s*s*s },
'sine': function(s) { return 1 - Math.cos(s*Math.PI/2) },
'expo': function(s) { return Math.pow(2, 10*(s-1)) },
'circ': function(s) { return 1 - Math.sqrt(Math.max(0,1-s*s)) },
'back': function(s) { var b = 1.70158; return s*s*((b+1)*s - b) },
'bounce': function(s) {
return Math.min(
7.5625 * Math.pow(s, 2),
7.5625 * Math.pow((s - .545455), 2) + .75,
7.5625 * Math.pow((s - .818182), 2) + .90375,
7.5625 * Math.pow((s - .954546), 2) + .984375)
},
'elastic': function(s) {
return -Math.sin(2/0.3 * Math.PI * (s-1) - Math.asin(1)) * Math.pow(2, 10*(s-1))
},
};
var tweenfunc = tweens.linear;
var width_graph = 400,
width_anim_move = 120,
width_anim_rotate = 120,
width_anim_size = 120,
height = 300;
// "UI"
var graph_ui = d3.select("#tween-graph").append("div")
.attr("id", "tween-graph-ui");
// rest see below
// the graph
var graph = d3.select("#tween-graph").append("svg")
.attr("width", width_graph).attr("height", height);
// background
graph.append("rect")
.attr("width", "100%").attr("height", "100%")
.attr("style", "fill:rgb(240,240,240);stroke-width:1;stroke:rgb(100,100,100);");
var y_zero = height * .78, y_one = height * .22;
graph.append("rect")
.attr("y", y_one)
.attr("width", "100%").attr("height", y_zero - y_one)
.attr("style", "fill:steelblue;fill-opacity:.3;stroke-width:1;stroke:rgba(100,100,100,.7)");
// time arrow
graph.append("defs")
.append("marker")
.attr("id", "triangle")
.attr("viewBox", "0 0 10 10")
.attr("refX", 1).attr("refY", 5)
.attr("markerWidth", 4)
.attr("markerHeight", 4)
.attr("orient", "auto")
.attr("style", "fill:rgba(0,0,0,.5)")
.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
graph.append("line")
.attr("x1", width_graph/2-80)
.attr("x2", width_graph/2+80)
.attr("y1", y_zero + 40).attr("y2", y_zero + 40)
.attr("style", "stroke-width:2;stroke:rgba(0,0,0,.5)")
.attr("marker-end", "url(#triangle)");
graph.append("text")
.text("Time")
.attr("x", width_graph/2).attr("y", y_zero + 55)
.attr("style", "text-anchor:middle;fill:rgba(0,0,0,.5);font-size:15px");
// the actual graph
var curve = d3.svg.line()
.x(function(x) { return x*width_graph; })
.y(function(x) { return tweenfunc(x) * (y_one - y_zero) + y_zero; })
var graph_curve = graph.append("path").attr("d", curve(d3.range(0,1.05,.005)))
.attr("style", "fill:none;stroke-width:2;stroke:seagreen;");
var graph_marker = graph.append("circle")
.attr("r", 5)
.attr("style", "stroke:goldenrod;fill:none;stroke-width:3");
// finally, a label
var graph_label = graph.append("text")
.text("linear")
.attr("x", width_graph/2).attr("y", 20)
.attr("style", "text-anchor:middle;font-weight:bold;font-size:15px;");
// animation examples - moving ball
var anim_move = d3.select("#tween-graph").append("svg")
.attr("width", width_anim_move).attr("height", height);
anim_move.append("rect")
.attr("width", "100%").attr("height", "100%")
.attr("style", "fill:rgb(240,240,240);stroke-width:1;stroke:rgb(100,100,100);");
anim_move.append("rect")
.attr("width", 10).attr("height", (y_zero - y_one))
.attr("x", width_anim_move/2-5).attr("y", y_one)
.attr("style", "fill:black;opacity:.1");
var anim_move_ball = anim_move.append("circle")
.attr("cx", width_anim_move/2).attr("cy", y_one)
.attr("r", 17)
.attr("style", "fill:steelblue;stroke:rgb(90,90,90);stroke-width:5;");
// animation examples - rotating square
var anim_rotate = d3.select("#tween-graph").append("svg")
.attr("width", width_anim_size).attr("height", height);
anim_rotate.append("rect")
.attr("width", "100%").attr("height", "100%")
.attr("style", "fill:rgb(240,240,240);stroke-width:1;stroke:rgb(100,100,100);");
var w = width_anim_size/2;
var anim_rotate_square = anim_rotate.append("rect")
.attr("x", -w/2).attr("y", -w/4)
.attr("width", w).attr("height", w/2)
.attr("style", "fill:steelblue;stroke:rgb(90,90,90);stroke-width:5;");
// animation examples - resizing ellipse
var anim_size = d3.select("#tween-graph").append("svg")
.attr("width", width_anim_size).attr("height", height);
anim_size.append("rect")
.attr("width", "100%").attr("height", "100%")
.attr("style", "fill:rgb(240,240,240);stroke-width:1;stroke:rgb(100,100,100);");
anim_size.append("ellipse")
.attr("cx", width_anim_size/2).attr("cy", height/2)
.attr("rx", 40).attr("ry", 120)
.attr("style", "fill:rgb(150,150,150);stroke:black;stroke-width:2;opacity:.1");
var anim_size_ellipse = anim_size.append("ellipse")
.attr("cx", width_anim_size/2).attr("cy", height/2)
.attr("rx", 40).attr("ry", 40)
.attr("style", "fill:steelblue;stroke:rgb(90,90,90);stroke-width:5;");
// make it move!
var t = 0;
window.setInterval(function() {
t = (t + .025 / 3);
if (t > 1.3) { t = -.3; }
var tt = Math.max(Math.min(t, 1), 0);
var s = tweenfunc(tt)
var yy = s * (y_one - y_zero) + y_zero;
var translate = "translate("+(width_anim_size/2)+" "+(height/2)+")";
var rotate = "rotate(" + (s * 360) + ")";
graph_marker.attr("cx", tt*width_graph).attr("cy", yy);
anim_move_ball.attr("cy", y_one + y_zero - yy);
anim_rotate_square.attr("transform", translate + " " + rotate);
anim_size_ellipse.attr("ry", s * 80 + 40);
}, 25);
// ui continued
graph_ui.append("strong").text("Function: ");
var select_modifier = graph_ui.append("select");
select_modifier.append("option").text("in");
select_modifier.append("option").text("out");
select_modifier.append("option").text("in-out");
select_modifier.append("option").text("out-in");
graph_ui.append("strong").text("-")
var select_func = graph_ui.append("select")
var funcs = [];
for (var k in tweens)
{
if (k != "out" && k != "chain")
{
select_func.append("option").text(k);
funcs.push(k);
}
}
var change_tweenfunc = function()
{
var fname = funcs[select_func.node().selectedIndex];
var mod = select_modifier.node().selectedIndex;
tweenfunc = tweens[fname];
if (mod == 1) // out
tweenfunc = tweens.out(tweenfunc);
else if (mod == 2) // in-out
tweenfunc = tweens.chain(tweenfunc, tweens.out(tweenfunc));
else if (mod == 3) // out-in
tweenfunc = tweens.chain(tweens.out(tweenfunc), tweenfunc);
// update curve
graph_curve.attr("d", curve(d3.range(0,1.05,.005)))
// update label
if (mod != 0)
graph_label.text((['in','out','in-out','out-in'])[mod] + "-" + fname);
else
graph_label.text(fname);
}
select_func.on("change", change_tweenfunc);
select_modifier.on("change", change_tweenfunc);
})();

View File

@ -1,129 +0,0 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
pre code {
display: block; padding: 0.5em;
color: #000;
background: #f8f8ff;
font-family: "Bitstream Vera Sans Mono","Andale Mono",monospace;
}
pre .comment,
pre .template_comment,
pre .diff .header,
pre .javadoc {
color: #998;
font-style: italic;
}
pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .lisp .title,
pre .subst {
color: #000;
font-weight: bold;
}
pre .number,
pre .hexcolor {
color: #40a070;
}
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula {
color: #d14;
}
pre .title,
pre .id {
color: #900;
font-weight: bold;
}
pre .javascript .title,
pre .lisp .title,
pre .subst {
font-weight: normal;
}
pre .class .title,
pre .tex .command {
color: #458;
font-weight: bold;
}
pre .tag,
pre .css .keyword,
pre .html .keyword,
pre .tag .title,
pre .django .tag .keyword {
color: #000080;
font-weight: normal;
}
pre .attribute,
pre .variable,
pre .instancevar,
pre .lisp .body {
color: #008080;
}
pre .regexp {
color: #009926;
}
pre .class {
color: #458;
font-weight: bold;
}
pre .symbol,
pre .ruby .symbol .string,
pre .ruby .symbol .keyword,
pre .ruby .symbol .keymethods,
pre .lisp .keyword,
pre .tex .special {
color: #990073;
}
pre .builtin,
pre .built_in,
pre .lisp .title {
color: #0086b3;
}
pre .preprocessor,
pre .pi,
pre .doctype,
pre .shebang,
pre .cdata {
color: #999;
font-weight: bold;
}
pre .deletion {
background: #fdd;
}
pre .addition {
background: #dfd;
}
pre .diff .change {
background: #0086b3;
}
pre .chunk {
color: #aaa;
}
pre .tex .formula {
opacity: 0.5;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

1852
index.html

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

216
style.css
View File

@ -1,216 +0,0 @@
body {
font-family: "Bitstream Vera sans", sans-serif;
font-size: 12pt;
color: #334;
background: #f7fcfc;
}
a { color: #203050; font-weight: bold;}
a:hover { color: #506080; text-decoration: none; font-weight: bold;}
a.top {
font-size: 8pt;
margin-left: 1em;
margin-right: 1em;
float: right;
}
h1 {
font-family: serif;
font-size: 3em;
color: #080303;
margin-top: 0;
margin-bottom: 10px;
border-bottom: 2px solid #080303;
}
h1 .small { font-size: 0.4em; }
h2 {
font-size: 2em;
color: #080303;
margin: 0;
}
#header {
width: 800px;
margin: 1em auto;
padding: .5em;
border: 1px solid #a0a0a0;
background: #efefef;
border-radius: 10px; -moz-border-radius: 10px;
}
#main-nav {
margin: 0;
float: right;
}
#main-nav li {
display:inline;
margin-right: 1em;
}
#nav {
width: 800px;
margin: 1em auto;
border: 1px solid #a0a0a0;
background: #efefef;
border-radius: 10px; -moz-border-radius: 10px;
}
#nav ul {
margin: 0;
}
#nav li {
display:inline;
}
#nav li a {
display: inline-block;
padding: 5px 10px;
border: solid #a0a0a0;
border-width: 0 1px;
background: #ffffff;
text-decoration:none;
}
#nav li a:hover {
background: #a0a0a0;
color: #101010;
}
.outer-block {
width: 800px;
margin: 1em auto;
padding: 0 0 0 1em;
}
.arglist {
color: #102040;
}
.arguments, .returns, .example {
font-weight: bold;
}
.example p {
font-weight: normal;
}
.example img {
border: 1px solid #a0a0a0;
margin-left: 2em;
}
h3, .preamble, .text-block, .overview, .ref-block, .tut-block, .section-block {
border: 1px solid #aaa;
border-radius: 5px; -moz-border-radius: 5px;
padding: .2em .5em;
background: #fff;
margin: 1em .2em;
}
h3 {
color: #050A10;
font-size: 1.5em;
font-weight: bold;
margin-left: -.5em;
}
.preamble {
margin-top: -1em;
}
.text-block, .section-block {
margin-bottom: 2em;
}
h4 {
color: #444;
font-size: 1em;
margin: 0;
font-weight: bold;
}
.overview h4 {
color: #405070;
font-size: 1.2em;
}
.ref-block h4 .name {
color: #721;
}
.ref-block h4 .arglist {
color: #151;
}
dl {
margin-left: 2em;
margin-top: .5em;
}
dt, dt a {
color: #666;
}
dt code {
font-size: 12pt;
color: #151;
}
dd {
font-weight: normal;
}
.overview dt {
display: inline-block;
float: left;
width: 32%;
font-weight: bold;
color: #666;
}
.overview dd {
display: block;
margin: .2em 0;
}
strong {
color: #D03000;
font-weight: bold;
}
code {
font-family: "Bitstream Vera Sans Mono", fixed;
font-weight: bold;
color: #333;
}
pre {
border: 1px solid #aaa;
border-radius: 5px; -moz-border-radius: 5px;
background: #f8f8ff;
padding: .2em;
margin: 1em 2em;
font-weight: normal;
max-height: 450px; overflow: auto;
}
pre code {
font-size: 11pt;
color: black;
border: 0;
font-weight: normal;
}
pre code .function {
background: #f8f8ff;
border: 0;
padding: 0;
margin: 0;
}
#tween-graph {
text-align: center;
}
#tween-graph-ui {
margin-right: 7px;
text-align: right;
margin-bottom: 2px;
}
#tween-graph-ui strong {
color: black;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB