mvp complete
This commit is contained in:
parent
488223df17
commit
669a78990f
Binary file not shown.
18
Rakefile
Normal file
18
Rakefile
Normal file
@ -0,0 +1,18 @@
|
||||
require 'uglifier'
|
||||
|
||||
task default: %w[build]
|
||||
|
||||
task :build do
|
||||
# puts system("browserify -t coffeeify browser.app.coffee > js/markdowntomla.js")
|
||||
html = File.read('index.html')
|
||||
bundled = html.split("\n").map{|line|
|
||||
if line =~ /\<script.*src=\"(.*)\"/
|
||||
path = $1
|
||||
js = Uglifier.compile(File.read(path))
|
||||
"<script type='text/javascript'>#{js}</script>"
|
||||
else
|
||||
line
|
||||
end
|
||||
}
|
||||
File.open('index.min.html', 'w'){|f| f.puts bundled}
|
||||
end
|
Binary file not shown.
@ -1,7 +1,5 @@
|
||||
# browserify -t coffeeify browser.app.coffee > js/markdowntomla.js
|
||||
|
||||
console.log "hi"
|
||||
|
||||
window.markdowntomla = require('./markdowntomla.coffee')
|
||||
window.md = require('markdown').markdown
|
||||
window._ = require('underscore')
|
||||
@ -40,7 +38,8 @@ window.refresh = ->
|
||||
|
||||
# or get a blob URL for display in the browser
|
||||
url = stream.toBlobURL('application/pdf')
|
||||
console.log url
|
||||
document.getElementById('preview').src = url
|
||||
|
||||
document.title = "#{metadata.title} - MarkdownToMLA.com"
|
||||
|
||||
refresh()
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<title>MarkdowntoMLA.com</title>
|
||||
<style type="text/css">
|
||||
*{
|
||||
margin: 0;
|
||||
|
181
index.min.html
Normal file
181
index.min.html
Normal file
File diff suppressed because one or more lines are too long
@ -1,8 +1,6 @@
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var essay, refreshTimer;
|
||||
|
||||
console.log("hi");
|
||||
|
||||
window.markdowntomla = require('./markdowntomla.coffee');
|
||||
|
||||
window.md = require('markdown').markdown;
|
||||
@ -50,8 +48,8 @@ window.refresh = function() {
|
||||
return stream.on('finish', function() {
|
||||
var url;
|
||||
url = stream.toBlobURL('application/pdf');
|
||||
console.log(url);
|
||||
return document.getElementById('preview').src = url;
|
||||
document.getElementById('preview').src = url;
|
||||
return document.title = metadata.title + " - MarkdownToMLA.com";
|
||||
});
|
||||
};
|
||||
|
||||
@ -206,7 +204,6 @@ Node = (function() {
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
console.log("content =", this.content);
|
||||
}
|
||||
|
||||
Node.prototype.setStyle = function(doc) {
|
||||
@ -245,7 +242,6 @@ Node = (function() {
|
||||
continued: continued || index < this.content.length - 1
|
||||
}));
|
||||
} else {
|
||||
console.log("rendering fragment " + fragment.type);
|
||||
fragment.render(doc, index < this.content.length - 1 && this.type !== 'bulletlist');
|
||||
}
|
||||
lastType = this.type;
|
||||
@ -287,7 +283,6 @@ render = function(doc, tree) {
|
||||
onWorksCited = false;
|
||||
while (tree.length) {
|
||||
node = new Node(tree.shift());
|
||||
console.log("node =", node);
|
||||
if (node.type === "h1" && ((ref = node.content) != null ? (ref1 = ref.first()) != null ? (ref2 = ref1.text) != null ? ref2.toLowerCase() : void 0 : void 0 : void 0) === "works cited") {
|
||||
onWorksCited = true;
|
||||
node.style = _.extend({}, styles["default"], styles.citationHeader);
|
||||
|
@ -132,7 +132,7 @@ class Node
|
||||
child.style?.indent = @style.indent if @style.indent?
|
||||
child
|
||||
|
||||
console.log "content =", @content
|
||||
# console.log "content =", @content
|
||||
# console.log "type =", @type
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ class Node
|
||||
# console.log "rendering text. continued =", continued, 'attrs.continued =', @attrs.continued
|
||||
doc.text fragment.text, _.extend({}, @style, {continued: continued or index < @content.length - 1})
|
||||
else
|
||||
console.log "rendering fragment #{fragment.type}"
|
||||
# console.log "rendering fragment #{fragment.type}"
|
||||
fragment.render doc, index < @content.length - 1 and @type isnt 'bulletlist'
|
||||
|
||||
lastType = @type
|
||||
@ -202,7 +202,7 @@ render = (doc, tree) ->
|
||||
onWorksCited = false
|
||||
while tree.length
|
||||
node = new Node(tree.shift())
|
||||
console.log "node =", node
|
||||
# console.log "node =", node
|
||||
if node.type == "h1" && node.content?.first()?.text?.toLowerCase() == "works cited"
|
||||
onWorksCited = true
|
||||
node.style = _.extend({}, styles.default, styles.citationHeader)
|
||||
|
Loading…
Reference in New Issue
Block a user