marked-rails 0.2.9.0 → 0.2.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8d2471985670bca2c17ed2632cddcd9794e43b48
4
+ data.tar.gz: 318ebc6d89847852c17f9c8c3fa5f45a813ffb3e
5
+ SHA512:
6
+ metadata.gz: 19979f3886f448b47aa5235165b63f5fd463c9eb9ee37df0eb6eb0fb9a3686803c68d45ca4abeca59395cc206b62176dbebc0e86b87d83572cdf5326b9a2ab13
7
+ data.tar.gz: b0bb207fd15400780620d0e0d096e597dc5558f916c680c611817694dbde1704edc16c42e99cfa2e85c09e38994624ea5afa6d502b91a7f67fec1087e5e87dcd
data/README.md CHANGED
@@ -32,15 +32,14 @@ _Coming ...Eventually_
32
32
  ## Versioning Conventions
33
33
 
34
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
35
+ For example: marked-rails 0.2.8.0 tracks marked 0.2.8 - if we make a mistake in the gem, without
36
+ having to touch the library - we'd release 0.2.8.1.
37
37
 
38
38
  ## Contributing
39
39
 
40
- Feel free to open an issue ticket if you find something that could be improved. A couple notes:
40
+ Feel free to open an issue if you find something that could be improved. A couple notes:
41
41
 
42
42
  * If it's an issue pertaining to the marked javascript, please report it to the [marked project](https://github.com/chjj/marked).
43
-
44
43
  * If the marked scripts are outdated (i.e. maybe a new version of marked was released yesterday), feel free to open an issue and prod us to get that thing updated.
45
44
 
46
45
  ## Acknowledgements
@@ -1,5 +1,5 @@
1
1
  module Marked
2
2
  module Rails
3
- VERSION = "0.2.9.0"
3
+ VERSION = "0.2.10.0"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ var block = {
17
17
  hr: /^( *[-*_]){3,} *(?:\n+|$)/,
18
18
  heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
19
19
  nptable: noop,
20
- lheading: /^([^\n]+)\n *(=|-){3,} *\n*/,
20
+ lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
21
21
  blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/,
22
22
  list: /^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
23
23
  html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,
@@ -75,7 +75,9 @@ block.gfm = merge({}, block.normal, {
75
75
  });
76
76
 
77
77
  block.gfm.paragraph = replace(block.paragraph)
78
- ('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|')
78
+ ('(?!', '(?!'
79
+ + block.gfm.fences.source.replace('\\1', '\\2') + '|'
80
+ + block.list.source.replace('\\1', '\\3') + '|')
79
81
  ();
80
82
 
81
83
  /**
@@ -308,7 +310,7 @@ Lexer.prototype.token = function(src, top) {
308
310
  // Determine whether the next list item belongs here.
309
311
  // Backpedal if it does not belong in this list.
310
312
  if (this.options.smartLists && i !== l - 1) {
311
- b = block.bullet.exec(cap[i+1])[0];
313
+ b = block.bullet.exec(cap[i + 1])[0];
312
314
  if (bull !== b && !(bull.length > 1 && b.length > 1)) {
313
315
  src = cap.slice(i + 1).join('\n') + src;
314
316
  i = l - 1;
@@ -320,7 +322,7 @@ Lexer.prototype.token = function(src, top) {
320
322
  // for discount behavior.
321
323
  loose = next || /\n\n(?!\s*$)/.test(item);
322
324
  if (i !== l - 1) {
323
- next = item[item.length-1] === '\n';
325
+ next = item.charAt(item.length - 1) === '\n';
324
326
  if (!loose) loose = next;
325
327
  }
326
328
 
@@ -352,7 +354,7 @@ Lexer.prototype.token = function(src, top) {
352
354
  type: this.options.sanitize
353
355
  ? 'paragraph'
354
356
  : 'html',
355
- pre: cap[1] === 'pre' || cap[1] === 'script',
357
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
356
358
  text: cap[0]
357
359
  });
358
360
  continue;
@@ -407,7 +409,7 @@ Lexer.prototype.token = function(src, top) {
407
409
  src = src.substring(cap[0].length);
408
410
  this.tokens.push({
409
411
  type: 'paragraph',
410
- text: cap[1][cap[1].length-1] === '\n'
412
+ text: cap[1].charAt(cap[1].length - 1) === '\n'
411
413
  ? cap[1].slice(0, -1)
412
414
  : cap[1]
413
415
  });
@@ -454,8 +456,8 @@ var inline = {
454
456
  text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
455
457
  };
456
458
 
457
- inline._inside = /(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/;
458
- inline._href = /\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
459
+ inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
460
+ inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
459
461
 
460
462
  inline.link = replace(inline.link)
461
463
  ('inside', inline._inside)
@@ -567,7 +569,7 @@ InlineLexer.prototype.output = function(src) {
567
569
  if (cap = this.rules.autolink.exec(src)) {
568
570
  src = src.substring(cap[0].length);
569
571
  if (cap[2] === '@') {
570
- text = cap[1][6] === ':'
572
+ text = cap[1].charAt(6) === ':'
571
573
  ? this.mangle(cap[1].substring(7))
572
574
  : this.mangle(cap[1]);
573
575
  href = this.mangle('mailto:') + text;
@@ -622,7 +624,7 @@ InlineLexer.prototype.output = function(src) {
622
624
  link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
623
625
  link = this.links[link.toLowerCase()];
624
626
  if (!link || !link.href) {
625
- out += cap[0][0];
627
+ out += cap[0].charAt(0);
626
628
  src = cap[0].substring(1) + src;
627
629
  continue;
628
630
  }
@@ -694,7 +696,7 @@ InlineLexer.prototype.output = function(src) {
694
696
  */
695
697
 
696
698
  InlineLexer.prototype.outputLink = function(cap, link) {
697
- if (cap[0][0] !== '!') {
699
+ if (cap[0].charAt(0) !== '!') {
698
700
  return '<a href="'
699
701
  + escape(link.href)
700
702
  + '"'
@@ -728,9 +730,17 @@ InlineLexer.prototype.outputLink = function(cap, link) {
728
730
  InlineLexer.prototype.smartypants = function(text) {
729
731
  if (!this.options.smartypants) return text;
730
732
  return text
733
+ // em-dashes
731
734
  .replace(/--/g, '\u2014')
732
- .replace(/'([^']*)'/g, '\u2018$1\u2019')
733
- .replace(/"([^"]*)"/g, '\u201C$1\u201D')
735
+ // opening singles
736
+ .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
737
+ // closing singles & apostrophes
738
+ .replace(/'/g, '\u2019')
739
+ // opening doubles
740
+ .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
741
+ // closing doubles
742
+ .replace(/"/g, '\u201d')
743
+ // ellipses
734
744
  .replace(/\.{3}/g, '\u2026');
735
745
  };
736
746
 
@@ -803,7 +813,7 @@ Parser.prototype.next = function() {
803
813
  */
804
814
 
805
815
  Parser.prototype.peek = function() {
806
- return this.tokens[this.tokens.length-1] || 0;
816
+ return this.tokens[this.tokens.length - 1] || 0;
807
817
  };
808
818
 
809
819
  /**
@@ -835,7 +845,9 @@ Parser.prototype.tok = function() {
835
845
  case 'heading': {
836
846
  return '<h'
837
847
  + this.token.depth
838
- + '>'
848
+ + ' id="'
849
+ + this.token.text.toLowerCase().replace(/[^\w]+/g, '-')
850
+ + '">'
839
851
  + this.inline.output(this.token.text)
840
852
  + '</h'
841
853
  + this.token.depth
@@ -877,9 +889,11 @@ Parser.prototype.tok = function() {
877
889
  body += '<thead>\n<tr>\n';
878
890
  for (i = 0; i < this.token.header.length; i++) {
879
891
  heading = this.inline.output(this.token.header[i]);
880
- body += this.token.align[i]
881
- ? '<th align="' + this.token.align[i] + '">' + heading + '</th>\n'
882
- : '<th>' + heading + '</th>\n';
892
+ body += '<th';
893
+ if (this.token.align[i]) {
894
+ body += ' style="text-align:' + this.token.align[i] + '"';
895
+ }
896
+ body += '>' + heading + '</th>\n';
883
897
  }
884
898
  body += '</tr>\n</thead>\n';
885
899
 
@@ -890,9 +904,11 @@ Parser.prototype.tok = function() {
890
904
  body += '<tr>\n';
891
905
  for (j = 0; j < row.length; j++) {
892
906
  cell = this.inline.output(row[j]);
893
- body += this.token.align[j]
894
- ? '<td align="' + this.token.align[j] + '">' + cell + '</td>\n'
895
- : '<td>' + cell + '</td>\n';
907
+ body += '<td';
908
+ if (this.token.align[j]) {
909
+ body += ' style="text-align:' + this.token.align[j] + '"';
910
+ }
911
+ body += '>' + cell + '</td>\n';
896
912
  }
897
913
  body += '</tr>\n';
898
914
  }
@@ -1027,7 +1043,7 @@ function marked(src, opt, callback) {
1027
1043
  opt = null;
1028
1044
  }
1029
1045
 
1030
- if (opt) opt = merge({}, marked.defaults, opt);
1046
+ opt = merge({}, marked.defaults, opt || {});
1031
1047
 
1032
1048
  var highlight = opt.highlight
1033
1049
  , tokens
@@ -1042,13 +1058,9 @@ function marked(src, opt, callback) {
1042
1058
 
1043
1059
  pending = tokens.length;
1044
1060
 
1045
- var done = function(hi) {
1061
+ var done = function() {
1046
1062
  var out, err;
1047
1063
 
1048
- if (hi !== true) {
1049
- delete opt.highlight;
1050
- }
1051
-
1052
1064
  try {
1053
1065
  out = Parser.parse(tokens, opt);
1054
1066
  } catch (e) {
@@ -1063,9 +1075,11 @@ function marked(src, opt, callback) {
1063
1075
  };
1064
1076
 
1065
1077
  if (!highlight || highlight.length < 3) {
1066
- return done(true);
1078
+ return done();
1067
1079
  }
1068
1080
 
1081
+ delete opt.highlight;
1082
+
1069
1083
  if (!pending) return done();
1070
1084
 
1071
1085
  for (; i < tokens.length; i++) {
@@ -1148,4 +1162,4 @@ if (typeof exports === 'object') {
1148
1162
 
1149
1163
  }).call(function() {
1150
1164
  return this || (typeof window !== 'undefined' ? window : global);
1151
- }());
1165
+ }());
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9.0
5
- prerelease:
4
+ version: 0.2.10.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - nodanaonlyzuul
@@ -10,9 +9,9 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2013-11-23 00:00:00.000000000 Z
14
13
  dependencies: []
15
- description: ! 'A gemified verison of the chjj/marked: "A full-featured markdown parser
14
+ description: 'A gemified verison of the chjj/marked: "A full-featured markdown parser
16
15
  and compiler, written in javascript."'
17
16
  email:
18
17
  - stephen@eastmedia.com
@@ -32,26 +31,25 @@ files:
32
31
  - vendor/assets/javascripts/marked.js
33
32
  homepage: https://github.com/eastmedia/marked-rails
34
33
  licenses: []
34
+ metadata: {}
35
35
  post_install_message:
36
36
  rdoc_options: []
37
37
  require_paths:
38
38
  - lib
39
39
  required_ruby_version: !ruby/object:Gem::Requirement
40
- none: false
41
40
  requirements:
42
- - - ! '>='
41
+ - - '>='
43
42
  - !ruby/object:Gem::Version
44
43
  version: '0'
45
44
  required_rubygems_version: !ruby/object:Gem::Requirement
46
- none: false
47
45
  requirements:
48
- - - ! '>='
46
+ - - '>='
49
47
  - !ruby/object:Gem::Version
50
48
  version: '0'
51
49
  requirements: []
52
50
  rubyforge_project:
53
- rubygems_version: 1.8.24
51
+ rubygems_version: 2.0.3
54
52
  signing_key:
55
- specification_version: 3
53
+ specification_version: 4
56
54
  summary: A gemified verison of the chjj/marked
57
55
  test_files: []