markly 0.5.1 → 0.7.0
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 +4 -4
- data/ext/markly/blocks.c +13 -2
- data/ext/markly/cmark-gfm_version.h +2 -2
- data/ext/markly/commonmark.c +14 -4
- data/ext/markly/ext_scanners.c +360 -640
- data/ext/markly/extconf.rb +10 -2
- data/ext/markly/footnotes.c +23 -0
- data/ext/markly/footnotes.h +2 -0
- data/ext/markly/html.c +40 -19
- data/ext/markly/inlines.c +69 -11
- data/ext/markly/markly.c +1 -1
- data/ext/markly/node.h +7 -0
- data/ext/markly/scanners.c +9484 -19346
- data/ext/markly/table.c +71 -52
- data/lib/markly/markly.bundle +0 -0
- data/lib/markly/renderer/generic.rb +131 -0
- data/lib/markly/renderer/html.rb +282 -0
- data/lib/markly/version.rb +1 -1
- data/lib/markly.rb +3 -3
- metadata +6 -5
- data/lib/markly/renderer/html_renderer.rb +0 -277
- data/lib/markly/renderer.rb +0 -133
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e62908560f536f22b024d0fc29c02ee109a99aa6b4216d58e82fc97d7525171a
|
4
|
+
data.tar.gz: b6b7eae8d1579556a4461aa9d338cb1d86433fdcb20c6ac70983d0cdedeead6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daee4db1b759180ea27886da828fa1301aac0adb1833203b80b635ee815e61bebb8caedad03853cd4d4231de748781cefa6d341d3172d3a387e170cbd806cc47
|
7
|
+
data.tar.gz: a0f79ef83f73d32c8b1b14a21c13ad3c20574abed043e29cb0057c31c9b85ccb051244462efb0dfd508a3315232083de3bafefa0dc4d24fd5106bc966721bcdf
|
data/ext/markly/blocks.c
CHANGED
@@ -468,7 +468,6 @@ static void process_footnotes(cmark_parser *parser) {
|
|
468
468
|
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
|
469
469
|
cur = cmark_iter_get_node(iter);
|
470
470
|
if (ev_type == CMARK_EVENT_EXIT && cur->type == CMARK_NODE_FOOTNOTE_DEFINITION) {
|
471
|
-
cmark_node_unlink(cur);
|
472
471
|
cmark_footnote_create(map, cur);
|
473
472
|
}
|
474
473
|
}
|
@@ -485,6 +484,15 @@ static void process_footnotes(cmark_parser *parser) {
|
|
485
484
|
if (!footnote->ix)
|
486
485
|
footnote->ix = ++ix;
|
487
486
|
|
487
|
+
// store a reference to this footnote reference's footnote definition
|
488
|
+
// this is used by renderers when generating label ids
|
489
|
+
cur->parent_footnote_def = footnote->node;
|
490
|
+
|
491
|
+
// keep track of a) count of how many times this footnote def has been
|
492
|
+
// referenced, and b) which reference index this footnote ref is at.
|
493
|
+
// this is used by renderers when generating links and backreferences.
|
494
|
+
cur->footnote.ref_ix = ++footnote->node->footnote.def_count;
|
495
|
+
|
488
496
|
char n[32];
|
489
497
|
snprintf(n, sizeof(n), "%d", footnote->ix);
|
490
498
|
cmark_chunk_free(parser->mem, &cur->as.literal);
|
@@ -515,13 +523,16 @@ static void process_footnotes(cmark_parser *parser) {
|
|
515
523
|
qsort(map->sorted, map->size, sizeof(cmark_map_entry *), sort_footnote_by_ix);
|
516
524
|
for (unsigned int i = 0; i < map->size; ++i) {
|
517
525
|
cmark_footnote *footnote = (cmark_footnote *)map->sorted[i];
|
518
|
-
if (!footnote->ix)
|
526
|
+
if (!footnote->ix) {
|
527
|
+
cmark_node_unlink(footnote->node);
|
519
528
|
continue;
|
529
|
+
}
|
520
530
|
cmark_node_append_child(parser->root, footnote->node);
|
521
531
|
footnote->node = NULL;
|
522
532
|
}
|
523
533
|
}
|
524
534
|
|
535
|
+
cmark_unlink_footnotes_map(map);
|
525
536
|
cmark_map_free(map);
|
526
537
|
}
|
527
538
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#ifndef CMARK_GFM_VERSION_H
|
2
2
|
#define CMARK_GFM_VERSION_H
|
3
3
|
|
4
|
-
#define CMARK_GFM_VERSION ((0 << 24) | (29 << 16) | (0 << 8) |
|
5
|
-
#define CMARK_GFM_VERSION_STRING "0.29.0.gfm.
|
4
|
+
#define CMARK_GFM_VERSION ((0 << 24) | (29 << 16) | (0 << 8) | 2)
|
5
|
+
#define CMARK_GFM_VERSION_STRING "0.29.0.gfm.2"
|
6
6
|
|
7
7
|
#endif
|
data/ext/markly/commonmark.c
CHANGED
@@ -477,7 +477,13 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
|
|
477
477
|
case CMARK_NODE_FOOTNOTE_REFERENCE:
|
478
478
|
if (entering) {
|
479
479
|
LIT("[^");
|
480
|
-
|
480
|
+
|
481
|
+
char *footnote_label = renderer->mem->calloc(node->parent_footnote_def->as.literal.len + 1, sizeof(char));
|
482
|
+
memmove(footnote_label, node->parent_footnote_def->as.literal.data, node->parent_footnote_def->as.literal.len);
|
483
|
+
|
484
|
+
OUT(footnote_label, false, LITERAL);
|
485
|
+
renderer->mem->free(footnote_label);
|
486
|
+
|
481
487
|
LIT("]");
|
482
488
|
}
|
483
489
|
break;
|
@@ -486,9 +492,13 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
|
|
486
492
|
if (entering) {
|
487
493
|
renderer->footnote_ix += 1;
|
488
494
|
LIT("[^");
|
489
|
-
|
490
|
-
|
491
|
-
|
495
|
+
|
496
|
+
char *footnote_label = renderer->mem->calloc(node->as.literal.len + 1, sizeof(char));
|
497
|
+
memmove(footnote_label, node->as.literal.data, node->as.literal.len);
|
498
|
+
|
499
|
+
OUT(footnote_label, false, LITERAL);
|
500
|
+
renderer->mem->free(footnote_label);
|
501
|
+
|
492
502
|
LIT("]:\n");
|
493
503
|
|
494
504
|
cmark_strbuf_puts(renderer->prefix, " ");
|