Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package discount for openSUSE:Factory checked in at 2025-05-13 20:12:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/discount (Old) and /work/SRC/openSUSE:Factory/.discount.new.30101 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "discount" Tue May 13 20:12:28 2025 rev:16 rq:1276799 version:3.0.0d Changes: -------- --- /work/SRC/openSUSE:Factory/discount/discount.changes 2023-03-30 22:50:36.664364172 +0200 +++ /work/SRC/openSUSE:Factory/.discount.new.30101/discount.changes 2025-05-13 20:12:49.689367674 +0200 @@ -1,0 +2,21 @@ +Sun May 11 14:51:16 UTC 2025 - Atri Bhattacharya <badshah...@gmail.com> + +- Update to version 3.0.0d: + * Add the new runtime flag ALT_AS_TITLE; if an image has no + title, use the alt text as the title. + * Fix some brokenness in markdown extra footnotes that made + adjacent footnotes not render properly. + * Fix a handful of places which didn't guard against underflows + or null pointers; add test cases for them in crash.t. + * Update the callback creation functions to use the proper + arguments. + * Left an argument out of main.c's memory deallocator callback. + * Fix a bug in tab expansion. + * Replace an include of strings.h with string.h. + * Allow multiple classes for >% blocks. + * Add the --container config option so a ldconfig won't be + installed into librarian.sh. +- Re-base discount-disable_ldconfig.patch for update. +- make: Use multiple threads for tests and install. + +------------------------------------------------------------------- Old: ---- discount-3.0.0a.tar.gz New: ---- discount-3.0.0d.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ discount.spec ++++++ --- /var/tmp/diff_new_pack.DMlTQ0/_old 2025-05-13 20:12:50.341395041 +0200 +++ /var/tmp/diff_new_pack.DMlTQ0/_new 2025-05-13 20:12:50.345395208 +0200 @@ -1,7 +1,7 @@ # # spec file for package discount # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define sover 3 %bcond_with fenced_code Name: discount -Version: 3.0.0a +Version: 3.0.0d Release: 0 Summary: Markdown text to HTML converter License: BSD-3-Clause @@ -30,8 +30,8 @@ BuildRequires: fdupes BuildRequires: pkgconfig Provides: markdown -Requires(preun):update-alternatives -Requires(postun):update-alternatives +Requires(preun): update-alternatives +Requires(postun): update-alternatives %description Discount is an implementation of John Gruber’s Markdown text to HTML language @@ -76,11 +76,8 @@ --enable-all-features %make_build -%check -make test - %install -make DESTDIR=%{buildroot} install.everything +%make_build DESTDIR=%{buildroot} install.everything %fdupes -s %{buildroot}%{_mandir}/man3 install -D -p -m 0644 libmarkdown.pc \ @@ -92,6 +89,9 @@ touch %{buildroot}%{_sysconfdir}/alternatives/markdown ln -sf %{_sysconfdir}/alternatives/markdown %{buildroot}%{_bindir}/markdown +%check +%make_build test + %post update-alternatives \ --install %{_bindir}/markdown markdown %{_bindir}/discount-markdown 20 @@ -101,8 +101,7 @@ update-alternatives --remove markdown %{_bindir}/discount-markdown fi -%post -n libmarkdown%{sover} -p /sbin/ldconfig -%postun -n libmarkdown%{sover} -p /sbin/ldconfig +%ldconfig_scriptlets -n libmarkdown%{sover} %files %license COPYRIGHT ++++++ discount-3.0.0a.tar.gz -> discount-3.0.0d.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/Makefile.in new/discount-3.0.0d/Makefile.in --- old/discount-3.0.0a/Makefile.in 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/Makefile.in 2024-02-07 07:01:05.000000000 +0100 @@ -30,7 +30,7 @@ xml.o Csio.o xmlpage.o basename.o emmatch.o \ github_flavoured.o setup.o tags.o html5.o \ @AMALLOC@ @H1TITLE@ flags.o v2compat.o flagprocs.o -TESTFRAMEWORK=echo cols branch pandoc_headers space2nl +TESTFRAMEWORK=rep echo cols branch pandoc_headers space2nl # modules that markdown, makepage, mkd2html, &tc use COMMON=pgm_options.o gethopt.o notspecial.o @@ -146,6 +146,11 @@ pandoc_headers: pandoc_headers.o $(COMMON) $(MKDLIB) $(LINK) -o pandoc_headers pandoc_headers.o $(COMMON) -lmarkdown +rep.o : tools/rep.c + $(BUILD) -c -o rep.o tools/rep.c +rep: rep.o + $(LINK) -o rep rep.o + branch.o: tools/branch.c config.h $(BUILD) -c -o branch.o tools/branch.c branch: branch.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/VERSION new/discount-3.0.0d/VERSION --- old/discount-3.0.0a/VERSION 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/VERSION 2024-02-07 07:01:05.000000000 +0100 @@ -1 +1 @@ -3.0.0a +3.0.0d diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/basename.c new/discount-3.0.0d/basename.c --- old/discount-3.0.0a/basename.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/basename.c 2024-02-07 07:01:05.000000000 +0100 @@ -19,8 +19,8 @@ { char *ret; char *base = (char*)context; - - if ( base && string && (*string == '/') && (ret=malloc(strlen(base)+size+2)) ) { + + if ( base && string && (ret=malloc(strlen(base)+size+2)) ) { strcpy(ret, base); strncat(ret, string, size); return ret; @@ -29,15 +29,14 @@ } static void -e_free(char *string, void *context) +basename_free(char *p, int len, void *ctx) { - if ( string ) free(string); + if ( p ) free(p); } void mkd_basename(MMIOT *document, char *base) { - mkd_e_url(document, e_basename); - mkd_e_data(document, base); - mkd_e_free(document, e_free); + if ( document && base ) + mkd_e_url(document, e_basename, (mkd_free_t)basename_free, base); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/configure.inc new/discount-3.0.0d/configure.inc --- old/discount-3.0.0a/configure.inc 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/configure.inc 2024-02-07 07:01:05.000000000 +0100 @@ -540,7 +540,7 @@ # and fd 5 points to what used to be fd 1 # AC_INIT () { - __config_files="config.cmd config.sub config.h config.mak" + __config_files="config.cmd config.sub config.h config.mak config.sed" rm -f $__config_files __cwd=`pwd` exec 5>&1 1>"$__cwd"/config.log 2>&1 @@ -1501,7 +1501,10 @@ $PROG_LN_S -f \$FULLNAME \$1/\$LIBNAME.\$MAJOR $PROG_LN_S -f \$FULLNAME \$1/\$LIBNAME EOF - test "$LDCONFIG" && echo ' '$LDCONFIG '"$1"' >> librarian.sh + if [ "$LDCONFIG" -a -z "$CONTAINER" ]; then + echo ' '$LDCONFIG '"$1"' >> librarian.sh + fi + cat >> librarian.sh << EOF ;; esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/configure.sh new/discount-3.0.0d/configure.sh --- old/discount-3.0.0a/configure.sh 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/configure.sh 2024-02-07 07:01:05.000000000 +0100 @@ -10,6 +10,7 @@ ac_help='--enable-amalloc Enable memory allocation debugging --with-tabstops=N Set tabstops to N characters (default is 4) --shared Build shared libraries (default is static) +--container Build inside a container --pkg-config Install pkg-config(1) glue files --cxx-binding Install header files with c++ wrappers --github-checkbox[=input] Enable github-style checkboxes in lists @@ -36,6 +37,9 @@ --DEBIAN-GLITCH) echo DEBIAN_GLITCH=T ;; + --CONTAINER) + echo CONTAINER=T + ;; --H1-TITLE) echo H1TITLE=T ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/dumptree.c new/discount-3.0.0d/dumptree.c --- old/discount-3.0.0a/dumptree.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/dumptree.c 2024-02-07 07:01:05.000000000 +0100 @@ -60,12 +60,12 @@ { char ch; - if ( !S(*sp) ) return; + if ( S(*sp) > 0 ) { + ch = T(*sp)[S(*sp)-1].c; - ch = T(*sp)[S(*sp)-1].c; - - if ( ch == '+' || ch == '|' ) - T(*sp)[S(*sp)-1].c = c; + if ( ch == '+' || ch == '|' ) + T(*sp)[S(*sp)-1].c = c; + } } @@ -75,23 +75,23 @@ int i; char c; - if ( !S(*sp) ) return; + if ( S(*sp) > 0 ) { + c = T(*sp)[S(*sp)-1].c; - c = T(*sp)[S(*sp)-1].c; - - if ( c == '+' || c == '-' ) { - fprintf(f, "--%c", c); - T(*sp)[S(*sp)-1].c = (c == '-') ? ' ' : '|'; - } - else - for ( i=0; i < S(*sp); i++ ) { - if ( i ) - fprintf(f, " "); - fprintf(f, "%*s%c", T(*sp)[i].indent + 2, " ", T(*sp)[i].c); - if ( T(*sp)[i].c == '`' ) - T(*sp)[i].c = ' '; + if ( c == '+' || c == '-' ) { + fprintf(f, "--%c", c); + T(*sp)[S(*sp)-1].c = (c == '-') ? ' ' : '|'; } - fprintf(f, "--"); + else + for ( i=0; i < S(*sp); i++ ) { + if ( i ) + fprintf(f, " "); + fprintf(f, "%*s%c", T(*sp)[i].indent + 2, " ", T(*sp)[i].c); + if ( T(*sp)[i].c == '`' ) + T(*sp)[i].c = ' '; + } + fprintf(f, "--"); + } } @@ -117,7 +117,7 @@ if ( pp->para_flags ) d += fprintf(f, " %x", pp->para_flags); - + if ( pp->align > 1 ) d += fprintf(f, ", <%s>", Begin[pp->align]); @@ -127,6 +127,11 @@ if ( count ) d += fprintf(f, ", %d line%s", count, (count==1)?"":"s"); +#if EXTENDED_DEBUG + if ( pp->text && T(pp->text->text) ) + d += fprintf(f, " <%.*s>", S(pp->text->text), T(pp->text->text)); +#endif + d += fprintf(f, "]"); if ( pp->down ) { @@ -145,7 +150,7 @@ { Stack stack; - if (mkd_compile(doc, flags) ) { + if ( mkd_compile(doc, flags) && doc->code ) { CREATE(stack); pushpfx(fprintf(out, "%s", title), doc->code->next ? '+' : '-', &stack); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/emmatch.c new/discount-3.0.0d/emmatch.c --- old/discount-3.0.0a/emmatch.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/emmatch.c 2024-02-07 07:01:05.000000000 +0100 @@ -172,17 +172,18 @@ int i; block *p; - emblock(f, 0, S(f->Q)-1); + if ( S(f->Q) > 0 ) { + emblock(f, 0, S(f->Q)-1); - for (i=0; i < S(f->Q); i++) { - p = &T(f->Q)[i]; - emfill(p); - - if ( S(p->b_post) ) { SUFFIX(f->out, T(p->b_post), S(p->b_post)); - DELETE(p->b_post); } - if ( S(p->b_text) ) { SUFFIX(f->out, T(p->b_text), S(p->b_text)); - DELETE(p->b_text); } + for (i=0; i < S(f->Q); i++) { + p = &T(f->Q)[i]; + emfill(p); + + if ( S(p->b_post) ) { SUFFIX(f->out, T(p->b_post), S(p->b_post)); + DELETE(p->b_post); } + if ( S(p->b_text) ) { SUFFIX(f->out, T(p->b_text), S(p->b_text)); + DELETE(p->b_text); } + } + S(f->Q) = 0; } - - S(f->Q) = 0; } /* ___mkd_emblock */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/flags.c new/discount-3.0.0d/flags.c --- old/discount-3.0.0a/flags.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/flags.c 2024-02-07 07:01:05.000000000 +0100 @@ -37,6 +37,7 @@ { MKD_URLENCODEDANCHOR, "URLENCODEDANCHOR" }, { MKD_LATEX, "LATEX" }, { MKD_EXPLICITLIST, "EXPLICITLIST" }, + { MKD_ALT_AS_TITLE, "ALT_AS_TITLE" }, }; #define NR(x) (sizeof x/sizeof x[0]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/generate.c new/discount-3.0.0d/generate.c --- old/discount-3.0.0a/generate.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/generate.c 2024-02-07 07:01:05.000000000 +0100 @@ -132,13 +132,13 @@ { block *cur; - if ( S(f->Q) == 0 ) { + if ( S(f->Q) > 0 ) + cur = &T(f->Q)[S(f->Q)-1]; + else { cur = &EXPAND(f->Q); memset(cur, 0, sizeof *cur); cur->b_type = bTEXT; } - else - cur = &T(f->Q)[S(f->Q)-1]; EXPAND(cur->b_text) = c; @@ -504,7 +504,7 @@ ___mkd_tidy(&p->link); - if ( mayneedtotrim && (T(p->link)[S(p->link)-1] == '>') ) + if ( mayneedtotrim && (S(p->link) > 0) && (T(p->link)[S(p->link)-1] == '>') ) --S(p->link); return 1; @@ -559,7 +559,9 @@ } linkytype; static linkytype imaget = { 0, 0, "<img src=\"", "\"", - 1, " alt=\"", "\" />", { { [MKD_NOIMAGE] = 1, [MKD_TAGTEXT] = 1} }, IS_URL }; + 1, " alt=\"", "\" />", { { [MKD_NOIMAGE] = 1, + [MKD_TAGTEXT] = 1, + [MKD_ALT_AS_TITLE] = 1 } }, IS_URL }; static linkytype linkt = { 0, 0, "<a href=\"", "\"", 0, ">", "</a>", { {[MKD_NOLINKS] = 1} }, IS_URL }; @@ -609,10 +611,10 @@ Qstring(tag->link_pfx, f); if ( tag->kind & IS_URL ) { - if ( f->cb && f->cb->e_url && (edit = (*f->cb->e_url)(link, size, f->cb->e_data)) ) { - + if ( f->cb && f->cb->e_url.func && (edit = (*f->cb->e_url.func)(link, size, f->cb->e_url.data)) ) { puturl(edit, strlen(edit), f, 0); - if ( f->cb->e_free ) (*f->cb->e_free)(edit, f->cb->e_data); + if ( f->cb->e_url.free ) + (*f->cb->e_url.free)(edit, strlen(edit), f); } else puturl(link + tag->szpat, size - tag->szpat, f, 0); @@ -626,10 +628,11 @@ Qstring(tag->link_sfx, f); - if ( f->cb && f->cb->e_flags && (edit = (*f->cb->e_flags)(link, size, f->cb->e_data)) ) { + if ( f->cb && f->cb->e_flags.func && (edit = (*f->cb->e_flags.func)(link, size, f->cb->e_flags.data)) ) { Qchar(' ', f); Qstring(edit, f); - if ( f->cb->e_free ) (*f->cb->e_free)(edit, f->cb->e_data); + if ( f->cb->e_flags.free ) + (*f->cb->e_flags.free) (edit, strlen(edit), f); } } /* printlinkyref */ @@ -652,7 +655,7 @@ if ( ref->fn_flags & REFERENCED ) return 0; - if ( is_flag_set(&f->flags,IS_LABEL) ) + if ( is_flag_set(&f->flags, IS_LABEL) ) ___mkd_reparse(T(text), S(text), &(linkt.flags), f, 0); else { ref->fn_flags |= REFERENCED; @@ -728,9 +731,12 @@ if ( ref->width ) Qprintf(f, " width=\"%d\"", ref->width); } - if ( S(ref->title) ) { + if ( S(ref->title) || (is_flag_set(&f->flags, MKD_ALT_AS_TITLE) && is_flag_set(&tag->flags, MKD_ALT_AS_TITLE)) ) { Qstring(" title=\"", f); - ___mkd_reparse(T(ref->title), S(ref->title), &tagtext, f, 0); + if ( S(ref->title) ) + ___mkd_reparse(T(ref->title), S(ref->title), &tagtext, f, 0); + else + ___mkd_reparse(T(text), S(text), &tagtext, f, 0); Qchar('"', f); } @@ -770,26 +776,29 @@ else { int goodlink, implicit_mark = mmiottell(f); - if ( isspace(peek(f,1)) ) - pull(f); - - if ( peek(f,1) == '[' ) { - pull(f); /* consume leading '[' */ - goodlink = linkylabel(f, &key.tag); + if ( is_flag_set(&f->flags, MKD_EXTRA_FOOTNOTE) + && !is_flag_set(&f->flags, MKD_STRICT) + && (!image) + && S(name) + && T(name)[0] == '^' ) { + extra_footnote = 1; + goodlink = 1; } else { - /* new markdown implicit name syntax doesn't - * require a second [] - */ - mmiotseek(f, implicit_mark); - goodlink = !is_flag_set(&f->flags, MKD_1_COMPAT); - - if ( is_flag_set(&f->flags, MKD_EXTRA_FOOTNOTE) - && !is_flag_set(&f->flags, MKD_STRICT) - && (!image) - && S(name) - && T(name)[0] == '^' ) - extra_footnote = 1; + if ( isspace(peek(f,1)) ) + pull(f); + + if ( peek(f,1) == '[' ) { + pull(f); /* consume leading '[' */ + goodlink = linkylabel(f, &key.tag); + } + else { + /* new markdown implicit name syntax doesn't + * require a second [] + */ + mmiotseek(f, implicit_mark); + goodlink = !is_flag_set(&f->flags, MKD_1_COMPAT); + } } if ( goodlink ) { @@ -977,19 +986,20 @@ maybe_address(char *p, int size) { int ok = 0; + char *q = p; - for ( ;size && (isalnum(*p) || strchr("._-+*", *p)); ++p, --size) + for ( ;size && (isalnum(*q) || strchr("._-+*", *q)); ++q, --size) ; - if ( ! (size && *p == '@') ) + if ( ! (size && q > p && *q == '@') ) return 0; - --size, ++p; + --size, ++q; - if ( size && *p == '.' ) return 0; + if ( size && *q == '.' ) return 0; - for ( ;size && (isalnum(*p) || strchr("._-+", *p)); ++p, --size ) - if ( *p == '.' && size > 1 ) ok = 1; + for ( ;size && (isalnum(*q) || strchr("._-+", *q)); ++q, --size ) + if ( *q == '.' && size > 1 ) ok = 1; return size ? 0 : ok; } @@ -1596,7 +1606,7 @@ ___mkd_tidy(&p->text); - if ( T(p->text)[S(p->text)-1] == '|' ) + if ( S(p->text) > 0 && (T(p->text)[S(p->text)-1] == '|') ) --S(p->text); Qstring("<tr>\n", f); @@ -1702,7 +1712,7 @@ static int code_callback(Line *t, char *lang, int fenced, Line **ret, MMIOT *f) { - if ( f->cb->e_codefmt ) { + if ( f && f->cb->e_codefmt.func ) { /* external code block formatter; copy the text into a buffer, * call the formatter to style it, then dump that styled text * directly to the queue @@ -1725,14 +1735,13 @@ text[copy_p] = 0; - fmt = (*(f->cb->e_codefmt))(text, copy_p, (lang && lang[0]) ? lang : 0); + fmt = (*(f->cb->e_codefmt.func))(text, copy_p, (lang && lang[0]) ? lang : 0); free(text); if ( fmt ) { Qwrite(fmt, strlen(fmt), f); - if ( f->cb->e_free ) - (*(f->cb->e_free))(fmt, f->cb->e_data); *ret = t; + if ( f->cb->e_codefmt.free ) (*f->cb->e_codefmt.free)(fmt, strlen(fmt), f); return 1; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/main.c new/discount-3.0.0d/main.c --- old/discount-3.0.0a/main.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/main.c 2024-02-07 07:01:05.000000000 +0100 @@ -61,6 +61,14 @@ } +void +callback_free(char *input, int size, void *ctx) +{ + if (input) + free(input); +} + + char * anchor_format(char *input, void *ctx) { @@ -92,14 +100,6 @@ return ret; } -void -free_it(char *object, void *ctx) -{ - if ( object ) - free(object); -} - - char *external_formatter = 0; @@ -236,7 +236,7 @@ break; case 'b': urlbase = hoptarg(&blob); break; - case 'd': debug = 1; + case 'd': debug++; break; case 'V': version++; break; @@ -346,24 +346,23 @@ } if ( urlbase ) mkd_basename(doc, urlbase); - if ( urlflags ) { - mkd_e_data(doc, urlflags); - mkd_e_flags(doc, e_flags); - } + + if ( urlflags ) + mkd_e_flags(doc, e_flags, NULL, urlflags); + if ( squash ) - mkd_e_anchor(doc, (mkd_callback_t) anchor_format); + mkd_e_anchor(doc, (mkd_callback_t) anchor_format, callback_free, 0); if ( use_e_codefmt ) - mkd_e_code_format(doc, (mkd_callback_t)external_codefmt); + mkd_e_code_format(doc, (mkd_callback_t)external_codefmt, callback_free, 0); - if ( use_e_codefmt || squash ) - mkd_e_free(doc, free_it); if ( extra_footnote_prefix ) mkd_ref_prefix(doc, extra_footnote_prefix); - if ( debug ) + if ( debug ) { rc = mkd_dump(doc, stdout, flags, argc ? basename(argv[0]) : "stdin"); + } else { rc = 1; if ( mkd_compile(doc, flags) ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/markdown.c new/discount-3.0.0d/markdown.c --- old/discount-3.0.0a/markdown.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/markdown.c 2024-02-07 07:01:05.000000000 +0100 @@ -578,16 +578,21 @@ * the leading and trailing `#`'s */ - for (i=0; (T(p->text)[i] == T(p->text)[0]) && (i < S(p->text)-1) - && (i < 6); i++) + for (i=0; (T(p->text)[i] == T(p->text)[0]) && (i < S(p->text)-1); i++) ; - pp->hnumber = i; + pp->hnumber = (i > 6) ? 6 : i;; while ( (i < S(p->text)) && isspace(T(p->text)[i]) ) ++i; CLIP(p->text, 0, i); + + for (i=S(p->text); (i > 0) && isspace(T(p->text)[i-1]); --i) + ; + S(p->text) = i; + T(p->text)[i] = 0; + UNCHECK(p); for (j=S(p->text); (j > 1) && (T(p->text)[j-1] == '#'); --j) @@ -596,7 +601,10 @@ while ( j && isspace(T(p->text)[j-1]) ) --j; - S(p->text) = j; + if ( j < S(p->text) ) { + T(p->text)[j] = 0; + S(p->text) = j; + } ret = p->next; p->next = 0; @@ -764,7 +772,8 @@ * check if the first line of a quoted block is the special div-not-quote * marker %[kind:]name% */ -#define iscsschar(c) (isalpha(c) || (c == '-') || (c == '_') ) + +#define iscsschar(c) (isalpha(c) || (c == '-') || (c == '_') || (c == ' ') ) static int isdivmarker(Line *p, int start, mkd_flag_t *flags) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/markdown.h new/discount-3.0.0d/markdown.h --- old/discount-3.0.0a/markdown.h 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/markdown.h 2024-02-07 07:01:05.000000000 +0100 @@ -43,6 +43,7 @@ MKD_GITHUBTAGS, /* allow dash and underscore in element names */ MKD_URLENCODEDANCHOR, /* urlencode non-identifier chars instead of replacing with dots */ MKD_LATEX, /* handle embedded LaTeX escapes */ + MKD_ALT_AS_TITLE, /* use alt text as the title if no title is listed */ /* end of user flags */ IS_LABEL, MKD_NR_FLAGS }; @@ -145,13 +146,17 @@ typedef char* (*mkd_callback_t)(const char*, const int, void*); typedef void (*mkd_free_t)(char*, void*); -typedef struct callback_data { - void *e_data; /* private data for callbacks */ - mkd_callback_t e_url; /* url edit callback */ - mkd_callback_t e_flags; /* extra href flags callback */ - mkd_callback_t e_anchor; /* callback for anchor types */ - mkd_free_t e_free; /* edit/flags callback memory deallocator */ - mkd_callback_t e_codefmt; /* codeblock formatter (for highlighting) */ +typedef struct { + mkd_callback_t func, free; + void *data; +} One_callback; + + +typedef struct { + One_callback e_url; /* url edit callback */ + One_callback e_flags; /* extra href flags callback */ + One_callback e_anchor; /* callback for anchor types */ + One_callback e_codefmt; /* codeblock formatter (for highlighting) */ } Callback_data; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/mkdio.c new/discount-3.0.0d/mkdio.c --- old/discount-3.0.0a/mkdio.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/mkdio.c 2024-02-07 07:01:05.000000000 +0100 @@ -295,25 +295,22 @@ if ( !line ) return; - if ( f->cb->e_anchor ) - res = (*(f->cb->e_anchor))(line, size, f->cb->e_data); + if ( f->cb->e_anchor.func ) + res = (*(f->cb->e_anchor.func))(line, size, f->cb->e_anchor.data); else res = mkd_anchor_format(line, size, labelformat, &(f->flags)); free(line); - if ( !res ) - return; - - for ( i=0; res[i]; i++ ) - (*outchar)(res[i], out); - - if ( f->cb->e_anchor ) { - if ( f->cb->e_free ) - (*(f->cb->e_free))(res, f->cb->e_data); + if ( res ) { + for ( i=0; res[i]; i++ ) + (*outchar)(res[i], out); + + if ( f->cb->e_anchor.free ) + (*f->cb->e_anchor.free)(res, i, f); + else + free(res); } - else - free(res); } @@ -383,12 +380,14 @@ /* set the url display callback */ void -mkd_e_url(Document *f, mkd_callback_t edit) +mkd_e_url(Document *f, mkd_callback_t edit, mkd_callback_t free, void *data) { if ( f ) { - if ( f->cb.e_url != edit ) + if ( f->cb.e_url.func != edit ) f->dirty = 1; - f->cb.e_url = edit; + f->cb.e_url.func = edit; + f->cb.e_url.data = data; + f->cb.e_url.free = free; } } @@ -396,12 +395,14 @@ /* set the url options callback */ void -mkd_e_flags(Document *f, mkd_callback_t edit) +mkd_e_flags(Document *f, mkd_callback_t edit, mkd_callback_t free, void *data) { if ( f ) { - if ( f->cb.e_flags != edit ) + if ( f->cb.e_flags.func != edit ) f->dirty = 1; - f->cb.e_flags = edit; + f->cb.e_flags.func = edit; + f->cb.e_flags.free = free; + f->cb.e_flags.data = data; } } @@ -409,38 +410,14 @@ /* set the anchor formatter */ void -mkd_e_anchor(Document *f, mkd_callback_t format) -{ - if ( f ) { - if ( f->cb.e_anchor != format ) - f->dirty = 1; - f->cb.e_anchor = format; - } -} - - -/* set the url display/options deallocator - */ -void -mkd_e_free(Document *f, mkd_free_t dealloc) -{ - if ( f ) { - if ( f->cb.e_free != dealloc ) - f->dirty = 1; - f->cb.e_free = dealloc; - } -} - - -/* set the url display/options context data field - */ -void -mkd_e_data(Document *f, void *data) +mkd_e_anchor(Document *f, mkd_callback_t format, mkd_callback_t free, void *data) { if ( f ) { - if ( f->cb.e_data != data ) + if ( f->cb.e_anchor.func != format ) f->dirty = 1; - f->cb.e_data = data; + f->cb.e_anchor.func = format; + f->cb.e_anchor.free = free; + f->cb.e_anchor.data = data; } } @@ -448,11 +425,13 @@ /* set the code block display callback */ void -mkd_e_code_format(Document *f, mkd_callback_t codefmt) +mkd_e_code_format(Document *f, mkd_callback_t codefmt, mkd_callback_t free, void *data) { - if ( f && (f->cb.e_codefmt != codefmt) ) { + if ( f && (f->cb.e_codefmt.func != codefmt) ) { f->dirty = 1; - f->cb.e_codefmt = codefmt; + f->cb.e_codefmt.func = codefmt; + f->cb.e_codefmt.free = free; + f->cb.e_codefmt.data = data; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/mkdio.h.in new/discount-3.0.0d/mkdio.h.in --- old/discount-3.0.0a/mkdio.h.in 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/mkdio.h.in 2024-02-07 07:01:05.000000000 +0100 @@ -40,6 +40,7 @@ MKD_GITHUBTAGS, /* allow dash and underscore in element names */ MKD_URLENCODEDANCHOR, /* urlencode non-identifier chars instead of replacing with dots */ MKD_LATEX, /* handle embedded LaTeX escapes */ + MKD_ALT_AS_TITLE, /* use alt text as the title if no title is listed */ MKD_NR_FLAGS }; /* abstract flag type */ @@ -125,14 +126,12 @@ /* url generator callbacks */ typedef char * (*mkd_callback_t)(const char*, const int, void*); -typedef void (*mkd_free_t)(char*, void*); +typedef void (*mkd_free_t)(char*, int, void*); -void mkd_e_url(void *, mkd_callback_t); -void mkd_e_flags(void *, mkd_callback_t); -void mkd_e_anchor(void *, mkd_callback_t); -void mkd_e_code_format(void*, mkd_callback_t); -void mkd_e_free(void *, mkd_free_t ); -void mkd_e_data(void *, void *); +void mkd_e_url(void *, mkd_callback_t, mkd_free_t, void *); +void mkd_e_flags(void *, mkd_callback_t, mkd_free_t, void *); +void mkd_e_anchor(void *, mkd_callback_t, mkd_free_t, void *); +void mkd_e_code_format(void*, mkd_callback_t, mkd_free_t, void *); /* version#. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/pgm_options.c new/discount-3.0.0d/pgm_options.c --- old/discount-3.0.0a/pgm_options.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/pgm_options.c 2024-02-07 07:01:05.000000000 +0100 @@ -78,6 +78,7 @@ { "regular-listitem","github-style check items", 0, 0, 1, 1, MKD_NORMAL_LISTITEM } , { "definitionlist","both discount & markdown extra definition lists", 1 }, { "dlist", "both discount & markdown extra definition lists", 1, 0, 1 }, + { "alt_as_title", "use the alt text as a title if there isn't one (images)", 0, 0, 0, 1, MKD_ALT_AS_TITLE }, } ; #define NR(x) (sizeof x / sizeof x[0]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/automatic.t new/discount-3.0.0d/tests/automatic.t --- old/discount-3.0.0a/tests/automatic.t 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/automatic.t 2024-02-07 07:01:05.000000000 +0100 @@ -14,6 +14,7 @@ match '<o...@pell.portland.or.us>' '<o...@pell.portland.or.us>' '<a href=' match '<o...@pell.com.>' '<o...@pell.com.>' '<a href=' try 'invalid <orc@>' '<orc@>' '<p><orc@></p>' +try 'invalid <@o...@eightpoint.app>' '<@o...@eightpoint.app>' '<p><@o...@eightpoint.app></p>' try 'invalid <@pell>' '<@pell>' '<p><@pell></p>' try 'invalid <orc@pell>' '<orc@pell>' '<p><orc@pell></p>' try 'invalid <orc@.pell>' '<orc@.pell>' '<p><orc@.pell></p>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/callbacks.t new/discount-3.0.0d/tests/callbacks.t --- old/discount-3.0.0a/tests/callbacks.t 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/callbacks.t 2024-02-07 07:01:05.000000000 +0100 @@ -9,9 +9,9 @@ '[a](/b)' \ '<p><a href="ZZZ/b">a</a></p>' -try -EZZZ 'additional flags' \ +try -EYYY 'additional flags' \ '[a](/b)' \ -'<p><a href="/b" ZZZ>a</a></p>' +'<p><a href="/b" YYY>a</a></p>' summary $0 exit $rc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/crash.t new/discount-3.0.0d/tests/crash.t --- old/discount-3.0.0a/tests/crash.t 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/crash.t 2024-02-07 07:01:05.000000000 +0100 @@ -23,12 +23,81 @@ <li></li> </ul>' -try -bHOHO 'empty []() with baseurl' '[]()' '<p><a href=""></a></p>' +try -bHOHO 'empty []() with baseurl' '[]()' '<p><a href="HOHO"></a></p>' try 'unclosed html block' '<table></table' '<p><table></table</p>' try 'unclosed style block' '<style>' '<p><style></p>' try -ftoc 'empty header with toc' '##' '<a name="L-23-"></a> <h1>#</h1>' +try '-x -E aloha' 'using -E to add attributes to links' '[]()' '<p><a href="" aloha></a></p>' +try '-b hello -E world' 'using both -E & -b' '[a](/b) [a](/b)' '<p><a href="hello/b" world>a</a> <a href="hello/b" world>a</a></p>' +try '-x -E aloha' 'using -E to add attributes, but with two links' '[](1.png) [](2.png)' '<p><a href="1.png" aloha></a> <a href="2.png" aloha></a></p>' + +try '-T' 'excessively long ETX header prefix' '#######################################################################################################################################################################################################################################################################################################################################################################################################' \ +'<ul> + <li> + <ul> + <li> + <ul> + <li> + <ul> + <li> + <ul> + <li> + <ul> + <li><a href="#L-23-">#</a></li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> +</ul> +<a name="L-23-"></a> +<h6>#</h6>' + +try '-d' 'dump an empty document' '% +% +%' '' + + +RESULT='<ul> + <li><a href="#header">header</a></li> +</ul> +<a name="header"></a> +<h1>header</h1>' + +./rep '#header' '\t' 400 | try -T 'a header with a bunch of trailing tabs' -heredoc "$RESULT" + +./rep '#header' ' ' 400 | try -T 'a header with a bunch of trailing spaces' -heredoc "$RESULT" + +RESULT='<table> +<thead> +<tr> +<th>: Y:</th> +</tr> +</thead> +<tbody> +<tr> +<td></td> +</tr> +<tr> +<td></td> +</tr> +</tbody> +</table>' + +cat << \EOF | try '-F 0x03000000' 'random input that looks like a table' -heredoc "$RESULT" +: Y:| +```| +| +```| +EOF + summary $0 exit $rc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/div.t new/discount-3.0.0d/tests/div.t --- old/discount-3.0.0a/tests/div.t 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/div.t 2024-02-07 07:01:05.000000000 +0100 @@ -20,6 +20,11 @@ <div class="that"><p>that that</p></div>' +try 'a >%div% block with two classes' \ +'>%this that% +this that' \ +'<div class="this that"><p>this that</p></div>' + try '>%class:div%' \ '>%class:this% this this' \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/extrafootnotes.t new/discount-3.0.0d/tests/extrafootnotes.t --- old/discount-3.0.0a/tests/extrafootnotes.t 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/extrafootnotes.t 2024-02-07 07:01:05.000000000 +0100 @@ -28,6 +28,20 @@ </ol> </div>' +try -ffootnote 'footnotes(two adjacent footnotes)' 'Hello[^1][^2] + +[^1]: world +[^2]: from Hamburg' '<p>Hello<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup></p> +<div class="footnotes"> +<hr/> +<ol> +<li id="fn:1"> +world<a href="#fnref:1" rev="footnote">↩</a></li> +<li id="fn:2"> +from Hamburg<a href="#fnref:2" rev="footnote">↩</a></li> +</ol> +</div>' + try -fnofootnote 'footnotes (-fnofootnote)' "$FOOTIE" \ '<p>I haz a footnote<a href="yes?">^1</a></p>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/functions.sh new/discount-3.0.0d/tests/functions.sh --- old/discount-3.0.0a/tests/functions.sh 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/functions.sh 2024-02-07 07:01:05.000000000 +0100 @@ -51,6 +51,7 @@ try_header "$1" case "$2" in + -h*) Q=`./markdown $FLAGS` ;; -t*) Q=`./markdown $FLAGS "$2"` ;; *) Q=`./echo "$2" | ./markdown $FLAGS` ;; esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tests/reddit.t new/discount-3.0.0d/tests/reddit.t --- old/discount-3.0.0a/tests/reddit.t 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/tests/reddit.t 2024-02-07 07:01:05.000000000 +0100 @@ -10,7 +10,7 @@ try 'really long ETX headers' \ '#####################################################hi' \ - '<h6>###############################################hi</h6>' + '<h6>hi</h6>' try 'unescaping " " inside `code`' \ '`foo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/toc.c new/discount-3.0.0d/toc.c --- old/discount-3.0.0a/toc.c 2022-10-27 20:35:18.000000000 +0200 +++ new/discount-3.0.0d/toc.c 2024-02-07 07:01:05.000000000 +0100 @@ -160,7 +160,9 @@ CREATE(label); RESERVE(label, suffix + 200); + strcpy(T(label), T(*name)); + S(label) = S(*name); decollide(T(*pr), &label, suffix); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/discount-3.0.0a/tools/rep.c new/discount-3.0.0d/tools/rep.c --- old/discount-3.0.0a/tools/rep.c 1970-01-01 01:00:00.000000000 +0100 +++ new/discount-3.0.0d/tools/rep.c 2024-02-07 07:01:05.000000000 +0100 @@ -0,0 +1,84 @@ +/* + * repeat a string a bunch of times + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +char * +deformat(char *s) +{ + char *ptr, *new = calloc(strlen(s)+1, 1); + + if ( (ptr = new) == NULL ) { + fprintf(stderr, "out of memory!\n"); + exit(1); + } + for ( ; *s; s++ ) { + if ( *s == '\\' && s[1] ) { + switch ( *(++s) ) { + case 'n': *ptr++ = '\n'; continue; + case 'r': *ptr++ = '\r'; continue; + case 't': *ptr++ = '\t'; continue; + case 'b': *ptr++ = '\b'; continue; + case '\\': *ptr++ = '\\'; continue; + default : *ptr++ = '\\'; break; + } + } + *ptr++ = *s; + } + *ptr++ = 0; + return new; +} + + +int +main(argc, argv) +char **argv; +{ + int count; + char *string; + char *prefix = NULL; + char *suffix = NULL; + + + if ( argc < 3 ) { + fprintf(stderr, "usage: rep [prefix] <string> <count> [suffix]\n"); + exit(1); + } + + + switch (argc) { + case 0: case 1: case 2: + fprintf(stderr, "repeat count needs to be >0\n"); + exit(1); + case 3: + string = deformat(argv[1]); + count = atoi(argv[2]); + break; + default: + suffix = deformat(argv[4]); + case 4: + prefix = deformat(argv[1]); + string = deformat(argv[2]); + count = atoi(argv[3]); + break; + } + + if ( prefix ) { + fputs(prefix, stdout); + free(prefix); + } + + while ( count-- > 0 ) + fputs(string, stdout); + + if ( suffix ) { + fputs(suffix, stdout); + free(suffix); + } + + free(string); + exit(0); +} ++++++ discount-disable_ldconfig.patch ++++++ --- /var/tmp/diff_new_pack.DMlTQ0/_old 2025-05-13 20:12:50.497401588 +0200 +++ /var/tmp/diff_new_pack.DMlTQ0/_new 2025-05-13 20:12:50.497401588 +0200 @@ -1,7 +1,11 @@ -Index: discount-3.0.0a/configure.inc +--- + configure.inc | 5 ----- + 1 file changed, 5 deletions(-) + +Index: discount-3.0.0d/configure.inc =================================================================== ---- discount-3.0.0a.orig/configure.inc -+++ discount-3.0.0a/configure.inc +--- discount-3.0.0d.orig/configure.inc ++++ discount-3.0.0d/configure.inc @@ -1456,7 +1456,6 @@ __AC_ELF_LIBRARIAN() { if $AC_CC $_VFLAGS -o ngc$$.so ngc$$.c; then USE_SONAME=T @@ -10,11 +14,14 @@ if [ "$LDCONFIG" ]; then case `uname -s 2>/dev/null | $AC_UPPERCASE` in -@@ -1501,7 +1500,6 @@ install)$PROG_INSTALL -c \$FULLNAME "\$1 +@@ -1501,10 +1500,6 @@ install)$PROG_INSTALL -c \$FULLNAME "\$1 $PROG_LN_S -f \$FULLNAME \$1/\$LIBNAME.\$MAJOR $PROG_LN_S -f \$FULLNAME \$1/\$LIBNAME EOF -- test "$LDCONFIG" && echo ' '$LDCONFIG '"$1"' >> librarian.sh +- if [ "$LDCONFIG" -a -z "$CONTAINER" ]; then +- echo ' '$LDCONFIG '"$1"' >> librarian.sh +- fi +- cat >> librarian.sh << EOF ;; esac