Skip to content

Commit 97d865d

Browse files
committed
Merge branch 'release/6.5.1'
2 parents 0cd6fb4 + 6a67a62 commit 97d865d

File tree

21 files changed

+400
-244
lines changed

21 files changed

+400
-244
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ set(test_files
366366
# Process source files to look for tests to run
367367
add_custom_command (
368368
OUTPUT ${PROJECT_BINARY_DIR}/AllTests.c
369-
COMMAND sh ${PROJECT_SOURCE_DIR}/test/make-tests.sh ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown/*.c > ${PROJECT_BINARY_DIR}/AllTests.c
369+
COMMAND bash ${PROJECT_SOURCE_DIR}/test/make-tests.sh ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown/*.c > ${PROJECT_BINARY_DIR}/AllTests.c
370370
)
371371

372372
if(hasParent)

DevelopmentNotes/DevelopmentNotes.txt

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Title: MultiMarkdown v6 Development Notes
22
Author: Fletcher T. Penney
3-
Date: 2018-09-01
3+
Date: 2019-12-11
44
LaTeX Config: tufte-handout
55
Base Header Level: 3
66
uuid: dd2d8e76-dc2d-416d-9acd-5395d20871c2
@@ -472,6 +472,89 @@ TextBundle/TextPack, OpenDocument, etc.
472472

473473
# Changelog #
474474

475+
* 2019-12-11 - v 6.5.0:
476+
477+
* ADDED: Add ASCII case detection
478+
* ADDED: Add conversion from ITMZ routines
479+
* ADDED: Add support for random header labels when not manually specified (Addresses #157)
480+
* ADDED: Add title as short caption for figures and tables to be used in list of figures and list of tables. Addresses #177 -- thanks, MArpogaus
481+
* ADDED: Add {{TOC:1}} and {{TOC:1-2}} options
482+
* FIXED: Add byte for null terminator when extracting from zip archive
483+
* FIXED: Allow building libMMD has a child project for testing
484+
* FIXED: Clean up Quick Start guide
485+
* FIXED: Ensure newline at end of header contents when importing from OPML/ITMZ
486+
* FIXED: Fix CMake config for MacPorts (fixes #146)
487+
* FIXED: Fix PATH in convenience scripts
488+
* FIXED: Fix bugs in new zip extraction code
489+
* FIXED: Fix edge case with single item loose lists (fixes #174)
490+
* FIXED: Fix filename
491+
* FIXED: Fix handling of hebrew language option
492+
* FIXED: Fix length of metadata if no trailing line ending
493+
* FIXED: Fix letterhead reference to memoir-footer. (Fixes #143)
494+
* FIXED: Fix memory leak (#172) -- thanks Alfons
495+
* FIXED: Fix pointer dereference (fixes #152)
496+
* FIXED: Fix potential bug when reading OPML/ITMZ
497+
* FIXED: Fix potential errors related to checking for metadata
498+
* FIXED: Fix potential issue in d_string
499+
* FIXED: Fix potential memory address error
500+
* FIXED: Fix prior bad edits to quick start guide
501+
* FIXED: Fix regression
502+
* FIXED: Fix test suite for new captions
503+
* FIXED: Fix trim trailing whitespace
504+
* FIXED: Fix two small potential errors
505+
* FIXED: Fix warning
506+
* FIXED: Fix whitespace issues with headers with manual labels
507+
* FIXED: Improve BOM stripping
508+
* FIXED: Improve efficiency when checking for existence of metadata
509+
* FIXED: Include .html for EPUB and .fodt for ODT when transcluding with wildcard extension
510+
* FIXED: Prevent line breaks in HTML/ODF attributes
511+
* FIXED: Update Quick Start PDF
512+
* FIXED: Update README template
513+
* FIXED: Update re2c scanners and prevent crash on certain documents with unexpected encoding
514+
* FIXED: Use C11 (had old C99 as well, but I suspect that wasn't actually used
515+
* Fixes to README
516+
* Merge branch 'develop' of github.com:fletcher/MultiMarkdown-6 into develop
517+
* Merge branch 'release/6.4.0' into develop
518+
* Merge pull request #144 from cdhutch/patch-3
519+
* Merge pull request #162 from DivineDominion/patch-1
520+
* Merge pull request #167 from nickasd/develop
521+
* Revert "remove build folder"
522+
* UPDATED: Add MARKUP token type
523+
* UPDATED: Add OPML routines to libMultiMarkdown.h
524+
* UPDATED: Add UTF-8 validity check function
525+
* UPDATED: Additional README comments about Xcode
526+
* UPDATED: Apply astyle
527+
* UPDATED: Automatically disable libCurl on iOS
528+
* UPDATED: Change convenience scripts for better POSIX compliance (implements #150) (Thanks, Ryan)
529+
* UPDATED: Don't require opening <?xml> in OPML
530+
* UPDATED: Fix doxygen template
531+
* UPDATED: Fix main() when token pools disabled
532+
* UPDATED: Make astyle
533+
* UPDATED: Refactor XML parsing; improve OPML reading; add ITMZ (iThoughts) reading/writing (experimental feature); a few other small tweaks
534+
* UPDATED: Refactor header file inclusion
535+
* UPDATED: Remove debug statement
536+
* UPDATED: Remove i386 build architecture from default configuration
537+
* UPDATED: Remove some old debugging statements that aren't necessary anymore
538+
* UPDATED: Silence some Xcode warnings
539+
* UPDATED: Silence warnings
540+
* UPDATED: Tidy code
541+
* UPDATED: Tweak smart quote rules to avoid false positive matches when using double quote as inches mark
542+
* UPDATED: Update advanced headers test suite
543+
* UPDATED: Update astyle
544+
* UPDATED: Update astyle settings
545+
* UPDATED: Update char.c
546+
* UPDATED: Update cmake for xcode 11
547+
* UPDATED: Update d_string
548+
* UPDATED: Update macOS deployment version to 10.6 for Mojave
549+
* UPDATED: reduce false-positive rate of metadata where first line contains colon but metadata is not intended
550+
* UPDATED: remove reliance on version.h when testing
551+
* UPDATED: table id attribute should be on table not caption
552+
* Update mmd6-letterhead-leader.tex
553+
* add how to build Xcode framework to README
554+
* remove build folder
555+
* update README with instructions for Xcode
556+
557+
475558
* 2018-09-01 - v 6.4.0:
476559

477560
* ADDED: Add ODF Header metadata and fix issue with LaTeX Header metadata

Sources/libMultiMarkdown/beamer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ void mmd_export_token_beamer(DString * out, const char * source, token * t, scra
193193
d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
194194
scratch->padded = 1;
195195
} else {
196-
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
196+
if (t->child->next) {
197+
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
198+
}
199+
197200
scratch->padded = 0;
198201
}
199202
}

Sources/libMultiMarkdown/html.c

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,10 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
652652
d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
653653
scratch->padded = 1;
654654
} else {
655-
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
655+
if (t->child->next) {
656+
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
657+
}
658+
656659
scratch->padded = 0;
657660
}
658661
}
@@ -1961,21 +1964,25 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
19611964
print_const("\t<td");
19621965
}
19631966

1964-
switch (scratch->table_alignment[scratch->table_cell_count]) {
1965-
case 'l':
1966-
case 'L':
1967-
print_const(" style=\"text-align:left;\"");
1968-
break;
1967+
if (scratch->table_cell_count < kMaxTableColumns) {
1968+
switch (scratch->table_alignment[scratch->table_cell_count]) {
1969+
case 'l':
1970+
case 'L':
1971+
print_const(" style=\"text-align:left;\"");
1972+
break;
19691973

1970-
case 'r':
1971-
case 'R':
1972-
print_const(" style=\"text-align:right;\"");
1973-
break;
1974+
case 'r':
1975+
case 'R':
1976+
print_const(" style=\"text-align:right;\"");
1977+
break;
19741978

1975-
case 'c':
1976-
case 'C':
1977-
print_const(" style=\"text-align:center;\"");
1978-
break;
1979+
case 'c':
1980+
case 'C':
1981+
print_const(" style=\"text-align:center;\"");
1982+
break;
1983+
}
1984+
} else {
1985+
print_const(" style=\"text-align:left;\"");
19791986
}
19801987

19811988
if (t->next && t->next->type == TABLE_DIVIDER) {
@@ -2053,6 +2060,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
20532060
default:
20542061
fprintf(stderr, "Unknown token type: %d (%lu:%lu)\n", t->type, t->start, t->len);
20552062
token_describe(t, source);
2063+
exit(0);
20562064
break;
20572065
}
20582066

Sources/libMultiMarkdown/i18n.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#define H64(s,i,x) H16(s,i,H16(s,i+16,H16(s,i+32,H16(s,i+48,x))))
6060
#define H256(s,i,x) H64(s,i,H64(s,i+64,H64(s,i+128,H64(s,i+192,x))))
6161

62-
#define HASH(s) ((uint32_t)(H256(s,0,0)^(H256(s,0,0)>>16)))
62+
#define HASH(s) ((uint32_t)(H64(s,0,0)^(H64(s,0,0)>>16)))
6363

6464
#define LC(x) Translate(HASH(x), scratch->language)
6565

Sources/libMultiMarkdown/latex.c

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,10 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
573573
d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
574574
scratch->padded = 1;
575575
} else {
576-
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
576+
if (t->child->next) {
577+
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
578+
}
579+
577580
scratch->padded = 0;
578581
}
579582
}
@@ -1891,20 +1894,24 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
18911894
if (t->next->len > 1) {
18921895
printf("\\multicolumn{%lu}{", t->next->len);
18931896

1894-
switch (scratch->table_alignment[scratch->table_cell_count]) {
1895-
case 'l':
1896-
case 'L':
1897-
print_const("l}{");
1898-
break;
1897+
if (scratch->table_cell_count < kMaxTableColumns) {
1898+
switch (scratch->table_alignment[scratch->table_cell_count]) {
1899+
case 'l':
1900+
case 'L':
1901+
print_const("l}{");
1902+
break;
18991903

1900-
case 'r':
1901-
case 'R':
1902-
print_const("r}{");
1903-
break;
1904+
case 'r':
1905+
case 'R':
1906+
print_const("r}{");
1907+
break;
19041908

1905-
default:
1906-
print_const("c}{");
1907-
break;
1909+
default:
1910+
print_const("c}{");
1911+
break;
1912+
}
1913+
} else {
1914+
print_const("l}{");
19081915
}
19091916
}
19101917
}

Sources/libMultiMarkdown/memoir.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ void mmd_export_token_memoir(DString * out, const char * source, token * t, scra
102102
d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
103103
scratch->padded = 1;
104104
} else {
105-
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
105+
if (t->child->next) {
106+
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
107+
}
108+
106109
scratch->padded = 0;
107110
}
108111
}

Sources/libMultiMarkdown/mmd.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) {
11631163
token * remainder; // Hold unparsed tail of chain
11641164

11651165
// Enable to monitor parsing steps
1166-
// ParseTrace(stderr, "parser >>");
1166+
// ParseTrace(stderr, "parser >> ");
11671167

11681168
// Remove existing token tree
11691169
e->root = NULL;
@@ -1282,6 +1282,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
12821282
size_t lead_count, lag_count, pre_count, post_count;
12831283

12841284
token * t = block->child;
1285+
token * new;
12851286

12861287
char * str = e->dstr->str;
12871288

@@ -1331,10 +1332,17 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
13311332

13321333
case CRITIC_SUB_DIV:
13331334
// Divide this into two tokens
1334-
t->child = token_new(CRITIC_SUB_DIV_B, t->start + 1, 1);
1335-
t->child->next = t->next;
1336-
t->next = t->child;
1337-
t->child = NULL;
1335+
new = token_new(CRITIC_SUB_DIV_B, t->start + 1, 1);
1336+
1337+
new->next = t->next;
1338+
1339+
if (new->next) {
1340+
new->next->prev = new;
1341+
}
1342+
1343+
t->next = new;
1344+
new->prev = t;
1345+
13381346
t->len = 1;
13391347
t->type = CRITIC_SUB_DIV_A;
13401348
break;
@@ -1937,16 +1945,13 @@ void strip_line_tokens_from_metadata(mmd_engine * e, token * metadata) {
19371945
case LINE_YAML:
19381946
break;
19391947

1940-
case LINE_TABLE:
1948+
default:
19411949
if (scan_meta_line(&source[l->start])) {
19421950
goto meta;
19431951
} else {
19441952
goto plain;
19451953
}
19461954

1947-
default:
1948-
fprintf(stderr, "ERROR!\n");
1949-
token_describe(l, NULL);
19501955
break;
19511956
}
19521957

@@ -1971,15 +1976,16 @@ void strip_line_tokens_from_deflist(mmd_engine * e, token * deflist) {
19711976
walker->type = TEXT_EMPTY;
19721977
break;
19731978

1974-
case LINE_PLAIN:
1975-
walker->type = BLOCK_TERM;
1976-
19771979
case BLOCK_TERM:
19781980
break;
19791981

19801982
case BLOCK_DEFINITION:
19811983
strip_line_tokens_from_block(e, walker);
19821984
break;
1985+
1986+
default:
1987+
walker->type = BLOCK_TERM;
1988+
19831989
}
19841990

19851991
walker = walker->next;
@@ -2270,9 +2276,15 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt
22702276
// Tokenize the string
22712277
token * doc = mmd_tokenize_string(e, byte_start, byte_len, false);
22722278

2279+
// Describe token chain for debugging purposes
2280+
// token_describe(doc, NULL);
2281+
22732282
// Parse tokens into blocks
22742283
mmd_parse_token_chain(e, doc);
22752284

2285+
// Describe token blocks for debugging purposes
2286+
// token_describe(doc, NULL);
2287+
22762288
if (doc) {
22772289
// Parse blocks for pairs
22782290
mmd_assign_ambidextrous_tokens_in_block(e, doc, 0);

Sources/libMultiMarkdown/opendocument-content.c

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,10 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
799799
d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
800800
scratch->padded = 1;
801801
} else {
802-
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
802+
if (t->child->next) {
803+
d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
804+
}
805+
803806
scratch->padded = 0;
804807
}
805808
}
@@ -2089,22 +2092,26 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
20892092
} else {
20902093
print_const(">\n<text:p");
20912094

2092-
switch (scratch->table_alignment[scratch->table_cell_count]) {
2093-
case 'l':
2094-
case 'L':
2095-
default:
2096-
print_const(" text:style-name=\"MMD-Table\"");
2097-
break;
2098-
2099-
case 'r':
2100-
case 'R':
2101-
print_const(" text:style-name=\"MMD-Table-Right\"");
2102-
break;
2103-
2104-
case 'c':
2105-
case 'C':
2106-
print_const(" text:style-name=\"MMD-Table-Center\"");
2107-
break;
2095+
if (scratch->table_cell_count < kMaxTableColumns) {
2096+
switch (scratch->table_alignment[scratch->table_cell_count]) {
2097+
case 'l':
2098+
case 'L':
2099+
default:
2100+
print_const(" text:style-name=\"MMD-Table\"");
2101+
break;
2102+
2103+
case 'r':
2104+
case 'R':
2105+
print_const(" text:style-name=\"MMD-Table-Right\"");
2106+
break;
2107+
2108+
case 'c':
2109+
case 'C':
2110+
print_const(" text:style-name=\"MMD-Table-Center\"");
2111+
break;
2112+
}
2113+
} else {
2114+
print_const(" text:style-name=\"MMD-Table\"");
21082115
}
21092116
}
21102117

0 commit comments

Comments
 (0)