Fossil SCM
Count overnesting as the fourth type of the footnote-related issues and report accordingly.
Commit
ae297bb6715738b5a455418290a670e792f19703952fdb282ecda6bb17f0a091
Parent
c8a8d0c94cf5f05…
4 files changed
+1
-1
+3
-1
+5
-3
+5
-4
+1
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -324,11 +324,11 @@ | ||
| 324 | 324 | } reqPayload; /* request payload object (if any) */ |
| 325 | 325 | cson_array *warnings; /* response warnings */ |
| 326 | 326 | int timerId; /* fetched from fossil_timer_start() */ |
| 327 | 327 | } json; |
| 328 | 328 | #endif /* FOSSIL_ENABLE_JSON */ |
| 329 | - int ftntsIssues[3]; /* Counts for misref, strayed, joined */ | |
| 329 | + int ftntsIssues[4]; /* Counts for misref, strayed, joined, overnested */ | |
| 330 | 330 | int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ |
| 331 | 331 | }; |
| 332 | 332 | |
| 333 | 333 | /* |
| 334 | 334 | ** Macro for debugging: |
| 335 | 335 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -324,11 +324,11 @@ | |
| 324 | } reqPayload; /* request payload object (if any) */ |
| 325 | cson_array *warnings; /* response warnings */ |
| 326 | int timerId; /* fetched from fossil_timer_start() */ |
| 327 | } json; |
| 328 | #endif /* FOSSIL_ENABLE_JSON */ |
| 329 | int ftntsIssues[3]; /* Counts for misref, strayed, joined */ |
| 330 | int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ |
| 331 | }; |
| 332 | |
| 333 | /* |
| 334 | ** Macro for debugging: |
| 335 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -324,11 +324,11 @@ | |
| 324 | } reqPayload; /* request payload object (if any) */ |
| 325 | cson_array *warnings; /* response warnings */ |
| 326 | int timerId; /* fetched from fossil_timer_start() */ |
| 327 | } json; |
| 328 | #endif /* FOSSIL_ENABLE_JSON */ |
| 329 | int ftntsIssues[4]; /* Counts for misref, strayed, joined, overnested */ |
| 330 | int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ |
| 331 | }; |
| 332 | |
| 333 | /* |
| 334 | ** Macro for debugging: |
| 335 |
+3
-1
| --- src/markdown.c | ||
| +++ src/markdown.c | ||
| @@ -2788,14 +2788,16 @@ | ||
| 2788 | 2788 | assert( &(dummy->id) == &(dummy->text) - 1 ); |
| 2789 | 2789 | assert( &(dummy->upc) == &(dummy->text) + 1 ); |
| 2790 | 2790 | |
| 2791 | 2791 | for(i=0; i<COUNT_FOOTNOTES(notes); i++){ |
| 2792 | 2792 | const struct footnote* x = CAST_AS_FOOTNOTES(notes) + i; |
| 2793 | + const int xUsed = x->bRndred ? x->nUsed : 0; | |
| 2793 | 2794 | if( !x->iMark ) break; |
| 2794 | 2795 | assert( x->nUsed ); |
| 2795 | 2796 | rndr.make.footnote_item(all_items, &x->text, x->iMark, |
| 2796 | - x->bRndred ? x->nUsed : 0, rndr.make.opaque); | |
| 2797 | + xUsed, rndr.make.opaque); | |
| 2798 | + if( !xUsed ) g.ftntsIssues[3]++; /* an overnested footnote */ | |
| 2797 | 2799 | j = i; |
| 2798 | 2800 | } |
| 2799 | 2801 | if( rndr.notes.misref.nUsed ){ |
| 2800 | 2802 | rndr.make.footnote_item(all_items, 0, -1, |
| 2801 | 2803 | rndr.notes.misref.nUsed, rndr.make.opaque); |
| 2802 | 2804 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -2788,14 +2788,16 @@ | |
| 2788 | assert( &(dummy->id) == &(dummy->text) - 1 ); |
| 2789 | assert( &(dummy->upc) == &(dummy->text) + 1 ); |
| 2790 | |
| 2791 | for(i=0; i<COUNT_FOOTNOTES(notes); i++){ |
| 2792 | const struct footnote* x = CAST_AS_FOOTNOTES(notes) + i; |
| 2793 | if( !x->iMark ) break; |
| 2794 | assert( x->nUsed ); |
| 2795 | rndr.make.footnote_item(all_items, &x->text, x->iMark, |
| 2796 | x->bRndred ? x->nUsed : 0, rndr.make.opaque); |
| 2797 | j = i; |
| 2798 | } |
| 2799 | if( rndr.notes.misref.nUsed ){ |
| 2800 | rndr.make.footnote_item(all_items, 0, -1, |
| 2801 | rndr.notes.misref.nUsed, rndr.make.opaque); |
| 2802 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -2788,14 +2788,16 @@ | |
| 2788 | assert( &(dummy->id) == &(dummy->text) - 1 ); |
| 2789 | assert( &(dummy->upc) == &(dummy->text) + 1 ); |
| 2790 | |
| 2791 | for(i=0; i<COUNT_FOOTNOTES(notes); i++){ |
| 2792 | const struct footnote* x = CAST_AS_FOOTNOTES(notes) + i; |
| 2793 | const int xUsed = x->bRndred ? x->nUsed : 0; |
| 2794 | if( !x->iMark ) break; |
| 2795 | assert( x->nUsed ); |
| 2796 | rndr.make.footnote_item(all_items, &x->text, x->iMark, |
| 2797 | xUsed, rndr.make.opaque); |
| 2798 | if( !xUsed ) g.ftntsIssues[3]++; /* an overnested footnote */ |
| 2799 | j = i; |
| 2800 | } |
| 2801 | if( rndr.notes.misref.nUsed ){ |
| 2802 | rndr.make.footnote_item(all_items, 0, -1, |
| 2803 | rndr.notes.misref.nUsed, rndr.make.opaque); |
| 2804 |
+5
-3
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -781,13 +781,15 @@ | ||
| 781 | 781 | image_url_var("background"); |
| 782 | 782 | if( !login_is_nobody() ){ |
| 783 | 783 | Th_Store("login", g.zLogin); |
| 784 | 784 | } |
| 785 | 785 | Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) ); |
| 786 | - if( g.ftntsIssues[0] || g.ftntsIssues[1] || g.ftntsIssues[2] ){ | |
| 787 | - char buf[64]; | |
| 788 | - sprintf(&buf[0],"%i %i %i",g.ftntsIssues[0],g.ftntsIssues[1],g.ftntsIssues[2]); | |
| 786 | + if( g.ftntsIssues[0] || g.ftntsIssues[1] || | |
| 787 | + g.ftntsIssues[2] || g.ftntsIssues[3] ){ | |
| 788 | + char buf[80]; | |
| 789 | + sprintf(&buf[0],"%i %i %i %i",g.ftntsIssues[0],g.ftntsIssues[1], | |
| 790 | + g.ftntsIssues[2],g.ftntsIssues[3]); | |
| 789 | 791 | Th_Store("footnotes_issues_counters", buf); |
| 790 | 792 | } |
| 791 | 793 | } |
| 792 | 794 | |
| 793 | 795 | /* |
| 794 | 796 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -781,13 +781,15 @@ | |
| 781 | image_url_var("background"); |
| 782 | if( !login_is_nobody() ){ |
| 783 | Th_Store("login", g.zLogin); |
| 784 | } |
| 785 | Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) ); |
| 786 | if( g.ftntsIssues[0] || g.ftntsIssues[1] || g.ftntsIssues[2] ){ |
| 787 | char buf[64]; |
| 788 | sprintf(&buf[0],"%i %i %i",g.ftntsIssues[0],g.ftntsIssues[1],g.ftntsIssues[2]); |
| 789 | Th_Store("footnotes_issues_counters", buf); |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | /* |
| 794 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -781,13 +781,15 @@ | |
| 781 | image_url_var("background"); |
| 782 | if( !login_is_nobody() ){ |
| 783 | Th_Store("login", g.zLogin); |
| 784 | } |
| 785 | Th_MaybeStore("current_feature", feature_from_page_path(local_zCurrentPage) ); |
| 786 | if( g.ftntsIssues[0] || g.ftntsIssues[1] || |
| 787 | g.ftntsIssues[2] || g.ftntsIssues[3] ){ |
| 788 | char buf[80]; |
| 789 | sprintf(&buf[0],"%i %i %i %i",g.ftntsIssues[0],g.ftntsIssues[1], |
| 790 | g.ftntsIssues[2],g.ftntsIssues[3]); |
| 791 | Th_Store("footnotes_issues_counters", buf); |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | /* |
| 796 |
+5
-4
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -1917,18 +1917,19 @@ | ||
| 1917 | 1917 | safe_html(&out); |
| 1918 | 1918 | blob_write_to_file(&out, "-"); |
| 1919 | 1919 | blob_reset(&in); |
| 1920 | 1920 | blob_reset(&out); |
| 1921 | 1921 | } |
| 1922 | - if( bFnLint && (g.ftntsIssues[0] || g.ftntsIssues[1] || g.ftntsIssues[2])){ | |
| 1922 | + if( bFnLint && (g.ftntsIssues[0] || g.ftntsIssues[1] | |
| 1923 | + || g.ftntsIssues[2] || g.ftntsIssues[3] )){ | |
| 1923 | 1924 | fossil_fatal("There were issues with footnotes:\n" |
| 1924 | 1925 | " %8i misreference%s\n" |
| 1925 | 1926 | " %8i unreferenced\n" |
| 1926 | - " %8i splitted", | |
| 1927 | + " %8i splitted\n" | |
| 1928 | + " %8i overnested", | |
| 1927 | 1929 | g.ftntsIssues[0], g.ftntsIssues[0]==1?"":"s", |
| 1928 | - g.ftntsIssues[1], | |
| 1929 | - g.ftntsIssues[2]); | |
| 1930 | + g.ftntsIssues[1], g.ftntsIssues[2], g.ftntsIssues[3]); | |
| 1930 | 1931 | } |
| 1931 | 1932 | } |
| 1932 | 1933 | |
| 1933 | 1934 | /* |
| 1934 | 1935 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1935 | 1936 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1917,18 +1917,19 @@ | |
| 1917 | safe_html(&out); |
| 1918 | blob_write_to_file(&out, "-"); |
| 1919 | blob_reset(&in); |
| 1920 | blob_reset(&out); |
| 1921 | } |
| 1922 | if( bFnLint && (g.ftntsIssues[0] || g.ftntsIssues[1] || g.ftntsIssues[2])){ |
| 1923 | fossil_fatal("There were issues with footnotes:\n" |
| 1924 | " %8i misreference%s\n" |
| 1925 | " %8i unreferenced\n" |
| 1926 | " %8i splitted", |
| 1927 | g.ftntsIssues[0], g.ftntsIssues[0]==1?"":"s", |
| 1928 | g.ftntsIssues[1], |
| 1929 | g.ftntsIssues[2]); |
| 1930 | } |
| 1931 | } |
| 1932 | |
| 1933 | /* |
| 1934 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1935 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1917,18 +1917,19 @@ | |
| 1917 | safe_html(&out); |
| 1918 | blob_write_to_file(&out, "-"); |
| 1919 | blob_reset(&in); |
| 1920 | blob_reset(&out); |
| 1921 | } |
| 1922 | if( bFnLint && (g.ftntsIssues[0] || g.ftntsIssues[1] |
| 1923 | || g.ftntsIssues[2] || g.ftntsIssues[3] )){ |
| 1924 | fossil_fatal("There were issues with footnotes:\n" |
| 1925 | " %8i misreference%s\n" |
| 1926 | " %8i unreferenced\n" |
| 1927 | " %8i splitted\n" |
| 1928 | " %8i overnested", |
| 1929 | g.ftntsIssues[0], g.ftntsIssues[0]==1?"":"s", |
| 1930 | g.ftntsIssues[1], g.ftntsIssues[2], g.ftntsIssues[3]); |
| 1931 | } |
| 1932 | } |
| 1933 | |
| 1934 | /* |
| 1935 | ** Search for a <title>...</title> at the beginning of a wiki page. |
| 1936 |