apex-ruby 1.0.33 → 1.0.34

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: 7293b4955edf88c3f7e4c94d8b53daf6e951100a954732ed6d4ec39d42e8c27d
4
- data.tar.gz: 8e8c7770701a66d0ce072f9f19f4fe8e02a8d3b46d7a53d0837cee391089ec5b
3
+ metadata.gz: 55f4be7471b1a5d14cc4f772e5a92fed588dfa22f746d2ebc8417fb9b13758d7
4
+ data.tar.gz: 27aa2109e8bdad8f123f5cdfd6f7dee7a56947f4f47a06d653ca6fde9adf558c
5
5
  SHA512:
6
- metadata.gz: eddc7cc1d61ff37d0e817c5329ca446a9d7b509c312ad6c74207bcde526e58c7896df3570d4ce395989782bf72a85ed103172b787e8b6296f583569639b4645a
7
- data.tar.gz: 44e77a363487d9b97fafb8b98916d1879e6208c308e7585a368053002c81a829bfa11ecb005c25c55c8cfb4f2d6574444eea54eb01676014bde032c2679a3385
6
+ metadata.gz: e3d8fb224ae6eaebe856a9651319c806e3031d3720a7261c264063f8f0777dd522a8547175dfdd393bb83aafb1f5a7ad8b7ee7a49d18cdae9124f279051e7bf9
7
+ data.tar.gz: a60e981f839d51dae0b93e4e088ba43fe575800b951e85d97b35379af434a93ef968d84ebcab74e137dd916023682ff06b1023c4a14574a0224a720490054c88
@@ -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 35
25
- #define APEX_VERSION_STRING "1.1.35"
24
+ #define APEX_VERSION_PATCH 36
25
+ #define APEX_VERSION_STRING "1.1.36"
26
26
 
27
27
  /**
28
28
  * Processor compatibility modes
@@ -150,7 +150,7 @@ typedef struct apex_options {
150
150
  bool enable_grid_tables; /* Enable Pandoc grid table syntax (preprocess to pipe tables) */
151
151
 
152
152
  /* Critic markup mode */
153
- int critic_mode; /* 0=markup (default), 1=accept, 2=reject */
153
+ int critic_mode; /* 0=accept, 1=reject, 2=markup (default) */
154
154
 
155
155
  /* Metadata handling */
156
156
  bool strip_metadata;
@@ -113,6 +113,22 @@ static all_cell *collect_all_cells(cmark_node *document) {
113
113
  /**
114
114
  * Walk AST and collect cells with attributes
115
115
  */
116
+ /* True when the cell whose opening tag starts at `cell` contains only `marker`
117
+ * (or `alt`), ignoring surrounding whitespace. */
118
+ static bool cell_is_only_marker(const char *cell, const char *marker, const char *alt) {
119
+ bool is_th = strncmp(cell, "<th", 3) == 0;
120
+ const char *content = strchr(cell, '>');
121
+ if (!content) return false;
122
+ content++;
123
+ const char *end = strstr(content, is_th ? "</th>" : "</td>");
124
+ if (!end) return false;
125
+ while (content < end && isspace((unsigned char)*content)) content++;
126
+ while (end > content && isspace((unsigned char)end[-1])) end--;
127
+ size_t len = (size_t)(end - content);
128
+ if (len == strlen(marker) && strncmp(content, marker, len) == 0) return true;
129
+ return alt && len == strlen(alt) && strncmp(content, alt, len) == 0;
130
+ }
131
+
116
132
  static cell_attr *collect_table_cell_attributes(cmark_node *document) {
117
133
  cell_attr *list = NULL;
118
134
 
@@ -181,8 +197,7 @@ static cell_attr *collect_table_cell_attributes(cmark_node *document) {
181
197
  attr->attributes = strdup(attrs);
182
198
  attr->cell_text = cell_text ? strdup(cell_text) : NULL;
183
199
  attr->next = list;
184
- list = attr;
185
- }
200
+ list = attr; }
186
201
  }
187
202
  /* Count all cells (including removed ones) to match the column indices
188
203
  * used in advanced_tables.c when finding target cells for rowspan.
@@ -2076,41 +2091,9 @@ char *apex_inject_table_attributes(const char *html, cmark_node *document, int c
2076
2091
  }
2077
2092
  }
2078
2093
 
2079
- /* Also check if this cell contains "^^" (rowspan marker) - these should be removed */
2080
- /* Check both the preview and the actual content in the HTML */
2081
- bool is_rowspan_marker = (strstr(cell_preview, "^^") != NULL);
2082
- if (!is_rowspan_marker) {
2083
- /* Also check the actual HTML content for "^^" */
2084
- const char *content_check = strstr(read, ">");
2085
- if (content_check) {
2086
- const char *close_check = strstr(content_check + 1, "</td>");
2087
- if (!close_check) close_check = strstr(content_check + 1, "</th>");
2088
- if (close_check && close_check - content_check - 1 < 100) {
2089
- char check_buf[100];
2090
- strncpy(check_buf, content_check + 1, close_check - content_check - 1);
2091
- check_buf[close_check - content_check - 1] = '\0';
2092
- is_rowspan_marker = (strstr(check_buf, "^^") != NULL);
2093
- }
2094
- }
2095
- }
2096
-
2097
- /* Also check if this cell contains "<< " or "&lt;&lt;" (colspan marker) - these should be removed */
2098
- /* Check both the preview and the actual content in the HTML */
2099
- bool is_colspan_marker = (strstr(cell_preview, "<<") != NULL || strstr(cell_preview, "&lt;&lt;") != NULL);
2100
- if (!is_colspan_marker) {
2101
- /* Also check the actual HTML content for "<< " or "&lt;&lt;" */
2102
- const char *content_check = strstr(read, ">");
2103
- if (content_check) {
2104
- const char *close_check = strstr(content_check + 1, "</td>");
2105
- if (!close_check) close_check = strstr(content_check + 1, "</th>");
2106
- if (close_check && close_check - content_check - 1 < 100) {
2107
- char check_buf[100];
2108
- strncpy(check_buf, content_check + 1, close_check - content_check - 1);
2109
- check_buf[close_check - content_check - 1] = '\0';
2110
- is_colspan_marker = (strstr(check_buf, "<<") != NULL || strstr(check_buf, "&lt;&lt;") != NULL);
2111
- }
2112
- }
2113
- }
2094
+ /* Cells holding only a span marker (^^ or <<) are removed */
2095
+ bool is_rowspan_marker = cell_is_only_marker(read, "^^", NULL);
2096
+ bool is_colspan_marker = cell_is_only_marker(read, "&lt;&lt;", "<<");
2114
2097
 
2115
2098
  /* Check if this cell should be removed:
2116
2099
  * 1. If it's matched and marked for removal
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.33"
9
+ VERSION = "1.0.34"
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.33
4
+ version: 1.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra