marked-rails 0.2.8.0 → 0.2.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,8 +5,6 @@
5
5
  Marked is also available through Node Package Manager, but if you're working in Rails it's nice
6
6
  to have in gem form for simple integration into your rails apps.
7
7
 
8
- We are currently tracking marked version 0.2.7
9
-
10
8
  ## Installation
11
9
 
12
10
  Add this line to your application's Gemfile:
@@ -31,6 +29,12 @@ Or install it yourself as:
31
29
 
32
30
  _Coming ...Eventually_
33
31
 
32
+ ## Versioning Conventions
33
+
34
+ The least significant digits are gem-specific. Everything before those digits are marked versions.
35
+ For example: marked-rails 0.2.8.0 tracks marked 0.2.8 - if we make a mistake in the gem, withoug
36
+ having to touch the library - we'd release 0.2.8.1
37
+
34
38
  ## Contributing
35
39
 
36
40
  Feel free to open an issue ticket if you find something that could be improved. A couple notes:
@@ -1,5 +1,5 @@
1
1
  module Marked
2
2
  module Rails
3
- VERSION = "0.2.8.0"
3
+ VERSION = "0.2.9.0"
4
4
  end
5
5
  end
@@ -676,7 +676,7 @@ InlineLexer.prototype.output = function(src) {
676
676
  // text
677
677
  if (cap = this.rules.text.exec(src)) {
678
678
  src = src.substring(cap[0].length);
679
- out += escape(cap[0]);
679
+ out += escape(this.smartypants(cap[0]));
680
680
  continue;
681
681
  }
682
682
 
@@ -728,10 +728,10 @@ InlineLexer.prototype.outputLink = function(cap, link) {
728
728
  InlineLexer.prototype.smartypants = function(text) {
729
729
  if (!this.options.smartypants) return text;
730
730
  return text
731
- .replace(/--/g, '')
732
- .replace(/'([^']*)'/g, '‘$1')
733
- .replace(/"([^"]*)"/g, '“$1')
734
- .replace(/\.{3}/g, '');
731
+ .replace(/--/g, '\u2014')
732
+ .replace(/'([^']*)'/g, '\u2018$1\u2019')
733
+ .replace(/"([^"]*)"/g, '\u201C$1\u201D')
734
+ .replace(/\.{3}/g, '\u2026');
735
735
  };
736
736
 
737
737
  /**
@@ -1029,27 +1029,50 @@ function marked(src, opt, callback) {
1029
1029
 
1030
1030
  if (opt) opt = merge({}, marked.defaults, opt);
1031
1031
 
1032
- var tokens = Lexer.lex(tokens, opt)
1033
- , highlight = opt.highlight
1034
- , pending = 0
1035
- , l = tokens.length
1032
+ var highlight = opt.highlight
1033
+ , tokens
1034
+ , pending
1036
1035
  , i = 0;
1037
1036
 
1038
- if (!highlight || highlight.length < 3) {
1039
- return callback(null, Parser.parse(tokens, opt));
1037
+ try {
1038
+ tokens = Lexer.lex(src, opt)
1039
+ } catch (e) {
1040
+ return callback(e);
1040
1041
  }
1041
1042
 
1042
- var done = function() {
1043
- delete opt.highlight;
1044
- var out = Parser.parse(tokens, opt);
1043
+ pending = tokens.length;
1044
+
1045
+ var done = function(hi) {
1046
+ var out, err;
1047
+
1048
+ if (hi !== true) {
1049
+ delete opt.highlight;
1050
+ }
1051
+
1052
+ try {
1053
+ out = Parser.parse(tokens, opt);
1054
+ } catch (e) {
1055
+ err = e;
1056
+ }
1057
+
1045
1058
  opt.highlight = highlight;
1046
- return callback(null, out);
1059
+
1060
+ return err
1061
+ ? callback(err)
1062
+ : callback(null, out);
1047
1063
  };
1048
1064
 
1049
- for (; i < l; i++) {
1065
+ if (!highlight || highlight.length < 3) {
1066
+ return done(true);
1067
+ }
1068
+
1069
+ if (!pending) return done();
1070
+
1071
+ for (; i < tokens.length; i++) {
1050
1072
  (function(token) {
1051
- if (token.type !== 'code') return;
1052
- pending++;
1073
+ if (token.type !== 'code') {
1074
+ return --pending || done();
1075
+ }
1053
1076
  return highlight(token.text, token.lang, function(err, code) {
1054
1077
  if (code == null || code === token.text) {
1055
1078
  return --pending || done();
@@ -1096,7 +1119,8 @@ marked.defaults = {
1096
1119
  smartLists: false,
1097
1120
  silent: false,
1098
1121
  highlight: null,
1099
- langPrefix: 'lang-'
1122
+ langPrefix: 'lang-',
1123
+ smartypants: false
1100
1124
  };
1101
1125
 
1102
1126
  /**
@@ -1124,4 +1148,4 @@ if (typeof exports === 'object') {
1124
1148
 
1125
1149
  }).call(function() {
1126
1150
  return this || (typeof window !== 'undefined' ? window : global);
1127
- }());
1151
+ }());
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8.0
4
+ version: 0.2.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-26 00:00:00.000000000 Z
13
+ date: 2013-07-16 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: ! 'A gemified verison of the chjj/marked: "A full-featured markdown parser
16
16
  and compiler, written in javascript."'