Fossil SCM

Add the [/test-all-help] webpage used for testing.

drh 2011-01-01 00:15 trunk
Commit 26e269fef30b5134c7e02097057cdc348dcb2fa1
1 file changed +83 -65
+83 -65
--- src/main.c
+++ src/main.c
@@ -683,75 +683,93 @@
683683
/*
684684
** WEBPAGE: help
685685
** URL: /help/CMD
686686
*/
687687
void help_page(void){
688
- const char * zCmd = P("cmd");
689
-
690
- if( zCmd==0 ) zCmd = P("name");
691
- style_header("Command-line Help");
692
- if( zCmd ){
693
- int rc, idx;
694
- char *z, *s, *d;
695
-
696
- style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
697
- @ <h1>The "%s(zCmd)" command:</h1>
698
- rc = name_search(zCmd, aCommand, count(aCommand), &idx);
699
- if( rc==1 ){
700
- @ unknown command: %s(zCmd)
701
- }else if( rc==2 ){
702
- @ ambiguous command prefix: %s(zCmd)
703
- }else{
704
- z = (char*)aCmdHelp[idx];
705
- if( z==0 ){
706
- @ no help available for the %s(aCommand[idx].zName) command
707
- }else{
708
- z=s=d=mprintf("%s",z);
709
- while( *s ){
710
- if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
711
- s++;
712
- }else{
713
- *d++ = *s++;
714
- }
715
- }
716
- *d = 0;
717
- @ <blockquote><pre>
718
- @ %h(z)
719
- @ </pre></blockquote>
720
- free(z);
721
- }
722
- }
723
- }else{
724
- int i, j, n;
725
-
726
- @ <h1>Available commands:</h1>
727
- @ <table border="0"><tr>
728
- for(i=j=0; i<count(aCommand); i++){
729
- const char *z = aCommand[i].zName;
730
- if( strncmp(z,"test",4)==0 ) continue;
731
- j++;
732
- }
733
- n = (j+6)/7;
734
- for(i=j=0; i<count(aCommand); i++){
735
- const char *z = aCommand[i].zName;
736
- if( strncmp(z,"test",4)==0 ) continue;
737
- if( j==0 ){
738
- @ <td valign="top"><ul>
739
- }
740
- @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
741
- j++;
742
- if( j>=n ){
743
- @ </ul></td>
744
- j = 0;
745
- }
746
- }
747
- if( j>0 ){
748
- @ </ul></td>
749
- }
750
- @ </tr></table>
751
- }
752
- style_footer();
688
+ const char * zCmd = P("cmd");
689
+
690
+ if( zCmd==0 ) zCmd = P("name");
691
+ style_header("Command-line Help");
692
+ if( zCmd ){
693
+ int rc, idx;
694
+ char *z, *s, *d;
695
+
696
+ style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
697
+ @ <h1>The "%s(zCmd)" command:</h1>
698
+ rc = name_search(zCmd, aCommand, count(aCommand), &idx);
699
+ if( rc==1 ){
700
+ @ unknown command: %s(zCmd)
701
+ }else if( rc==2 ){
702
+ @ ambiguous command prefix: %s(zCmd)
703
+ }else{
704
+ z = (char*)aCmdHelp[idx];
705
+ if( z==0 ){
706
+ @ no help available for the %s(aCommand[idx].zName) command
707
+ }else{
708
+ z=s=d=mprintf("%s",z);
709
+ while( *s ){
710
+ if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
711
+ s++;
712
+ }else{
713
+ *d++ = *s++;
714
+ }
715
+ }
716
+ *d = 0;
717
+ @ <blockquote><pre>
718
+ @ %h(z)
719
+ @ </pre></blockquote>
720
+ free(z);
721
+ }
722
+ }
723
+ }else{
724
+ int i, j, n;
725
+
726
+ @ <h1>Available commands:</h1>
727
+ @ <table border="0"><tr>
728
+ for(i=j=0; i<count(aCommand); i++){
729
+ const char *z = aCommand[i].zName;
730
+ if( strncmp(z,"test",4)==0 ) continue;
731
+ j++;
732
+ }
733
+ n = (j+6)/7;
734
+ for(i=j=0; i<count(aCommand); i++){
735
+ const char *z = aCommand[i].zName;
736
+ if( strncmp(z,"test",4)==0 ) continue;
737
+ if( j==0 ){
738
+ @ <td valign="top"><ul>
739
+ }
740
+ @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
741
+ j++;
742
+ if( j>=n ){
743
+ @ </ul></td>
744
+ j = 0;
745
+ }
746
+ }
747
+ if( j>0 ){
748
+ @ </ul></td>
749
+ }
750
+ @ </tr></table>
751
+ }
752
+ style_footer();
753
+}
754
+
755
+/*
756
+** WEBPAGE: test-all-help
757
+**
758
+** Show all help text on a single page. Useful for proof-reading.
759
+*/
760
+void test_all_help_page(void){
761
+ int i;
762
+ style_header("Testpage: All Help Text");
763
+ for(i=0; i<count(aCommand); i++){
764
+ if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
765
+ @ <h2>%s(aCommand[i].zName):</h2>
766
+ @ <blockquote><pre>
767
+ @ %h(aCmdHelp[i])
768
+ @ </pre></blockquote>
769
+ }
770
+ style_footer();
753771
}
754772
755773
/*
756774
** Set the g.zBaseURL value to the full URL for the toplevel of
757775
** the fossil tree. Set g.zTop to g.zBaseURL without the
758776
--- src/main.c
+++ src/main.c
@@ -683,75 +683,93 @@
683 /*
684 ** WEBPAGE: help
685 ** URL: /help/CMD
686 */
687 void help_page(void){
688 const char * zCmd = P("cmd");
689
690 if( zCmd==0 ) zCmd = P("name");
691 style_header("Command-line Help");
692 if( zCmd ){
693 int rc, idx;
694 char *z, *s, *d;
695
696 style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
697 @ <h1>The "%s(zCmd)" command:</h1>
698 rc = name_search(zCmd, aCommand, count(aCommand), &idx);
699 if( rc==1 ){
700 @ unknown command: %s(zCmd)
701 }else if( rc==2 ){
702 @ ambiguous command prefix: %s(zCmd)
703 }else{
704 z = (char*)aCmdHelp[idx];
705 if( z==0 ){
706 @ no help available for the %s(aCommand[idx].zName) command
707 }else{
708 z=s=d=mprintf("%s",z);
709 while( *s ){
710 if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
711 s++;
712 }else{
713 *d++ = *s++;
714 }
715 }
716 *d = 0;
717 @ <blockquote><pre>
718 @ %h(z)
719 @ </pre></blockquote>
720 free(z);
721 }
722 }
723 }else{
724 int i, j, n;
725
726 @ <h1>Available commands:</h1>
727 @ <table border="0"><tr>
728 for(i=j=0; i<count(aCommand); i++){
729 const char *z = aCommand[i].zName;
730 if( strncmp(z,"test",4)==0 ) continue;
731 j++;
732 }
733 n = (j+6)/7;
734 for(i=j=0; i<count(aCommand); i++){
735 const char *z = aCommand[i].zName;
736 if( strncmp(z,"test",4)==0 ) continue;
737 if( j==0 ){
738 @ <td valign="top"><ul>
739 }
740 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
741 j++;
742 if( j>=n ){
743 @ </ul></td>
744 j = 0;
745 }
746 }
747 if( j>0 ){
748 @ </ul></td>
749 }
750 @ </tr></table>
751 }
752 style_footer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
753 }
754
755 /*
756 ** Set the g.zBaseURL value to the full URL for the toplevel of
757 ** the fossil tree. Set g.zTop to g.zBaseURL without the
758
--- src/main.c
+++ src/main.c
@@ -683,75 +683,93 @@
683 /*
684 ** WEBPAGE: help
685 ** URL: /help/CMD
686 */
687 void help_page(void){
688 const char * zCmd = P("cmd");
689
690 if( zCmd==0 ) zCmd = P("name");
691 style_header("Command-line Help");
692 if( zCmd ){
693 int rc, idx;
694 char *z, *s, *d;
695
696 style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
697 @ <h1>The "%s(zCmd)" command:</h1>
698 rc = name_search(zCmd, aCommand, count(aCommand), &idx);
699 if( rc==1 ){
700 @ unknown command: %s(zCmd)
701 }else if( rc==2 ){
702 @ ambiguous command prefix: %s(zCmd)
703 }else{
704 z = (char*)aCmdHelp[idx];
705 if( z==0 ){
706 @ no help available for the %s(aCommand[idx].zName) command
707 }else{
708 z=s=d=mprintf("%s",z);
709 while( *s ){
710 if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
711 s++;
712 }else{
713 *d++ = *s++;
714 }
715 }
716 *d = 0;
717 @ <blockquote><pre>
718 @ %h(z)
719 @ </pre></blockquote>
720 free(z);
721 }
722 }
723 }else{
724 int i, j, n;
725
726 @ <h1>Available commands:</h1>
727 @ <table border="0"><tr>
728 for(i=j=0; i<count(aCommand); i++){
729 const char *z = aCommand[i].zName;
730 if( strncmp(z,"test",4)==0 ) continue;
731 j++;
732 }
733 n = (j+6)/7;
734 for(i=j=0; i<count(aCommand); i++){
735 const char *z = aCommand[i].zName;
736 if( strncmp(z,"test",4)==0 ) continue;
737 if( j==0 ){
738 @ <td valign="top"><ul>
739 }
740 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
741 j++;
742 if( j>=n ){
743 @ </ul></td>
744 j = 0;
745 }
746 }
747 if( j>0 ){
748 @ </ul></td>
749 }
750 @ </tr></table>
751 }
752 style_footer();
753 }
754
755 /*
756 ** WEBPAGE: test-all-help
757 **
758 ** Show all help text on a single page. Useful for proof-reading.
759 */
760 void test_all_help_page(void){
761 int i;
762 style_header("Testpage: All Help Text");
763 for(i=0; i<count(aCommand); i++){
764 if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
765 @ <h2>%s(aCommand[i].zName):</h2>
766 @ <blockquote><pre>
767 @ %h(aCmdHelp[i])
768 @ </pre></blockquote>
769 }
770 style_footer();
771 }
772
773 /*
774 ** Set the g.zBaseURL value to the full URL for the toplevel of
775 ** the fossil tree. Set g.zTop to g.zBaseURL without the
776

Keyboard Shortcuts

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