Skip to content

Commit

Permalink
finished #65, switched to marked from discount
Browse files Browse the repository at this point in the history
close #65
  • Loading branch information
TangentFoxy committed Sep 6, 2016
1 parent 803b4c3 commit 79e6435
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
18 changes: 16 additions & 2 deletions blog.moon
Expand Up @@ -24,7 +24,14 @@ class extends lapis.Application
script src: @build_url "static/js/marked.min.js"
link rel: "stylesheet", href: @build_url "static/highlight/styles/solarized-dark.css"
script src: @build_url "static/highlight/highlight.pack.js"
script -> raw "marked.setOptions({ highlight: function(code) { return hljs.highlightAuto(code).value; } }); hljs.initHighlightingOnLoad();"
script -> raw "
marked.setOptions({
highlight: function(code) { return hljs.highlightAuto(code).value; },
sanitize: true,
smartypants: true
});
hljs.initHighlightingOnLoad();
"
if page > 1
a class: "pure-button", href: @url_for("blog_index", page: 1), "Most Recent"
a class: "pure-button", href: @url_for("blog_index", page: page - 1), "Newer"
Expand Down Expand Up @@ -70,7 +77,14 @@ class extends lapis.Application
script src: @build_url "static/js/marked.min.js"
link rel: "stylesheet", href: @build_url "static/highlight/styles/solarized-dark.css"
script src: @build_url "static/highlight/highlight.pack.js"
script -> raw "marked.setOptions({ highlight: function(code) { return hljs.highlightAuto(code).value; } }); hljs.initHighlightingOnLoad();"
script -> raw "
marked.setOptions({
highlight: function(code) { return hljs.highlightAuto(code).value; },
sanitize: true,
smartypants: true
});
hljs.initHighlightingOnLoad();
"
--TODO some sort of back button that returns to the correct page in blog_index
h2 title: post.pubdate, time_ago_in_words post.pubdate
div id: "post_text"
Expand Down
1 change: 0 additions & 1 deletion install.sh
Expand Up @@ -27,7 +27,6 @@ sudo make install
sudo luarocks install lapis
sudo luarocks install moonscript
sudo luarocks install bcrypt
sudo luarocks install lua-discount
# cleanup
cd ..
rm -rf openresty*
Expand Down
6 changes: 4 additions & 2 deletions ksp.moon
@@ -1,5 +1,4 @@
lapis = require "lapis"
discount = require "discount"

import respond_to from require "lapis.application"

Expand Down Expand Up @@ -163,11 +162,14 @@ class extends lapis.Application
@title = "#{craft.craft_name}"

@html ->
script src: @build_url "static/js/marked.min.js"
script -> raw "marked.setOptions({ sanitize: true, smartypants: true });"
p ->
a class: "pure-button", href: @url_for("ksp_craft_list"), "Craft List"
a class: "pure-button", href: @url_for("ksp_submit_crafts"), "Submit Craft"

raw discount craft.description, "nohtml" -- THIS IS SCARY! D:
div id: "craft_description"
script -> raw "document.getElementById('craft_description').innerHTML = marked('#{craft.description\gsub("'", "\\'")\gsub("\n", "\\n")\gsub("\r", "")}');"
img src: craft.picture
if Crafts.statuses.reviewed == craft.status
div class: "yt-embed", -> iframe src: "https://www.youtube.com/embed/#{craft.episode}", frameborder: 0, allowfullscreen: true
Expand Down

0 comments on commit 79e6435

Please sign in to comment.