Fossil SCM

Add query parameters "plaintext" and "raw" to the /help page.

drh 2020-06-27 15:06 trunk
Commit 8530666c0986ee349de6cac43c2138dcbbcd250e653427bd0497483b1dd93945
1 file changed +22
--- src/dispatch.c
+++ src/dispatch.c
@@ -643,10 +643,20 @@
643643
** WEBPAGE: help
644644
** URL: /help?name=CMD
645645
**
646646
** Show the built-in help text for CMD. CMD can be a command-line interface
647647
** command or a page name from the web interface or a setting.
648
+** Query parameters:
649
+**
650
+** name=CMD Show help for CMD where CMD is a command name or
651
+** webpage name or setting name.
652
+**
653
+** plaintext Show the help within <pre>...</pre>, as if it were
654
+** displayed using the "fossil help" command.
655
+**
656
+** raw Show the raw help text without any formatting.
657
+** (Used for debugging.)
648658
*/
649659
void help_page(void){
650660
const char *zCmd = P("cmd");
651661
652662
if( zCmd==0 ) zCmd = P("name");
@@ -672,10 +682,22 @@
672682
}else if( rc==2 ){
673683
@ ambiguous command prefix: %h(zCmd)
674684
}else{
675685
if( pCmd->zHelp[0]==0 ){
676686
@ No help available for "%h(pCmd->zName)"
687
+ }else if( P("plaintext") ){
688
+ Blob txt;
689
+ blob_init(&txt, 0, 0);
690
+ help_to_text(pCmd->zHelp, &txt);
691
+ @ <pre class="helpPage">
692
+ @ %h(blob_str(&txt))
693
+ @ </pre>
694
+ blob_reset(&txt);
695
+ }else if( P("raw") ){
696
+ @ <pre class="helpPage">
697
+ @ %h(pCmd->zHelp)
698
+ @ </pre>
677699
}else{
678700
@ <div class="helpPage">
679701
help_to_html(pCmd->zHelp, cgi_output_blob());
680702
@ </div>
681703
}
682704
--- src/dispatch.c
+++ src/dispatch.c
@@ -643,10 +643,20 @@
643 ** WEBPAGE: help
644 ** URL: /help?name=CMD
645 **
646 ** Show the built-in help text for CMD. CMD can be a command-line interface
647 ** command or a page name from the web interface or a setting.
 
 
 
 
 
 
 
 
 
 
648 */
649 void help_page(void){
650 const char *zCmd = P("cmd");
651
652 if( zCmd==0 ) zCmd = P("name");
@@ -672,10 +682,22 @@
672 }else if( rc==2 ){
673 @ ambiguous command prefix: %h(zCmd)
674 }else{
675 if( pCmd->zHelp[0]==0 ){
676 @ No help available for "%h(pCmd->zName)"
 
 
 
 
 
 
 
 
 
 
 
 
677 }else{
678 @ <div class="helpPage">
679 help_to_html(pCmd->zHelp, cgi_output_blob());
680 @ </div>
681 }
682
--- src/dispatch.c
+++ src/dispatch.c
@@ -643,10 +643,20 @@
643 ** WEBPAGE: help
644 ** URL: /help?name=CMD
645 **
646 ** Show the built-in help text for CMD. CMD can be a command-line interface
647 ** command or a page name from the web interface or a setting.
648 ** Query parameters:
649 **
650 ** name=CMD Show help for CMD where CMD is a command name or
651 ** webpage name or setting name.
652 **
653 ** plaintext Show the help within <pre>...</pre>, as if it were
654 ** displayed using the "fossil help" command.
655 **
656 ** raw Show the raw help text without any formatting.
657 ** (Used for debugging.)
658 */
659 void help_page(void){
660 const char *zCmd = P("cmd");
661
662 if( zCmd==0 ) zCmd = P("name");
@@ -672,10 +682,22 @@
682 }else if( rc==2 ){
683 @ ambiguous command prefix: %h(zCmd)
684 }else{
685 if( pCmd->zHelp[0]==0 ){
686 @ No help available for "%h(pCmd->zName)"
687 }else if( P("plaintext") ){
688 Blob txt;
689 blob_init(&txt, 0, 0);
690 help_to_text(pCmd->zHelp, &txt);
691 @ <pre class="helpPage">
692 @ %h(blob_str(&txt))
693 @ </pre>
694 blob_reset(&txt);
695 }else if( P("raw") ){
696 @ <pre class="helpPage">
697 @ %h(pCmd->zHelp)
698 @ </pre>
699 }else{
700 @ <div class="helpPage">
701 help_to_html(pCmd->zHelp, cgi_output_blob());
702 @ </div>
703 }
704

Keyboard Shortcuts

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