Fossil SCM
Add query parameters "plaintext" and "raw" to the /help page.
Commit
8530666c0986ee349de6cac43c2138dcbbcd250e653427bd0497483b1dd93945
Parent
f7e572b0407fa2b…
1 file changed
+22
+22
| --- src/dispatch.c | ||
| +++ src/dispatch.c | ||
| @@ -643,10 +643,20 @@ | ||
| 643 | 643 | ** WEBPAGE: help |
| 644 | 644 | ** URL: /help?name=CMD |
| 645 | 645 | ** |
| 646 | 646 | ** Show the built-in help text for CMD. CMD can be a command-line interface |
| 647 | 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.) | |
| 648 | 658 | */ |
| 649 | 659 | void help_page(void){ |
| 650 | 660 | const char *zCmd = P("cmd"); |
| 651 | 661 | |
| 652 | 662 | if( zCmd==0 ) zCmd = P("name"); |
| @@ -672,10 +682,22 @@ | ||
| 672 | 682 | }else if( rc==2 ){ |
| 673 | 683 | @ ambiguous command prefix: %h(zCmd) |
| 674 | 684 | }else{ |
| 675 | 685 | if( pCmd->zHelp[0]==0 ){ |
| 676 | 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> | |
| 677 | 699 | }else{ |
| 678 | 700 | @ <div class="helpPage"> |
| 679 | 701 | help_to_html(pCmd->zHelp, cgi_output_blob()); |
| 680 | 702 | @ </div> |
| 681 | 703 | } |
| 682 | 704 |
| --- 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 |