Last active
August 29, 2015 14:09
-
-
Save Marak/78fbb714721b1d14c4df to your computer and use it in GitHub Desktop.
hook.io hook for testing substack's fraktur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module['exports'] = function (hook) { | |
var fraktur = require('fraktur'); | |
// assumes text has been posted as form data or is part of query string | |
// you could just as easily parse hook.req for incoming data instead | |
hook.res.end(fraktur(hook.params.text)); | |
}; | |
module['exports'].schema = { | |
"text": { | |
"type": "string", | |
"default": "Why, Hello there kind sir!" | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>fraktur example</title> | |
<meta charset='utf-8'> | |
<style> | |
.output { font-size: 48px; } | |
input { font-size: 22px; width: 400px; } | |
submit { font-size: 22px; } | |
</style> | |
</head> | |
<body> | |
<div class="output"></div> | |
<br/> | |
<form method="POST" action=""> | |
<input type="input" name="text" value="Why, Hello there kind sir!"/> | |
<input type="submit" name="run" value="Test Hook"/> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module['exports'] = function (opts, cb) { | |
var $ = this.$; | |
// $ now contains the view.html fragment | |
$('.output').html(opts.output); | |
return cb(null, $.html()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment