repo: geminiclient
action: commit
revision: 
path_from: 
revision_from: fe63a40d0602b3e13d2270482c299a488753016e:
path_to: 
revision_to: 
git.thebackupbox.net
geminiclient
git clone git://git.thebackupbox.net/geminiclient
commit fe63a40d0602b3e13d2270482c299a488753016e
Author: epoch 
Date:   Wed Feb 22 23:33:38 2023 +0000

    modified nytpu fragment proposal for explicit and header-based fragment link coexistence

diff --git a/gemini2html.c b/gemini2html.c
index df7966535689a8d8a4126191c1edc7454de1f840..
index ..f42a50f132e59ff3f4e6f9c9234b0a18aec6a42e 100644
--- a/gemini2html.c
+++ b/gemini2html.c
@@ -39,6 +39,7 @@ int main(int argc,char *argv[]) {
   char *tab,*spa;
   char *second;
   char *t,*s;
+  char *id;
   int ln=0;

   if(argc >= 2) {//if there's an argument, we output the header too.
@@ -68,7 +69,8 @@ int main(int argc,char *argv[]) {
     if(h) {
       t=header_to_anchor(line+h+1);
       if(!ln) printf("%s%s",h,line+h+1,h,LINE_ENDING);
-      else printf("%s%s",h,t,t,line+h+1,h,LINE_ENDING);
+      else printf("%s%s",h,t,t,line+h+1,h,LINE_ENDING);
+      //else printf("%s%s",h,line+h+1,h,LINE_ENDING);
       free(t);
       continue;
     }
@@ -80,6 +82,7 @@ int main(int argc,char *argv[]) {
       continue;
     }
     if(!strncmp(line,"=> ",3)) {
+      id=0;
       first=line+3;
       tab=strchr(first,'\t');
       spa=strchr(first,' ');
@@ -99,11 +102,16 @@ int main(int argc,char *argv[]) {
       if(second) {//need to do this on first tab too.
         *second=0;
         second++;
-      } else {
+      } else { // not title-text for this link.
         second=first;
+	if(*first == '#') id=first+1;
       }
       //need to encode the html entities for < > and "...
-      printf("%s%s%s",first,second,pre?"":"
",LINE_ENDING); + if(id && *id) { // make sure the id is set and id isn't set to empty + printf("%s%s%s",id,first,second,pre?"":"
",LINE_ENDING); + } else { + printf("%s%s%s",first,second,pre?"":"
",LINE_ENDING); + } continue; } printf("%s%s%s",line,pre?"":"
",LINE_ENDING);

-----END OF PAGE-----