From 7b2c8e7f35233b54ed36fb927179676aae2cbb64 Mon Sep 17 00:00:00 2001 From: Vit Brunner Date: Sat, 22 Jun 2013 10:15:04 +0100 Subject: [PATCH] Smartypants support, temporary branch switch --- source/documents/_scripts.html.jade | 2 +- .../scripts/services/reader/markdown.js.coffee | 3 +++ .../documents/tests/services/reader/markdown.js.coffee | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/source/documents/_scripts.html.jade b/source/documents/_scripts.html.jade index a40f171..0933957 100644 --- a/source/documents/_scripts.html.jade +++ b/source/documents/_scripts.html.jade @@ -2,7 +2,7 @@ script(src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.js") script(src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js") // TODO use cdnjs.com once they serve marked -script(src="//raw.github.com/chjj/marked/master/lib/marked.js") +script(src="//raw.github.com/tasuk/marked/improve-smartypants/lib/marked.js") script(src="scripts/app.js") script(src="scripts/services/fetch.js") script(src="scripts/services/reader/_factory.js") diff --git a/source/documents/scripts/services/reader/markdown.js.coffee b/source/documents/scripts/services/reader/markdown.js.coffee index f0b4de5..d51b68b 100644 --- a/source/documents/scripts/services/reader/markdown.js.coffee +++ b/source/documents/scripts/services/reader/markdown.js.coffee @@ -52,6 +52,9 @@ angular.module("sideBySide").factory("markdownReader", () -> }) return content + marked.setOptions({ + smartypants: true + }) lexed = marked.lexer(source) meta = lexed.shift() meta = readMeta(meta.text, new marked.InlineLexer(lexed.links)) diff --git a/source/documents/tests/services/reader/markdown.js.coffee b/source/documents/tests/services/reader/markdown.js.coffee index 657ec26..d3d35ad 100644 --- a/source/documents/tests/services/reader/markdown.js.coffee +++ b/source/documents/tests/services/reader/markdown.js.coffee @@ -35,12 +35,12 @@ test("markdownReader", () -> Source: 'http://en.wikisource.org/wiki/Universal_Declaration_of_Human_Rights' } content: [ - { section: "1", text: "

All human beings are born free and equal in dignity and rights...

\n" } + { section: "1", text: "

All human beings are born free and equal in dignity and rights…

\n" } { section: "2", text: """ -

Everyone is entitled to all the rights and freedoms...

-

Furthermore, no distinction shall be made on the basis of...

\n""" } - { section: "11.1", text: "

Everyone charged with a penal offence has the right to be presumed...

\n" } - { section: "11.2", text: "

No one shall be held guilty of any penal offence...

\n" } +

Everyone is entitled to all the rights and freedoms…

+

Furthermore, no distinction shall be made on the basis of…

\n""" } + { section: "11.1", text: "

Everyone charged with a penal offence has the right to be presumed…

\n" } + { section: "11.2", text: "

No one shall be held guilty of any penal offence…

\n" } { section: "13", text: """

Everyone is entitled to: