Fossil SCM

Fix incorrect insertion of </ul> tags.

joel 2014-01-02 18:50 UTC csstree
Commit 417d18082bde5bdda79b65484f61314986ef0f60
1 file changed +7 -9
+7 -9
--- src/browse.c
+++ src/browse.c
@@ -413,11 +413,10 @@
413413
char *zREx = ""; /* Extra parameters for path hyperlinks */
414414
ReCompiled *pRE = 0; /* Compiled regular expression */
415415
FileTreeNode *p; /* One line of the tree */
416416
FileTree sTree; /* The complete tree of files */
417417
HQuery sURI; /* Hyperlink */
418
- int iDepth = 0; /* <ul> depth */
419418
char *zProjectName = db_get("project-name", 0);
420419
421420
if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
422421
memset(&sTree, 0, sizeof(sTree));
423422
login_check_credentials();
@@ -554,11 +553,10 @@
554553
@ %z(zLink)%h(zProjectName)</a>
555554
}else{
556555
@ <a>%h(zProjectName)</a>
557556
}
558557
@ <ul class="filetree">
559
- iDepth = 2;
560558
for(p=sTree.pFirst; p; p=p->pNext){
561559
if( p->isDir ){
562560
@ <li class="dir">
563561
if( fossil_strcmp(p->zFullName, zD)==0 ){
564562
@ <a>%h(p->zName)</a>
@@ -565,28 +563,28 @@
565563
}else{
566564
char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
567565
@ %z(zLink)%h(p->zName)</a>
568566
}
569567
@ <ul class="filetree">
570
- iDepth++;
571568
}else{
572569
char *zLink;
573570
if( zCI ){
574571
zLink = href("%R/artifact/%s",p->zUuid);
575572
}else{
576573
zLink = href("%R/finfo?name=%T",p->zFullName);
577574
}
578575
@ <li class="file">%z(zLink)%h(p->zName)</a>
579576
}
580
- if( p->isLast && !p->isDir ){
581
- @ </ul>
582
- iDepth--;
577
+ if( p->isLast ){
578
+ int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0);
579
+ while( nClose-- > 0 ){
580
+ @ </ul>
581
+ }
583582
}
584583
}
585
- while( iDepth-- > 0 ) {
586
- @ </ul>
587
- }
584
+ @ </ul>
585
+ @ </ul>
588586
style_footer();
589587
590588
/* We could free memory used by sTree here if we needed to. But
591589
** the process is about to exit, so doing so would not really accomplish
592590
** anything useful. */
593591
--- src/browse.c
+++ src/browse.c
@@ -413,11 +413,10 @@
413 char *zREx = ""; /* Extra parameters for path hyperlinks */
414 ReCompiled *pRE = 0; /* Compiled regular expression */
415 FileTreeNode *p; /* One line of the tree */
416 FileTree sTree; /* The complete tree of files */
417 HQuery sURI; /* Hyperlink */
418 int iDepth = 0; /* <ul> depth */
419 char *zProjectName = db_get("project-name", 0);
420
421 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
422 memset(&sTree, 0, sizeof(sTree));
423 login_check_credentials();
@@ -554,11 +553,10 @@
554 @ %z(zLink)%h(zProjectName)</a>
555 }else{
556 @ <a>%h(zProjectName)</a>
557 }
558 @ <ul class="filetree">
559 iDepth = 2;
560 for(p=sTree.pFirst; p; p=p->pNext){
561 if( p->isDir ){
562 @ <li class="dir">
563 if( fossil_strcmp(p->zFullName, zD)==0 ){
564 @ <a>%h(p->zName)</a>
@@ -565,28 +563,28 @@
565 }else{
566 char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
567 @ %z(zLink)%h(p->zName)</a>
568 }
569 @ <ul class="filetree">
570 iDepth++;
571 }else{
572 char *zLink;
573 if( zCI ){
574 zLink = href("%R/artifact/%s",p->zUuid);
575 }else{
576 zLink = href("%R/finfo?name=%T",p->zFullName);
577 }
578 @ <li class="file">%z(zLink)%h(p->zName)</a>
579 }
580 if( p->isLast && !p->isDir ){
581 @ </ul>
582 iDepth--;
 
 
583 }
584 }
585 while( iDepth-- > 0 ) {
586 @ </ul>
587 }
588 style_footer();
589
590 /* We could free memory used by sTree here if we needed to. But
591 ** the process is about to exit, so doing so would not really accomplish
592 ** anything useful. */
593
--- src/browse.c
+++ src/browse.c
@@ -413,11 +413,10 @@
413 char *zREx = ""; /* Extra parameters for path hyperlinks */
414 ReCompiled *pRE = 0; /* Compiled regular expression */
415 FileTreeNode *p; /* One line of the tree */
416 FileTree sTree; /* The complete tree of files */
417 HQuery sURI; /* Hyperlink */
 
418 char *zProjectName = db_get("project-name", 0);
419
420 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
421 memset(&sTree, 0, sizeof(sTree));
422 login_check_credentials();
@@ -554,11 +553,10 @@
553 @ %z(zLink)%h(zProjectName)</a>
554 }else{
555 @ <a>%h(zProjectName)</a>
556 }
557 @ <ul class="filetree">
 
558 for(p=sTree.pFirst; p; p=p->pNext){
559 if( p->isDir ){
560 @ <li class="dir">
561 if( fossil_strcmp(p->zFullName, zD)==0 ){
562 @ <a>%h(p->zName)</a>
@@ -565,28 +563,28 @@
563 }else{
564 char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
565 @ %z(zLink)%h(p->zName)</a>
566 }
567 @ <ul class="filetree">
 
568 }else{
569 char *zLink;
570 if( zCI ){
571 zLink = href("%R/artifact/%s",p->zUuid);
572 }else{
573 zLink = href("%R/finfo?name=%T",p->zFullName);
574 }
575 @ <li class="file">%z(zLink)%h(p->zName)</a>
576 }
577 if( p->isLast ){
578 int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0);
579 while( nClose-- > 0 ){
580 @ </ul>
581 }
582 }
583 }
584 @ </ul>
585 @ </ul>
 
586 style_footer();
587
588 /* We could free memory used by sTree here if we needed to. But
589 ** the process is about to exit, so doing so would not really accomplish
590 ** anything useful. */
591

Keyboard Shortcuts

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