Fossil

Check-in [ae8a3dd5]
Login

Check-in [ae8a3dd5]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a comment for append_footnote_upc(). Also substitute a variable of zero value with just "0" constant. No functional changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | markdown-footnotes
Files: files | file ages | folders
SHA3-256: ae8a3dd5aab47bebda6f973db397757029608711b247fd3cc08c385efec65112
User & Date: george 2022-02-21 05:14:09
Context
2022-02-23
07:36
Fix handling of user-provided classes for unreferenced, joined and overnested footnotes. In all these cases the tokens of user-provided classes are rendered as plain-text and no special classes are added anywhere. ... (check-in: 875472a8 user: george tags: markdown-footnotes)
2022-02-21
05:14
Add a comment for append_footnote_upc(). Also substitute a variable of zero value with just "0" constant. No functional changes. ... (check-in: ae8a3dd5 user: george tags: markdown-footnotes)
04:29
Impose a limit on the depth of nesting of inline footnotes. Also add a few test cases: for depth limiting and HTML hijacking. ... (check-in: f4ff013a user: george tags: markdown-footnotes)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/markdown.c.

2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
      }
      while( ++j < COUNT_FOOTNOTES(notes) ){
        const struct footnote* x = CAST_AS_FOOTNOTES(notes) + j;
        assert( !x->iMark );
        assert( !x->bRndred );
        assert( (&x->id) + 1 == &x->text ); /* see html_footnote_item() */
        assert( (&x->upc)- 1 == &x->text );
        rndr.make.footnote_item(all_items,&x->text,x->iMark,0,rndr.make.opaque);
        g.ftntsIssues[1]++;
      }
      rndr.make.footnotes(ob, all_items, rndr.make.opaque);
      release_work_buffer(&rndr, all_items);
    }
    release_work_buffer(&rndr, notes);
  }







|







2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
      }
      while( ++j < COUNT_FOOTNOTES(notes) ){
        const struct footnote* x = CAST_AS_FOOTNOTES(notes) + j;
        assert( !x->iMark );
        assert( !x->bRndred );
        assert( (&x->id) + 1 == &x->text ); /* see html_footnote_item() */
        assert( (&x->upc)- 1 == &x->text );
        rndr.make.footnote_item(all_items,&x->text,0,0,rndr.make.opaque);
        g.ftntsIssues[1]++;
      }
      rndr.make.footnotes(ob, all_items, rndr.make.opaque);
      release_work_buffer(&rndr, all_items);
    }
    release_work_buffer(&rndr, notes);
  }

Changes to src/markdown_html.c.

332
333
334
335
336
337
338




339
340
341
342
343
344
345
346
347
348
349
  void *opaque
){
  BLOB_APPEND_LITERAL(ob, "  <tr>\n");
  BLOB_APPEND_BLOB(ob, cells);
  BLOB_APPEND_LITERAL(ob, "  </tr>\n");
}





static void append_footnote_upc(
  struct Blob *ob,
  const struct Blob *upc,  /* token of user-provided classes */
  int bHTML /* if true then render markup, otherwise just a list of classes */
){
  const char *z = blob_buffer(upc);
  int i, n = blob_size(upc);
  if( n<3 ) return;
  assert( z[0]=='.' && z[n-1] == ':' );

  if( bHTML ){







>
>
>
>



|







332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
  void *opaque
){
  BLOB_APPEND_LITERAL(ob, "  <tr>\n");
  BLOB_APPEND_BLOB(ob, cells);
  BLOB_APPEND_LITERAL(ob, "  </tr>\n");
}

/* Render a token of user provided classes.
** If bHTML is true then render HTML for (presumably) visible text,
** otherwise just a space-separated list of the derived classes
*/
static void append_footnote_upc(
  struct Blob *ob,
  const struct Blob *upc,  /* token of user-provided classes */
  int bHTML
){
  const char *z = blob_buffer(upc);
  int i, n = blob_size(upc);
  if( n<3 ) return;
  assert( z[0]=='.' && z[n-1] == ':' );

  if( bHTML ){