Fossil SCM

Count overnesting as the fourth type of the footnote-related issues and report accordingly.

george 2022-02-23 12:33 markdown-footnotes
Commit ae297bb6715738b5a455418290a670e792f19703952fdb282ecda6bb17f0a091
+1 -1
--- src/main.c
+++ src/main.c
@@ -324,11 +324,11 @@
324324
} reqPayload; /* request payload object (if any) */
325325
cson_array *warnings; /* response warnings */
326326
int timerId; /* fetched from fossil_timer_start() */
327327
} json;
328328
#endif /* FOSSIL_ENABLE_JSON */
329
- int ftntsIssues[3]; /* Counts for misref, strayed, joined */
329
+ int ftntsIssues[4]; /* Counts for misref, strayed, joined, overnested */
330330
int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */
331331
};
332332
333333
/*
334334
** Macro for debugging:
335335
--- 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 @@
27882788
assert( &(dummy->id) == &(dummy->text) - 1 );
27892789
assert( &(dummy->upc) == &(dummy->text) + 1 );
27902790
27912791
for(i=0; i<COUNT_FOOTNOTES(notes); i++){
27922792
const struct footnote* x = CAST_AS_FOOTNOTES(notes) + i;
2793
+ const int xUsed = x->bRndred ? x->nUsed : 0;
27932794
if( !x->iMark ) break;
27942795
assert( x->nUsed );
27952796
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 */
27972799
j = i;
27982800
}
27992801
if( rndr.notes.misref.nUsed ){
28002802
rndr.make.footnote_item(all_items, 0, -1,
28012803
rndr.notes.misref.nUsed, rndr.make.opaque);
28022804
--- 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 @@
781781
image_url_var("background");
782782
if( !login_is_nobody() ){
783783
Th_Store("login", g.zLogin);
784784
}
785785
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]);
789791
Th_Store("footnotes_issues_counters", buf);
790792
}
791793
}
792794
793795
/*
794796
--- 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
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1917,18 +1917,19 @@
19171917
safe_html(&out);
19181918
blob_write_to_file(&out, "-");
19191919
blob_reset(&in);
19201920
blob_reset(&out);
19211921
}
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] )){
19231924
fossil_fatal("There were issues with footnotes:\n"
19241925
" %8i misreference%s\n"
19251926
" %8i unreferenced\n"
1926
- " %8i splitted",
1927
+ " %8i splitted\n"
1928
+ " %8i overnested",
19271929
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]);
19301931
}
19311932
}
19321933
19331934
/*
19341935
** Search for a <title>...</title> at the beginning of a wiki page.
19351936
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button