apex-ruby 1.0.44 → 1.0.45

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: 8d77d8965ecbf89a0c4ddd71f80d3cd571befb6100237caed8ddbb818c1d279c
4
- data.tar.gz: b9513bc2aa33e52fd347859e923b039cf205ff052c27ab07eedf08fe94d10e10
3
+ metadata.gz: 55f46b5882430ec3db488a30a91c1e026cb10af55a44e05765be695542268584
4
+ data.tar.gz: 5234aea6b39f08fb6398b49f6beb6e91c3c8e6d5c701cbf4d6ade0a58dffc61c
5
5
  SHA512:
6
- metadata.gz: 30075af84e9c76146a51c0f43bbf5b2a90458cb342a957720d9d1d3214333b8063b7c2a3fcca92a99012e07e6899d51063d0703267b64a941f0d536a32a81407
7
- data.tar.gz: 59b50d96ce5709e024d5f83f1d70ff961402c2759daa2b12978cd32f4f48d9e91f8fa9b417cdedcde03c8ffed18acf5027c40403f83bec57e4fd6539eee0425b
6
+ metadata.gz: 2feca8bc1497bf459cdbf2b772dc8657df94a2930f601038803fcff68da31a416378aa02ea5f04fac869acbcb466f8b32b8fc090ed1757612c2fa4f4c5862098
7
+ data.tar.gz: 1d81a7a77ec9e915a7203ba100a94c539d1008435dec05308f6a62e5064b5ad4e779f96d451d5325146e9f15002693a825e745908ff3cb0cf710a8e6dd3e8cea
@@ -21,8 +21,8 @@ typedef struct cmark_node cmark_node;
21
21
 
22
22
  #define APEX_VERSION_MAJOR 1
23
23
  #define APEX_VERSION_MINOR 1
24
- #define APEX_VERSION_PATCH 50
25
- #define APEX_VERSION_STRING "1.1.50"
24
+ #define APEX_VERSION_PATCH 51
25
+ #define APEX_VERSION_STRING "1.1.51"
26
26
 
27
27
  /**
28
28
  * Processor compatibility modes
@@ -81,6 +81,31 @@ static int scan_dollar_math(const char *input, int len, bool *is_display) {
81
81
  return 0;
82
82
  }
83
83
 
84
+ /**
85
+ * True when display-math content has a letter, digit, or operator.
86
+ * Emphasis stars, commas, and spaces do not qualify on their own, so
87
+ * **\[**, **\]** stays escaped brackets instead of an equation.
88
+ */
89
+ static bool display_math_content(const char *s, int len) {
90
+ for (int i = 0; i < len; i++) {
91
+ unsigned char c = (unsigned char)s[i];
92
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
93
+ (c >= '0' && c <= '9') || c >= 128) {
94
+ return true;
95
+ }
96
+ switch (c) {
97
+ case '+': case '-': case '/': case '=':
98
+ case '^': case '_': case '\\': case '.':
99
+ case '<': case '>': case '|': case '~':
100
+ case '{': case '}':
101
+ return true;
102
+ default:
103
+ break;
104
+ }
105
+ }
106
+ return false;
107
+ }
108
+
84
109
  /**
85
110
  * Scan for \(...\) or \[...\] LaTeX-style math
86
111
  * Returns length if found, 0 otherwise
@@ -94,6 +119,9 @@ static int scan_latex_math(const char *input, int len, bool *is_display) {
94
119
  /* Find closing \] */
95
120
  for (int i = 2; i < len - 1; i++) {
96
121
  if (input[i] == '\\' && input[i + 1] == ']') {
122
+ if (!display_math_content(input + 2, i - 2)) {
123
+ return 0;
124
+ }
97
125
  return i + 2;
98
126
  }
99
127
  }
data/lib/apex/version.rb CHANGED
@@ -6,7 +6,7 @@ module Apex
6
6
  # via Apex::Native.version.
7
7
  module Version
8
8
  # Current gem version.
9
- VERSION = "1.0.44"
9
+ VERSION = "1.0.45"
10
10
  end
11
11
 
12
12
  # Shortcut to gem version string.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apex-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.44
4
+ version: 1.0.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra