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).

george 2022-02-20 23:00 markdown-footnotes
Commit 773cef5cf78a80e95e166a72620f51dd12ee8e75a9467e5e97bd5c493cb60a69
2 files changed +3 -4 +5
+3 -4
--- src/markdown.c
+++ src/markdown.c
@@ -1148,20 +1148,19 @@
11481148
const char *p;
11491149
const char * const end = data+size;
11501150
if( data==end || *data != '.' ) return 0;
11511151
for(p=data+1; p!=end; p++){
11521152
if( fossil_isalnum(*p) || *p=='-' ) continue;
1153
+ if( p[-1]=='.' ) break;
11531154
if( *p==':' ){
1154
- if( p[-1]=='.' ) break;
11551155
p++;
11561156
if( bBlank ){
11571157
if( p==end || !fossil_isspace(*p) ) break;
11581158
}
11591159
return p-data;
11601160
}
1161
- if( *p=='.' && p[-1]!='.' ) continue;
1162
- break;
1161
+ if( *p!='.' ) break;
11631162
}
11641163
return 0;
11651164
}
11661165
11671166
/* Adds unlabeled footnote to the rndr.
@@ -2699,10 +2698,11 @@
26992698
blob_reset(&y->text);
27002699
if( k!=i ) blob_reset(&y->id);
27012700
}
27022701
blob_append_string(&list, "</ul>\n");
27032702
x->text = list;
2703
+ g.ftntsIssues[2]++;
27042704
}
27052705
i = j;
27062706
}
27072707
if( nDups ){ /* clean rndr.notes.all from invalidated footnotes */
27082708
const int n = rndr.notes.nLbled - nDups;
@@ -2715,11 +2715,10 @@
27152715
}
27162716
blob_reset( allNotes );
27172717
rndr.notes.all = filtered;
27182718
rndr.notes.nLbled = n;
27192719
assert( COUNT_FOOTNOTES(allNotes) == rndr.notes.nLbled );
2720
- g.ftntsIssues[2] += nDups;
27212720
}
27222721
}
27232722
fn = CAST_AS_FOOTNOTES( allNotes );
27242723
for(i=0; i<rndr.notes.nLbled; i++){
27252724
fn[i].index = i;
27262725
--- 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
--- src/style.c
+++ src/style.c
@@ -781,10 +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]);
789
+ Th_Store("footnotes_issues_counters", buf);
790
+ }
786791
}
787792
788793
/*
789794
** Draw the header.
790795
*/
791796
--- 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

Keyboard Shortcuts

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