jekyll-latex-block 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0cc8965555924d38bb1dce50048310527bdf260fa2c9d82bc0bcc51a2d25a26
4
- data.tar.gz: 91745484be8f68ded4bbc9600a391e96ebcb7f5bb3312b39f97519051f7dd1a4
3
+ metadata.gz: 864f2c5b589dae87ed1e9669a8271dd57f28357114f9b4d0c0a00e0b20c45587
4
+ data.tar.gz: 2cb7b0270ac9b38c570c35457e07bca0f4e551c607fb97943e8fbf72323bc9df
5
5
  SHA512:
6
- metadata.gz: 6b7fbd9b0c5bd95d089480ff1e80dfc3d60add82aaccd39d81bb2acd24f47851d16e86128f945b7739497c670a41fe1e23e11e9a80486d39e58b3919f8d57695
7
- data.tar.gz: 92a1e1e4abbba843ad4edce30456c77d5cc36bc58fb1eb5a1c395406f0d1b4f49bef26c49efe83f796e5491356ce9e555110171c3cc89c6244b820864f845e20
6
+ metadata.gz: df232908415fb2f88769ae0b673191d5d2fd071bd418370124018b264676387f039c72e18e820158c11f8ecd37686bf2e3aaaf4db7a34864acbfb7498bcadd2c
7
+ data.tar.gz: 6e0f6be658ff2229270b8d1bf2bbaf11621e947470fab226365b3484a10c00230f40d6f6275ba247286eb99486998bd2ae45b382335591bcbd31d0ca922ebf81
data/README.md CHANGED
@@ -13,11 +13,11 @@ Ensure that your build environment has a JavaScript interpreter supported by
13
13
 
14
14
  ## Installation
15
15
 
16
- Add this gem to your project's `gems.rb` or `Gemfile`:
16
+ Add this gem to your project's `Gemfile`:
17
17
 
18
18
  ```ruby
19
19
  group :jekyll_plugins do
20
- gem "jekyll-latex-block", "~> 0.11.0"
20
+ gem "jekyll-latex-block", "~> 0.11.1"
21
21
  end
22
22
  ```
23
23
 
@@ -55,7 +55,7 @@ client-side JavaScript.
55
55
  Place the following stylesheet inside your `<head>` tag:
56
56
 
57
57
  ```html
58
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.0/katex.min.css" integrity="sha256-KoSSCu31XsbWh8THRt4pvxhcYkj3sEwDw/ZnIErNr4g=" crossorigin="anonymous" />
58
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" integrity="sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung=" crossorigin="anonymous" />
59
59
  ```
60
60
 
61
61
  ### Hard-mode CSS & Fonts Integration :warning:
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module LatexBlock
5
- VERSION = '0.11.0'
5
+ VERSION = '0.11.1'
6
6
  end
7
7
  end
@@ -7,24 +7,19 @@ module Jekyll
7
7
  module Tags
8
8
  # LaTeX tag, HTML rendering via KaTeX
9
9
  class LatexBlock < Liquid::Block
10
- def initialize(tag_name, markup, options)
11
- @parsed_options = Liquid::Tag::Parser.new(markup).args
12
- super
13
- end
10
+ KATEX_PATH = File.expand_path(
11
+ '../../js/katex.js', File.dirname(__FILE__)
12
+ ).freeze
13
+ KATEX_JS = ExecJS.compile(File.read(KATEX_PATH)).freeze
14
14
 
15
- def katex_js
16
- # rubocop:disable Style/ClassVars
17
- @@katex ||= ExecJS.compile(File.read(katex_path))
18
- # rubocop:enable Style/ClassVars
19
- end
20
-
21
- def katex_path
22
- File.expand_path('../../js/katex.js', File.dirname(__FILE__))
15
+ def initialize(_tag_name, markup, _options)
16
+ @parsed_options = Parser.new(markup).args
17
+ super
23
18
  end
24
19
 
25
- def render(context)
20
+ def render(_context)
26
21
  latex_source = super
27
- katex_js.call('katex.renderToString', latex_source, @parsed_options)
22
+ KATEX_JS.call('katex.renderToString', latex_source, @parsed_options)
28
23
  end
29
24
  end
30
25
  end
@@ -6323,7 +6323,6 @@ function defineFunction(_ref) {
6323
6323
  allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,
6324
6324
  numOptionalArgs: props.numOptionalArgs || 0,
6325
6325
  infix: !!props.infix,
6326
- consumeMode: props.consumeMode,
6327
6326
  handler: handler
6328
6327
  };
6329
6328
 
@@ -7705,7 +7704,11 @@ var accent_htmlBuilder = function htmlBuilder(grp, options) {
7705
7704
  accent = buildCommon.staticSvg("vec", options);
7706
7705
  width = buildCommon.svgData.vec[1];
7707
7706
  } else {
7708
- accent = buildCommon.makeSymbol(group.label, "Main-Regular", group.mode, options); // Remove the italic correction of the accent, because it only serves to
7707
+ accent = buildCommon.makeOrd({
7708
+ mode: group.mode,
7709
+ text: group.label
7710
+ }, options, "textord");
7711
+ accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to
7709
7712
  // shift the accent over to a place we don't want.
7710
7713
 
7711
7714
  accent.italic = 0;
@@ -9564,13 +9567,13 @@ function getHLines(parser) {
9564
9567
  // Each element in the array tells if the line is dashed.
9565
9568
  var hlineInfo = [];
9566
9569
  parser.consumeSpaces();
9567
- var nxt = parser.nextToken.text;
9570
+ var nxt = parser.fetch().text;
9568
9571
 
9569
9572
  while (nxt === "\\hline" || nxt === "\\hdashline") {
9570
9573
  parser.consume();
9571
9574
  hlineInfo.push(nxt === "\\hdashline");
9572
9575
  parser.consumeSpaces();
9573
- nxt = parser.nextToken.text;
9576
+ nxt = parser.fetch().text;
9574
9577
  }
9575
9578
 
9576
9579
  return hlineInfo;
@@ -9639,7 +9642,7 @@ function parseArray(parser, _ref, style) {
9639
9642
  }
9640
9643
 
9641
9644
  row.push(cell);
9642
- var next = parser.nextToken.text;
9645
+ var next = parser.fetch().text;
9643
9646
 
9644
9647
  if (next === "&") {
9645
9648
  parser.consume();
@@ -11836,8 +11839,7 @@ defineFunction({
11836
11839
  props: {
11837
11840
  numArgs: 0,
11838
11841
  allowedInText: true,
11839
- allowedInMath: false,
11840
- consumeMode: "math"
11842
+ allowedInMath: false
11841
11843
  },
11842
11844
  handler: function handler(_ref, args) {
11843
11845
  var funcName = _ref.funcName,
@@ -11845,12 +11847,9 @@ defineFunction({
11845
11847
  var outerMode = parser.mode;
11846
11848
  parser.switchMode("math");
11847
11849
  var close = funcName === "\\(" ? "\\)" : "$";
11848
- var body = parser.parseExpression(false, close); // We can't expand the next symbol after the closing $ until after
11849
- // switching modes back. So don't consume within expect.
11850
-
11851
- parser.expect(close, false);
11850
+ var body = parser.parseExpression(false, close);
11851
+ parser.expect(close);
11852
11852
  parser.switchMode(outerMode);
11853
- parser.consume();
11854
11853
  return {
11855
11854
  type: "styling",
11856
11855
  mode: parser.mode,
@@ -13662,8 +13661,7 @@ defineFunction({
13662
13661
  numArgs: 1,
13663
13662
  argTypes: ["text"],
13664
13663
  greediness: 2,
13665
- allowedInText: true,
13666
- consumeMode: "text"
13664
+ allowedInText: true
13667
13665
  },
13668
13666
  handler: function handler(_ref, args) {
13669
13667
  var parser = _ref.parser,
@@ -14937,7 +14935,7 @@ defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
14937
14935
  defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
14938
14936
  defineMacro("\\red", "\\textcolor{##df0030}{#1}");
14939
14937
  defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
14940
- defineMacro("\\gray", "\\textcolor{gray}{##1}");
14938
+ defineMacro("\\gray", "\\textcolor{gray}{#1}");
14941
14939
  defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
14942
14940
  defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
14943
14941
  defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
@@ -16154,8 +16152,8 @@ function () {
16154
16152
  consume = true;
16155
16153
  }
16156
16154
 
16157
- if (this.nextToken.text !== text) {
16158
- throw new src_ParseError("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken);
16155
+ if (this.fetch().text !== text) {
16156
+ throw new src_ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch());
16159
16157
  }
16160
16158
 
16161
16159
  if (consume) {
@@ -16163,13 +16161,26 @@ function () {
16163
16161
  }
16164
16162
  }
16165
16163
  /**
16166
- * Considers the current look ahead token as consumed,
16167
- * and fetches the one after that as the new look ahead.
16164
+ * Discards the current lookahead token, considering it consumed.
16168
16165
  */
16169
16166
  ;
16170
16167
 
16171
16168
  _proto.consume = function consume() {
16172
- this.nextToken = this.gullet.expandNextToken();
16169
+ this.nextToken = null;
16170
+ }
16171
+ /**
16172
+ * Return the current lookahead token, or if there isn't one (at the
16173
+ * beginning, or if the previous lookahead token was consume()d),
16174
+ * fetch the next token as the new lookahead token and return it.
16175
+ */
16176
+ ;
16177
+
16178
+ _proto.fetch = function fetch() {
16179
+ if (this.nextToken == null) {
16180
+ this.nextToken = this.gullet.expandNextToken();
16181
+ }
16182
+
16183
+ return this.nextToken;
16173
16184
  }
16174
16185
  /**
16175
16186
  * Switches between "text" and "math" modes.
@@ -16197,10 +16208,9 @@ function () {
16197
16208
  } // Try to parse the input
16198
16209
 
16199
16210
 
16200
- this.consume();
16201
16211
  var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end
16202
16212
 
16203
- this.expect("EOF", false); // End the group namespace for the expression
16213
+ this.expect("EOF"); // End the group namespace for the expression
16204
16214
 
16205
16215
  this.gullet.endGroup();
16206
16216
  return parse;
@@ -16216,7 +16226,7 @@ function () {
16216
16226
  this.consumeSpaces();
16217
16227
  }
16218
16228
 
16219
- var lex = this.nextToken;
16229
+ var lex = this.fetch();
16220
16230
 
16221
16231
  if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
16222
16232
  break;
@@ -16316,12 +16326,10 @@ function () {
16316
16326
  * Handle a subscript or superscript with nice errors.
16317
16327
  */
16318
16328
  _proto.handleSupSubscript = function handleSupSubscript(name) {
16319
- var symbolToken = this.nextToken;
16329
+ var symbolToken = this.fetch();
16320
16330
  var symbol = symbolToken.text;
16321
16331
  this.consume();
16322
- this.consumeSpaces(); // ignore spaces before sup/subscript argument
16323
-
16324
- var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS);
16332
+ var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument
16325
16333
 
16326
16334
  if (!group) {
16327
16335
  throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken);
@@ -16381,7 +16389,7 @@ function () {
16381
16389
  // Guaranteed in math mode, so eat any spaces first.
16382
16390
  this.consumeSpaces(); // Lex the first token
16383
16391
 
16384
- var lex = this.nextToken;
16392
+ var lex = this.fetch();
16385
16393
 
16386
16394
  if (lex.text === "\\limits" || lex.text === "\\nolimits") {
16387
16395
  // We got a limit control
@@ -16433,7 +16441,7 @@ function () {
16433
16441
  var primes = [prime];
16434
16442
  this.consume(); // Keep lexing tokens until we get something that's not a prime
16435
16443
 
16436
- while (this.nextToken.text === "'") {
16444
+ while (this.fetch().text === "'") {
16437
16445
  // For each one, add another prime to the list
16438
16446
  primes.push(prime);
16439
16447
  this.consume();
@@ -16441,7 +16449,7 @@ function () {
16441
16449
  // superscript in with the primes.
16442
16450
 
16443
16451
 
16444
- if (this.nextToken.text === "^") {
16452
+ if (this.fetch().text === "^") {
16445
16453
  primes.push(this.handleSupSubscript("superscript"));
16446
16454
  } // Put everything into an ordgroup as the superscript
16447
16455
 
@@ -16480,7 +16488,7 @@ function () {
16480
16488
 
16481
16489
  _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting.
16482
16490
  greediness) {
16483
- var token = this.nextToken;
16491
+ var token = this.fetch();
16484
16492
  var func = token.text;
16485
16493
  var funcData = src_functions[func];
16486
16494
 
@@ -16488,29 +16496,14 @@ function () {
16488
16496
  return null;
16489
16497
  }
16490
16498
 
16499
+ this.consume(); // consume command token
16500
+
16491
16501
  if (greediness != null && funcData.greediness <= greediness) {
16492
16502
  throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
16493
16503
  } else if (this.mode === "text" && !funcData.allowedInText) {
16494
16504
  throw new src_ParseError("Can't use function '" + func + "' in text mode", token);
16495
16505
  } else if (this.mode === "math" && funcData.allowedInMath === false) {
16496
16506
  throw new src_ParseError("Can't use function '" + func + "' in math mode", token);
16497
- } // hyperref package sets the catcode of % as an active character
16498
-
16499
-
16500
- if (funcData.argTypes && funcData.argTypes[0] === "url") {
16501
- this.gullet.lexer.setCatcode("%", 13);
16502
- } // Consume the command token after possibly switching to the
16503
- // mode specified by the function (for instant mode switching),
16504
- // and then immediately switch back.
16505
-
16506
-
16507
- if (funcData.consumeMode) {
16508
- var oldMode = this.mode;
16509
- this.switchMode(funcData.consumeMode);
16510
- this.consume();
16511
- this.switchMode(oldMode);
16512
- } else {
16513
- this.consume();
16514
16507
  }
16515
16508
 
16516
16509
  var _this$parseArguments = this.parseArguments(func, funcData),
@@ -16566,22 +16559,14 @@ function () {
16566
16559
  // put spaces between the arguments (e.g., ‘\row x n’), because
16567
16560
  // TeX doesn’t use single spaces as undelimited arguments."
16568
16561
 
16569
- if (i > 0 && !isOptional) {
16570
- this.consumeSpaces();
16571
- } // Also consume leading spaces in math mode, as parseSymbol
16562
+ var consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol
16572
16563
  // won't know what to do with them. This can only happen with
16573
16564
  // macros, e.g. \frac\foo\foo where \foo expands to a space symbol.
16574
- // In LaTeX, the \foo's get treated as (blank) arguments).
16565
+ // In LaTeX, the \foo's get treated as (blank) arguments.
16575
16566
  // In KaTeX, for now, both spaces will get consumed.
16576
16567
  // TODO(edemaine)
16577
-
16578
-
16579
- if (i === 0 && !isOptional && this.mode === "math") {
16580
- this.consumeSpaces();
16581
- }
16582
-
16583
- var nextToken = this.nextToken;
16584
- var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness);
16568
+ i === 0 && !isOptional && this.mode === "math";
16569
+ var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness, consumeSpaces);
16585
16570
 
16586
16571
  if (!arg) {
16587
16572
  if (isOptional) {
@@ -16589,7 +16574,7 @@ function () {
16589
16574
  continue;
16590
16575
  }
16591
16576
 
16592
- throw new src_ParseError("Expected group after '" + func + "'", nextToken);
16577
+ throw new src_ParseError("Expected group after '" + func + "'", this.fetch());
16593
16578
  }
16594
16579
 
16595
16580
  (isOptional ? optArgs : args).push(arg);
@@ -16605,26 +16590,34 @@ function () {
16605
16590
  */
16606
16591
  ;
16607
16592
 
16608
- _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness) {
16593
+ _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness, consumeSpaces) {
16609
16594
  switch (type) {
16610
16595
  case "color":
16596
+ if (consumeSpaces) {
16597
+ this.consumeSpaces();
16598
+ }
16599
+
16611
16600
  return this.parseColorGroup(optional);
16612
16601
 
16613
16602
  case "size":
16603
+ if (consumeSpaces) {
16604
+ this.consumeSpaces();
16605
+ }
16606
+
16614
16607
  return this.parseSizeGroup(optional);
16615
16608
 
16616
16609
  case "url":
16617
- return this.parseUrlGroup(optional);
16610
+ return this.parseUrlGroup(optional, consumeSpaces);
16618
16611
 
16619
16612
  case "math":
16620
16613
  case "text":
16621
- return this.parseGroup(name, optional, greediness, undefined, type);
16614
+ return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces);
16622
16615
 
16623
16616
  case "hbox":
16624
16617
  {
16625
16618
  // hbox argument type wraps the argument in the equivalent of
16626
16619
  // \hbox, which is like \text but switching to \textstyle size.
16627
- var group = this.parseGroup(name, optional, greediness, undefined, "text");
16620
+ var group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces);
16628
16621
 
16629
16622
  if (!group) {
16630
16623
  return group;
@@ -16642,7 +16635,11 @@ function () {
16642
16635
 
16643
16636
  case "raw":
16644
16637
  {
16645
- if (optional && this.nextToken.text === "{") {
16638
+ if (consumeSpaces) {
16639
+ this.consumeSpaces();
16640
+ }
16641
+
16642
+ if (optional && this.fetch().text === "{") {
16646
16643
  return null;
16647
16644
  }
16648
16645
 
@@ -16655,22 +16652,26 @@ function () {
16655
16652
  string: token.text
16656
16653
  };
16657
16654
  } else {
16658
- throw new src_ParseError("Expected raw group", this.nextToken);
16655
+ throw new src_ParseError("Expected raw group", this.fetch());
16659
16656
  }
16660
16657
  }
16661
16658
 
16662
16659
  case "original":
16663
16660
  case null:
16664
16661
  case undefined:
16665
- return this.parseGroup(name, optional, greediness);
16662
+ return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces);
16666
16663
 
16667
16664
  default:
16668
- throw new src_ParseError("Unknown group type as " + name, this.nextToken);
16665
+ throw new src_ParseError("Unknown group type as " + name, this.fetch());
16669
16666
  }
16670
- };
16667
+ }
16668
+ /**
16669
+ * Discard any space tokens, fetching the next non-space token.
16670
+ */
16671
+ ;
16671
16672
 
16672
16673
  _proto.consumeSpaces = function consumeSpaces() {
16673
- while (this.nextToken.text === " ") {
16674
+ while (this.fetch().text === " ") {
16674
16675
  this.consume();
16675
16676
  }
16676
16677
  }
@@ -16684,17 +16685,14 @@ function () {
16684
16685
  optional, raw) {
16685
16686
  var groupBegin = optional ? "[" : "{";
16686
16687
  var groupEnd = optional ? "]" : "}";
16687
- var nextToken = this.nextToken;
16688
+ var beginToken = this.fetch();
16688
16689
 
16689
- if (nextToken.text !== groupBegin) {
16690
+ if (beginToken.text !== groupBegin) {
16690
16691
  if (optional) {
16691
16692
  return null;
16692
- } else if (raw && nextToken.text !== "EOF" && /[^{}[\]]/.test(nextToken.text)) {
16693
- // allow a single character in raw string group
16694
- this.gullet.lexer.setCatcode("%", 14); // reset the catcode of %
16695
-
16693
+ } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) {
16696
16694
  this.consume();
16697
- return nextToken;
16695
+ return beginToken;
16698
16696
  }
16699
16697
  }
16700
16698
 
@@ -16702,13 +16700,14 @@ function () {
16702
16700
  this.mode = "text";
16703
16701
  this.expect(groupBegin);
16704
16702
  var str = "";
16705
- var firstToken = this.nextToken;
16703
+ var firstToken = this.fetch();
16706
16704
  var nested = 0; // allow nested braces in raw string group
16707
16705
 
16708
16706
  var lastToken = firstToken;
16707
+ var nextToken;
16709
16708
 
16710
- while (raw && nested > 0 || this.nextToken.text !== groupEnd) {
16711
- switch (this.nextToken.text) {
16709
+ while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) {
16710
+ switch (nextToken.text) {
16712
16711
  case "EOF":
16713
16712
  throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str));
16714
16713
 
@@ -16721,15 +16720,13 @@ function () {
16721
16720
  break;
16722
16721
  }
16723
16722
 
16724
- lastToken = this.nextToken;
16723
+ lastToken = nextToken;
16725
16724
  str += lastToken.text;
16726
16725
  this.consume();
16727
16726
  }
16728
16727
 
16729
- this.mode = outerMode;
16730
- this.gullet.lexer.setCatcode("%", 14); // reset the catcode of %
16731
-
16732
16728
  this.expect(groupEnd);
16729
+ this.mode = outerMode;
16733
16730
  return firstToken.range(lastToken, str);
16734
16731
  }
16735
16732
  /**
@@ -16742,12 +16739,13 @@ function () {
16742
16739
  _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) {
16743
16740
  var outerMode = this.mode;
16744
16741
  this.mode = "text";
16745
- var firstToken = this.nextToken;
16742
+ var firstToken = this.fetch();
16746
16743
  var lastToken = firstToken;
16747
16744
  var str = "";
16745
+ var nextToken;
16748
16746
 
16749
- while (this.nextToken.text !== "EOF" && regex.test(str + this.nextToken.text)) {
16750
- lastToken = this.nextToken;
16747
+ while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
16748
+ lastToken = nextToken;
16751
16749
  str += lastToken.text;
16752
16750
  this.consume();
16753
16751
  }
@@ -16801,7 +16799,7 @@ function () {
16801
16799
  var res;
16802
16800
  var isBlank = false;
16803
16801
 
16804
- if (!optional && this.nextToken.text !== "{") {
16802
+ if (!optional && this.fetch().text !== "{") {
16805
16803
  res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
16806
16804
  } else {
16807
16805
  res = this.parseStringGroup("size", optional);
@@ -16844,13 +16842,18 @@ function () {
16844
16842
  };
16845
16843
  }
16846
16844
  /**
16847
- * Parses an URL, checking escaped letters and allowed protocols.
16845
+ * Parses an URL, checking escaped letters and allowed protocols,
16846
+ * and setting the catcode of % as an active character (as in \hyperref).
16848
16847
  */
16849
16848
  ;
16850
16849
 
16851
- _proto.parseUrlGroup = function parseUrlGroup(optional) {
16850
+ _proto.parseUrlGroup = function parseUrlGroup(optional, consumeSpaces) {
16851
+ this.gullet.lexer.setCatcode("%", 13); // active character
16852
+
16852
16853
  var res = this.parseStringGroup("url", optional, true); // get raw string
16853
16854
 
16855
+ this.gullet.lexer.setCatcode("%", 14); // comment character
16856
+
16854
16857
  if (!res) {
16855
16858
  return null;
16856
16859
  } // hyperref package allows backslashes alone in href, but doesn't
@@ -16881,26 +16884,35 @@ function () {
16881
16884
  ;
16882
16885
 
16883
16886
  _proto.parseGroup = function parseGroup(name, // For error reporting.
16884
- optional, greediness, breakOnTokenText, mode) {
16887
+ optional, greediness, breakOnTokenText, mode, consumeSpaces) {
16888
+ // Switch to specified mode
16885
16889
  var outerMode = this.mode;
16886
- var firstToken = this.nextToken;
16887
- var text = firstToken.text; // Switch to specified mode
16888
16890
 
16889
16891
  if (mode) {
16890
16892
  this.switchMode(mode);
16891
- }
16893
+ } // Consume spaces if requested, crucially *after* we switch modes,
16894
+ // so that the next non-space token is parsed in the correct mode.
16895
+
16896
+
16897
+ if (consumeSpaces) {
16898
+ this.consumeSpaces();
16899
+ } // Get first token
16892
16900
 
16893
- var groupEnd;
16901
+
16902
+ var firstToken = this.fetch();
16903
+ var text = firstToken.text;
16894
16904
  var result; // Try to parse an open brace or \begingroup
16895
16905
 
16896
16906
  if (optional ? text === "[" : text === "{" || text === "\\begingroup") {
16897
- groupEnd = Parser.endOfGroup[text]; // Start a new group namespace
16907
+ this.consume();
16908
+ var groupEnd = Parser.endOfGroup[text]; // Start a new group namespace
16898
16909
 
16899
16910
  this.gullet.beginGroup(); // If we get a brace, parse an expression
16900
16911
 
16901
- this.consume();
16902
16912
  var expression = this.parseExpression(false, groupEnd);
16903
- var lastToken = this.nextToken; // End group namespace before consuming symbol after close brace
16913
+ var lastToken = this.fetch(); // Check that we got a matching closing brace
16914
+
16915
+ this.expect(groupEnd); // End group namespace
16904
16916
 
16905
16917
  this.gullet.endGroup();
16906
16918
  result = {
@@ -16935,11 +16947,6 @@ function () {
16935
16947
 
16936
16948
  if (mode) {
16937
16949
  this.switchMode(outerMode);
16938
- } // Make sure we got a close brace
16939
-
16940
-
16941
- if (groupEnd) {
16942
- this.expect(groupEnd);
16943
16950
  }
16944
16951
 
16945
16952
  return result;
@@ -16995,12 +17002,12 @@ function () {
16995
17002
  }
16996
17003
  /**
16997
17004
  * Parse a single symbol out of the string. Here, we handle single character
16998
- * symbols and special functions like verbatim
17005
+ * symbols and special functions like \verb.
16999
17006
  */
17000
17007
  ;
17001
17008
 
17002
17009
  _proto.parseSymbol = function parseSymbol() {
17003
- var nucleus = this.nextToken;
17010
+ var nucleus = this.fetch();
17004
17011
  var text = nucleus.text;
17005
17012
 
17006
17013
  if (/^\\verb[^a-zA-Z]/.test(text)) {
@@ -17319,7 +17326,7 @@ var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) {
17319
17326
  /**
17320
17327
  * Current KaTeX version
17321
17328
  */
17322
- version: "0.11.0",
17329
+ version: "0.11.1",
17323
17330
 
17324
17331
  /**
17325
17332
  * Renders the given LaTeX into an HTML+MathML combination, and adds
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-latex-block
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Richards
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-15 00:00:00.000000000 Z
11
+ date: 2020-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: codecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: irb
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -39,47 +53,47 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: minitest
56
+ name: mutant-rspec
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '5.0'
61
+ version: '0.9'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '5.0'
68
+ version: '0.9'
55
69
  - !ruby/object:Gem::Dependency
56
- name: minitest-rg
70
+ name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '5.2'
75
+ version: '13.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '5.2'
82
+ version: '13.0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rake
84
+ name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '12.0'
89
+ version: '3.9'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '12.0'
96
+ version: '3.9'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -146,16 +160,22 @@ dependencies:
146
160
  name: liquid-tag-parser
147
161
  requirement: !ruby/object:Gem::Requirement
148
162
  requirements:
149
- - - "~>"
163
+ - - ">="
150
164
  - !ruby/object:Gem::Version
151
165
  version: '1.9'
166
+ - - "<"
167
+ - !ruby/object:Gem::Version
168
+ version: '3.0'
152
169
  type: :runtime
153
170
  prerelease: false
154
171
  version_requirements: !ruby/object:Gem::Requirement
155
172
  requirements:
156
- - - "~>"
173
+ - - ">="
157
174
  - !ruby/object:Gem::Version
158
175
  version: '1.9'
176
+ - - "<"
177
+ - !ruby/object:Gem::Version
178
+ version: '3.0'
159
179
  description: Renders LaTeX formulas to your site via KaTeX
160
180
  email:
161
181
  - tom@tomrichards.net
@@ -190,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
210
  - !ruby/object:Gem::Version
191
211
  version: '0'
192
212
  requirements: []
193
- rubygems_version: 3.0.6
213
+ rubygems_version: 3.1.2
194
214
  signing_key:
195
215
  specification_version: 4
196
216
  summary: LaTeX integration for Jekyll