...
 
Commits (3)
......@@ -81,7 +81,8 @@
</ul>
<h2 id="march-2017">March 2017</h2>
<ul>
<li>add ?touch query option + functionality in main code (remove cgi)</li>
<li><p>add ?touch query option + functionality in main code (remove cgi)</p></li>
<li><p>12 April 2017: Observation: auto &quot;edit&quot; linking functionality would be nice -- but from the index page (ie automagically adding the ?edit, which can then be manually removed) (ie original decision to do this auto editing INSIDE the server was too rigid)</p></li>
</ul>
</body>
</html>
mdsrc=$(shell ls *.md)
# map *.mp => *.html for mdsrc
html_from_md=$(mdsrc:%.md=%.html)
html: $(html_from_md)
test:
echo hello world
now:
touch `date +"%Y-%m-%d-%H%M%S"`.md
%.html: %.md
pandoc --from markdown \
--to html \
--standalone \
$< -o $@
### INDEX FULES ###############
.SECONDEXPANSION:
# holy cow: this is working! (but indexalist is returning the wrong paths (with diversions at start)... need to fix this)
......
......@@ -184,6 +184,7 @@ function editor (elt, ace) {
wrap.checked = cur_wrap;
aceeditor.setOption("wrap", cur_wrap);
wrap.addEventListener("change", function () {
cur_wrap = this.checked;
aceeditor.setOption("wrap", this.checked);
localStorage.setItem("makeserver_editor_wrap", this.checked ? "true" : "");
});
......@@ -289,7 +290,7 @@ function editor (elt, ace) {
console.log("post ERROR", err);
} else {
console.log("post", resp);
status.innerHTML = "saved " + new Date();
status.innerHTML = "Saved " + new Date();
}
})
}
......@@ -387,7 +388,7 @@ function editor (elt, ace) {
aceeditor.setSession(session.acesession);
// editor.setOption("showLineNumbers", false);
aceeditor.setHighlightActiveLine(false);
session.acesession.setUseWrapMode(true);
session.acesession.setUseWrapMode(cur_wrap);
sessionsByHref[href.nofrag] = session;
if (done) {
window.setTimeout(function () {
......
......@@ -41,14 +41,14 @@
z-index: 1001;
background: #FFFFFF;
color: black;
font-family: Hack Bold, monospace;
font-family: Hack, monospace;
font-size: 12px;
border-top: 2px solid black;
overflow: auto;
display: none;
}
#controls button, #controls select {
font-family: Hack Bold, monospace;
font-family: Hack, monospace;
font-size: 12px;
}
#controltrigger {
......
......@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<title></title>
<title>video</title>
<style>
body {
margin: 0;
......
......@@ -6,6 +6,11 @@
<script src="/__makeserver__/draggable/draggable.js"></script>
<link rel="stylesheet" type="text/css" href="/__makeserver__/draggable/draggable.css">
<script src="/__makeserver__/index.js"></script>
<style>
form.target {
display: inline;
}
</style>
</head>
<body>
<h1>Index of {{ request_label }}</h1>
......@@ -23,8 +28,12 @@
{% endif %}
{% endfor %}
</table>
<div style="margin-top: 1em">
<button id="touch">touch</button>
<div id="buttons" style="margin-top: 1em">
<button id="touch">touch</button>
<span id="targetbuttons">
{% for t in targets %}
<form class="target" action="{{t}}"><input type="submit" value="{{t }}"></form>{% endfor %}
</span>
</div>
<script>
function getjson (url, callback) {
......
......@@ -76,11 +76,20 @@ def maker (path, queue):
cmd.append(rpath)
print ("Make {0} using {1} in {2}".format(rpath, req['makefile'], req['cwd']))
output = subprocess.check_output(cmd, cwd=req['cwd'], stderr=subprocess.STDOUT)
rurl = "/"+os.path.relpath(req['path'], path)+"?lastbuild={0}".format(datetime.datetime.now().isoformat())
print ("Make successful. Redirecting to {0}".format(rurl))
redirect_body = redirectTo(rurl, req['request'])
req['request'].write(redirect_body)
req['request'].finish()
# Check if output now exists, if so redirect to it
# If not (phony target?) Just show the output
if os.path.exists(os.path.join(req['cwd'], req['path'])):
rurl = "/"+os.path.relpath(req['path'], path)+"?lastbuild={0}".format(datetime.datetime.now().isoformat())
print ("Make successful. Redirecting to {0}".format(rurl))
redirect_body = redirectTo(rurl, req['request'])
req['request'].write(redirect_body)
req['request'].finish()
else:
print ("Make successful but no target file produced (phony?). Returning output.")
req['request'].write("<h1>{0} completed</h1>\n\n<pre class=\"error\">{1}</pre>".format(rpath, output))
req['request'].finish()
except subprocess.CalledProcessError as e:
# if make returns a non-zero value, CalledProcessError is triggered (as per subprocess.check_output)
req['request'].setResponseCode(404)
......
......@@ -85,6 +85,11 @@ def is_text_file (p):
except IOError:
return None
def targets (makefile):
with open(makefile) as f:
text = f.read().decode("utf-8")
return re.findall(r"^(\w+):", text, flags=re.M)
def make_n (path, makefile=None):
output = ""
if makefile:
......@@ -199,6 +204,10 @@ class MakeDirectoryListing (object):
})
tvars['items'] = items
tvars['targets'] = targets(self.makefile)
return self.template.render(tvars).encode("utf-8")
class MakeDirectoryListingFactory (object):
......