Fossil SCM
If the are issues with footnotes then set TH1 variable <var>$footnotes_issues_counters</var> as a space separated list of integers that counts for "misref", "unref" and "joins". This eliminates the need for JavaScript for the case when a custom skin wants to [forum:/forumpost/119b0be29a2b096b|warn about issues with footnotes] in the header of a page.<br> Also fix counting of "joins": count the number of unique labels that have multiple definitions (and not the number of such definitions).
Commit
773cef5cf78a80e95e166a72620f51dd12ee8e75a9467e5e97bd5c493cb60a69
Parent
e06c12d1760bf49…
2 files changed
+3
-4
+5
+3
-4
| --- src/markdown.c | ||
| +++ src/markdown.c | ||
| @@ -1148,20 +1148,19 @@ | ||
| 1148 | 1148 | const char *p; |
| 1149 | 1149 | const char * const end = data+size; |
| 1150 | 1150 | if( data==end || *data != '.' ) return 0; |
| 1151 | 1151 | for(p=data+1; p!=end; p++){ |
| 1152 | 1152 | if( fossil_isalnum(*p) || *p=='-' ) continue; |
| 1153 | + if( p[-1]=='.' ) break; | |
| 1153 | 1154 | if( *p==':' ){ |
| 1154 | - if( p[-1]=='.' ) break; | |
| 1155 | 1155 | p++; |
| 1156 | 1156 | if( bBlank ){ |
| 1157 | 1157 | if( p==end || !fossil_isspace(*p) ) break; |
| 1158 | 1158 | } |
| 1159 | 1159 | return p-data; |
| 1160 | 1160 | } |
| 1161 | - if( *p=='.' && p[-1]!='.' ) continue; | |
| 1162 | - break; | |
| 1161 | + if( *p!='.' ) break; | |
| 1163 | 1162 | } |
| 1164 | 1163 | return 0; |
| 1165 | 1164 | } |
| 1166 | 1165 | |
| 1167 | 1166 | /* Adds unlabeled footnote to the rndr. |
| @@ -2699,10 +2698,11 @@ | ||
| 2699 | 2698 | blob_reset(&y->text); |
| 2700 | 2699 | if( k!=i ) blob_reset(&y->id); |
| 2701 | 2700 | } |
| 2702 | 2701 | blob_append_string(&list, "</ul>\n"); |
| 2703 | 2702 | x->text = list; |
| 2703 | + g.ftntsIssues[2]++; | |
| 2704 | 2704 | } |
| 2705 | 2705 | i = j; |
| 2706 | 2706 | } |
| 2707 | 2707 | if( nDups ){ /* clean rndr.notes.all from invalidated footnotes */ |
| 2708 | 2708 | const int n = rndr.notes.nLbled - nDups; |
| @@ -2715,11 +2715,10 @@ | ||
| 2715 | 2715 | } |
| 2716 | 2716 | blob_reset( allNotes ); |
| 2717 | 2717 | rndr.notes.all = filtered; |
| 2718 | 2718 | rndr.notes.nLbled = n; |
| 2719 | 2719 | assert( COUNT_FOOTNOTES(allNotes) == rndr.notes.nLbled ); |
| 2720 | - g.ftntsIssues[2] += nDups; | |
| 2721 | 2720 | } |
| 2722 | 2721 | } |
| 2723 | 2722 | fn = CAST_AS_FOOTNOTES( allNotes ); |
| 2724 | 2723 | for(i=0; i<rndr.notes.nLbled; i++){ |
| 2725 | 2724 | fn[i].index = i; |
| 2726 | 2725 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -1148,20 +1148,19 @@ | |
| 1148 | const char *p; |
| 1149 | const char * const end = data+size; |
| 1150 | if( data==end || *data != '.' ) return 0; |
| 1151 | for(p=data+1; p!=end; p++){ |
| 1152 | if( fossil_isalnum(*p) || *p=='-' ) continue; |
| 1153 | if( *p==':' ){ |
| 1154 | if( p[-1]=='.' ) break; |
| 1155 | p++; |
| 1156 | if( bBlank ){ |
| 1157 | if( p==end || !fossil_isspace(*p) ) break; |
| 1158 | } |
| 1159 | return p-data; |
| 1160 | } |
| 1161 | if( *p=='.' && p[-1]!='.' ) continue; |
| 1162 | break; |
| 1163 | } |
| 1164 | return 0; |
| 1165 | } |
| 1166 | |
| 1167 | /* Adds unlabeled footnote to the rndr. |
| @@ -2699,10 +2698,11 @@ | |
| 2699 | blob_reset(&y->text); |
| 2700 | if( k!=i ) blob_reset(&y->id); |
| 2701 | } |
| 2702 | blob_append_string(&list, "</ul>\n"); |
| 2703 | x->text = list; |
| 2704 | } |
| 2705 | i = j; |
| 2706 | } |
| 2707 | if( nDups ){ /* clean rndr.notes.all from invalidated footnotes */ |
| 2708 | const int n = rndr.notes.nLbled - nDups; |
| @@ -2715,11 +2715,10 @@ | |
| 2715 | } |
| 2716 | blob_reset( allNotes ); |
| 2717 | rndr.notes.all = filtered; |
| 2718 | rndr.notes.nLbled = n; |
| 2719 | assert( COUNT_FOOTNOTES(allNotes) == rndr.notes.nLbled ); |
| 2720 | g.ftntsIssues[2] += nDups; |
| 2721 | } |
| 2722 | } |
| 2723 | fn = CAST_AS_FOOTNOTES( allNotes ); |
| 2724 | for(i=0; i<rndr.notes.nLbled; i++){ |
| 2725 | fn[i].index = i; |
| 2726 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -1148,20 +1148,19 @@ | |
| 1148 | const char *p; |
| 1149 | const char * const end = data+size; |
| 1150 | if( data==end || *data != '.' ) return 0; |
| 1151 | for(p=data+1; p!=end; p++){ |
| 1152 | if( fossil_isalnum(*p) || *p=='-' ) continue; |
| 1153 | if( p[-1]=='.' ) break; |
| 1154 | if( *p==':' ){ |
| 1155 | p++; |
| 1156 | if( bBlank ){ |
| 1157 | if( p==end || !fossil_isspace(*p) ) break; |
| 1158 | } |
| 1159 | return p-data; |
| 1160 | } |
| 1161 | if( *p!='.' ) break; |
| 1162 | } |
| 1163 | return 0; |
| 1164 | } |
| 1165 | |
| 1166 | /* Adds unlabeled footnote to the rndr. |
| @@ -2699,10 +2698,11 @@ | |
| 2698 | blob_reset(&y->text); |
| 2699 | if( k!=i ) blob_reset(&y->id); |
| 2700 | } |
| 2701 | blob_append_string(&list, "</ul>\n"); |
| 2702 | x->text = list; |
| 2703 | g.ftntsIssues[2]++; |
| 2704 | } |
| 2705 | i = j; |
| 2706 | } |
| 2707 | if( nDups ){ /* clean rndr.notes.all from invalidated footnotes */ |
| 2708 | const int n = rndr.notes.nLbled - nDups; |
| @@ -2715,11 +2715,10 @@ | |
| 2715 | } |
| 2716 | blob_reset( allNotes ); |
| 2717 | rndr.notes.all = filtered; |
| 2718 | rndr.notes.nLbled = n; |
| 2719 | assert( COUNT_FOOTNOTES(allNotes) == rndr.notes.nLbled ); |
| 2720 | } |
| 2721 | } |
| 2722 | fn = CAST_AS_FOOTNOTES( allNotes ); |
| 2723 | for(i=0; i<rndr.notes.nLbled; i++){ |
| 2724 | fn[i].index = i; |
| 2725 |
+5
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -781,10 +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]); | |
| 789 | + Th_Store("footnotes_issues_counters", buf); | |
| 790 | + } | |
| 786 | 791 | } |
| 787 | 792 | |
| 788 | 793 | /* |
| 789 | 794 | ** Draw the header. |
| 790 | 795 | */ |
| 791 | 796 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -781,10 +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 | } |
| 787 | |
| 788 | /* |
| 789 | ** Draw the header. |
| 790 | */ |
| 791 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -781,10 +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 | ** Draw the header. |
| 795 | */ |
| 796 |