Update md4c to 0.4.8
Change-Id: Ib0e1ef259696aa380aba0819aa4e1d8a12b4a21d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 1759626cd61fbc765d21ce458cc5d472db087f3e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5671daa487
commit
f9a757ad81
93
src/3rdparty/md4c/md4c.c
vendored
93
src/3rdparty/md4c/md4c.c
vendored
@ -588,7 +588,7 @@ struct MD_UNICODE_FOLD_INFO_tag {
|
|||||||
#define R(cp_min, cp_max) ((cp_min) | 0x40000000), ((cp_max) | 0x80000000)
|
#define R(cp_min, cp_max) ((cp_min) | 0x40000000), ((cp_max) | 0x80000000)
|
||||||
#define S(cp) (cp)
|
#define S(cp) (cp)
|
||||||
/* Unicode "Pc", "Pd", "Pe", "Pf", "Pi", "Po", "Ps" categories.
|
/* Unicode "Pc", "Pd", "Pe", "Pf", "Pi", "Po", "Ps" categories.
|
||||||
* (generated by scripts/build_punct_map.py) */
|
* (generated by scripts/build_folding_map.py) */
|
||||||
static const unsigned FOLD_MAP_1[] = {
|
static const unsigned FOLD_MAP_1[] = {
|
||||||
R(0x0041,0x005a), S(0x00b5), R(0x00c0,0x00d6), R(0x00d8,0x00de), R(0x0100,0x012e), R(0x0132,0x0136),
|
R(0x0041,0x005a), S(0x00b5), R(0x00c0,0x00d6), R(0x00d8,0x00de), R(0x0100,0x012e), R(0x0132,0x0136),
|
||||||
R(0x0139,0x0147), R(0x014a,0x0176), S(0x0178), R(0x0179,0x017d), S(0x017f), S(0x0181), S(0x0182),
|
R(0x0139,0x0147), R(0x014a,0x0176), S(0x0178), R(0x0179,0x017d), S(0x017f), S(0x0181), S(0x0182),
|
||||||
@ -3611,6 +3611,34 @@ md_resolve_links(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
|
|||||||
}
|
}
|
||||||
|
|
||||||
md_analyze_link_contents(ctx, lines, n_lines, opener_index+1, closer_index);
|
md_analyze_link_contents(ctx, lines, n_lines, opener_index+1, closer_index);
|
||||||
|
|
||||||
|
/* If the link text is formed by nothing but permissive autolink,
|
||||||
|
* suppress the autolink.
|
||||||
|
* See https://github.com/mity/md4c/issues/152 for more info. */
|
||||||
|
if(ctx->parser.flags & MD_FLAG_PERMISSIVEAUTOLINKS) {
|
||||||
|
MD_MARK* first_nested;
|
||||||
|
MD_MARK* last_nested;
|
||||||
|
|
||||||
|
first_nested = opener + 1;
|
||||||
|
while(first_nested->ch == _T('D') && first_nested < closer)
|
||||||
|
first_nested++;
|
||||||
|
|
||||||
|
last_nested = closer - 1;
|
||||||
|
while(first_nested->ch == _T('D') && last_nested > opener)
|
||||||
|
last_nested--;
|
||||||
|
|
||||||
|
if((first_nested->flags & MD_MARK_RESOLVED) &&
|
||||||
|
first_nested->beg == opener->end &&
|
||||||
|
ISANYOF_(first_nested->ch, _T("@:.")) &&
|
||||||
|
first_nested->next == (last_nested - ctx->marks) &&
|
||||||
|
last_nested->end == closer->beg)
|
||||||
|
{
|
||||||
|
first_nested->ch = _T('D');
|
||||||
|
first_nested->flags &= ~MD_MARK_RESOLVED;
|
||||||
|
last_nested->ch = _T('D');
|
||||||
|
last_nested->flags &= ~MD_MARK_RESOLVED;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opener_index = next_index;
|
opener_index = next_index;
|
||||||
@ -5525,7 +5553,7 @@ md_push_container(MD_CTX* ctx, const MD_CONTAINER* container)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
md_enter_child_containers(MD_CTX* ctx, int n_children, unsigned data)
|
md_enter_child_containers(MD_CTX* ctx, int n_children)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -5550,7 +5578,7 @@ md_enter_child_containers(MD_CTX* ctx, int n_children, unsigned data)
|
|||||||
|
|
||||||
MD_CHECK(md_push_container_bytes(ctx,
|
MD_CHECK(md_push_container_bytes(ctx,
|
||||||
(is_ordered_list ? MD_BLOCK_OL : MD_BLOCK_UL),
|
(is_ordered_list ? MD_BLOCK_OL : MD_BLOCK_UL),
|
||||||
c->start, data, MD_BLOCK_CONTAINER_OPENER));
|
c->start, c->ch, MD_BLOCK_CONTAINER_OPENER));
|
||||||
MD_CHECK(md_push_container_bytes(ctx, MD_BLOCK_LI,
|
MD_CHECK(md_push_container_bytes(ctx, MD_BLOCK_LI,
|
||||||
c->task_mark_off,
|
c->task_mark_off,
|
||||||
(c->is_task ? CH(c->task_mark_off) : 0),
|
(c->is_task ? CH(c->task_mark_off) : 0),
|
||||||
@ -5779,25 +5807,30 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
|
|
||||||
/* Check whether we are HTML block continuation. */
|
/* Check whether we are HTML block continuation. */
|
||||||
if(pivot_line->type == MD_LINE_HTML && ctx->html_block_type > 0) {
|
if(pivot_line->type == MD_LINE_HTML && ctx->html_block_type > 0) {
|
||||||
int html_block_type;
|
if(n_parents < ctx->n_containers) {
|
||||||
|
/* HTML block is implicitly ended if the enclosing container
|
||||||
html_block_type = md_is_html_block_end_condition(ctx, off, &off);
|
* block ends. */
|
||||||
if(html_block_type > 0) {
|
|
||||||
MD_ASSERT(html_block_type == ctx->html_block_type);
|
|
||||||
|
|
||||||
/* Make sure this is the last line of the block. */
|
|
||||||
ctx->html_block_type = 0;
|
ctx->html_block_type = 0;
|
||||||
|
} else {
|
||||||
|
int html_block_type;
|
||||||
|
|
||||||
/* Some end conditions serve as blank lines at the same time. */
|
html_block_type = md_is_html_block_end_condition(ctx, off, &off);
|
||||||
if(html_block_type == 6 || html_block_type == 7) {
|
if(html_block_type > 0) {
|
||||||
line->type = MD_LINE_BLANK;
|
MD_ASSERT(html_block_type == ctx->html_block_type);
|
||||||
line->indent = 0;
|
|
||||||
break;
|
/* Make sure this is the last line of the block. */
|
||||||
|
ctx->html_block_type = 0;
|
||||||
|
|
||||||
|
/* Some end conditions serve as blank lines at the same time. */
|
||||||
|
if(html_block_type == 6 || html_block_type == 7) {
|
||||||
|
line->type = MD_LINE_BLANK;
|
||||||
|
line->indent = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(n_parents == ctx->n_containers) {
|
|
||||||
line->type = MD_LINE_HTML;
|
line->type = MD_LINE_HTML;
|
||||||
|
n_parents = ctx->n_containers;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5864,7 +5897,7 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
|
|
||||||
/* Check whether we are Setext underline. */
|
/* Check whether we are Setext underline. */
|
||||||
if(line->indent < ctx->code_indent_offset && pivot_line->type == MD_LINE_TEXT
|
if(line->indent < ctx->code_indent_offset && pivot_line->type == MD_LINE_TEXT
|
||||||
&& (CH(off) == _T('=') || CH(off) == _T('-'))
|
&& off < ctx->size && ISANYOF2(off, _T('='), _T('-'))
|
||||||
&& (n_parents == ctx->n_containers))
|
&& (n_parents == ctx->n_containers))
|
||||||
{
|
{
|
||||||
unsigned level;
|
unsigned level;
|
||||||
@ -5877,7 +5910,10 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for thematic break line. */
|
/* Check for thematic break line. */
|
||||||
if(line->indent < ctx->code_indent_offset && ISANYOF(off, _T("-_*")) && off >= hr_killer) {
|
if(line->indent < ctx->code_indent_offset
|
||||||
|
&& off < ctx->size && off >= hr_killer
|
||||||
|
&& ISANYOF(off, _T("-_*")))
|
||||||
|
{
|
||||||
if(md_is_hr_line(ctx, off, &off, &hr_killer)) {
|
if(md_is_hr_line(ctx, off, &off, &hr_killer)) {
|
||||||
line->type = MD_LINE_HR;
|
line->type = MD_LINE_HR;
|
||||||
break;
|
break;
|
||||||
@ -5941,7 +5977,7 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
{
|
{
|
||||||
/* Noop. List mark followed by a blank line cannot interrupt a paragraph. */
|
/* Noop. List mark followed by a blank line cannot interrupt a paragraph. */
|
||||||
} else if(pivot_line->type == MD_LINE_TEXT && n_parents == ctx->n_containers &&
|
} else if(pivot_line->type == MD_LINE_TEXT && n_parents == ctx->n_containers &&
|
||||||
(container.ch == _T('.') || container.ch == _T(')')) && container.start != 1)
|
ISANYOF2_(container.ch, _T('.'), _T(')')) && container.start != 1)
|
||||||
{
|
{
|
||||||
/* Noop. Ordered list cannot interrupt a paragraph unless the start index is 1. */
|
/* Noop. Ordered list cannot interrupt a paragraph unless the start index is 1. */
|
||||||
} else {
|
} else {
|
||||||
@ -5982,7 +6018,9 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for ATX header. */
|
/* Check for ATX header. */
|
||||||
if(line->indent < ctx->code_indent_offset && CH(off) == _T('#')) {
|
if(line->indent < ctx->code_indent_offset &&
|
||||||
|
off < ctx->size && CH(off) == _T('#'))
|
||||||
|
{
|
||||||
unsigned level;
|
unsigned level;
|
||||||
|
|
||||||
if(md_is_atxheader_line(ctx, off, &line->beg, &off, &level)) {
|
if(md_is_atxheader_line(ctx, off, &line->beg, &off, &level)) {
|
||||||
@ -5993,7 +6031,7 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether we are starting code fence. */
|
/* Check whether we are starting code fence. */
|
||||||
if(CH(off) == _T('`') || CH(off) == _T('~')) {
|
if(off < ctx->size && ISANYOF2(off, _T('`'), _T('~'))) {
|
||||||
if(md_is_opening_code_fence(ctx, off, &off)) {
|
if(md_is_opening_code_fence(ctx, off, &off)) {
|
||||||
line->type = MD_LINE_FENCEDCODE;
|
line->type = MD_LINE_FENCEDCODE;
|
||||||
line->data = 1;
|
line->data = 1;
|
||||||
@ -6002,7 +6040,8 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for start of raw HTML block. */
|
/* Check for start of raw HTML block. */
|
||||||
if(CH(off) == _T('<') && !(ctx->parser.flags & MD_FLAG_NOHTMLBLOCKS))
|
if(off < ctx->size && CH(off) == _T('<')
|
||||||
|
&& !(ctx->parser.flags & MD_FLAG_NOHTMLBLOCKS))
|
||||||
{
|
{
|
||||||
ctx->html_block_type = md_is_html_block_start_condition(ctx, off);
|
ctx->html_block_type = md_is_html_block_start_condition(ctx, off);
|
||||||
|
|
||||||
@ -6023,9 +6062,9 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for table underline. */
|
/* Check for table underline. */
|
||||||
if((ctx->parser.flags & MD_FLAG_TABLES) && pivot_line->type == MD_LINE_TEXT &&
|
if((ctx->parser.flags & MD_FLAG_TABLES) && pivot_line->type == MD_LINE_TEXT
|
||||||
(CH(off) == _T('|') || CH(off) == _T('-') || CH(off) == _T(':')) &&
|
&& off < ctx->size && ISANYOF3(off, _T('|'), _T('-'), _T(':'))
|
||||||
n_parents == ctx->n_containers)
|
&& n_parents == ctx->n_containers)
|
||||||
{
|
{
|
||||||
unsigned col_count;
|
unsigned col_count;
|
||||||
|
|
||||||
@ -6157,7 +6196,7 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(n_children > 0)
|
if(n_children > 0)
|
||||||
MD_CHECK(md_enter_child_containers(ctx, n_children, line->data));
|
MD_CHECK(md_enter_child_containers(ctx, n_children));
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
return ret;
|
return ret;
|
||||||
|
4
src/3rdparty/md4c/qt_attribution.json
vendored
4
src/3rdparty/md4c/qt_attribution.json
vendored
@ -9,7 +9,7 @@
|
|||||||
"License": "MIT License",
|
"License": "MIT License",
|
||||||
"LicenseId": "MIT",
|
"LicenseId": "MIT",
|
||||||
"LicenseFile": "LICENSE.md",
|
"LicenseFile": "LICENSE.md",
|
||||||
"Version": "0.4.7",
|
"Version": "0.4.8",
|
||||||
"DownloadLocation": "https://github.com/mity/md4c/releases/tag/release-0.4.7",
|
"DownloadLocation": "https://github.com/mity/md4c/releases/tag/release-0.4.8",
|
||||||
"Copyright": "Copyright © 2016-2020 Martin Mitáš"
|
"Copyright": "Copyright © 2016-2020 Martin Mitáš"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user