Improvements to ".www" and ".output -w" so that text that is not part of

query output is shown using <pre>.

FossilOrigin-Name: f8ef65c52305b2180ec56760f5762ac5638584cd504c79d57e86f61736901aa4
This commit is contained in:
drh 2024-09-25 13:56:05 +00:00
parent 2a9254cf2c
commit 62d96919f6
3 changed files with 22 additions and 13 deletions

View File

@ -1,5 +1,5 @@
C Add\sthe\s"www"\soutput\smode\sthat\sinclude\s<table>\sin\sthe\sHTML\soutput.\nAdd\sthe\s".www"\scommand\sand\sthe\s"-w"\soption\sto\s".once".
D 2024-09-25T13:29:03.338
C Improvements\sto\s".www"\sand\s".output\s-w"\sso\sthat\stext\sthat\sis\snot\spart\sof\nquery\soutput\sis\sshown\susing\s<pre>.
D 2024-09-25T13:56:05.407
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -770,7 +770,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 9750a281f7ba073b4e6da2be1a6c4071f5d841a7746c5fb3f70d6d793b6675ea
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe
F src/shell.c.in 9781ab726a108a10f8722d0d5e10c548d6f797ceef8d1a257a4e2cdc107bffc0
F src/shell.c.in 053df097aad75a1ecdff3f71c8452efffc889cc3b88907c93325360340d8b977
F src/sqlite.h.in 77f55bd1978a04a14db211732f0a609077cf60ba4ccf9baf39988f508945419c
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
@ -2215,8 +2215,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 04727fc00207325a76a5d5f20549c00232810ac727dedb70bc9e8112e60b3f56
R a9ce986cea2b862753a371f08d91ab92
P b06fd9e6bcce09f12c994dc34f329a8d267ea0601bb07c9b00903c5017d55d42
R 322d10259a92b6303d31355dabde0d96
U drh
Z cd53dd6e20071a9c7b2de3e7e318715b
Z 8156bb15fa45205c46d5412fa2ec3c8c
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
b06fd9e6bcce09f12c994dc34f329a8d267ea0601bb07c9b00903c5017d55d42
f8ef65c52305b2180ec56760f5762ac5638584cd504c79d57e86f61736901aa4

View File

@ -2735,7 +2735,10 @@ static int shell_callback(
case MODE_Html: {
if( p->cnt==0 && p->cMode==MODE_Www ){
sqlite3_fputs(
"<TABLE border='1' cellspacing='0' cellpadding='2'>\n",p->out);
"</PRE>\n"
"<TABLE border='1' cellspacing='0' cellpadding='2'>\n"
,p->out
);
}
if( p->cnt==0 && p->showHeader ){
sqlite3_fputs("<TR>", p->out);
@ -4285,7 +4288,7 @@ static void exec_prepared_stmt(
if( pArg->cMode==MODE_Json ){
sqlite3_fputs("]\n", pArg->out);
}else if( pArg->cMode==MODE_Www ){
sqlite3_fputs("</TABLE>\n", pArg->out);
sqlite3_fputs("</TABLE>\n<PRE>\n", pArg->out);
}else if( pArg->cMode==MODE_Count ){
char zBuf[200];
sqlite3_snprintf(sizeof(zBuf), zBuf, "%llu row%s\n",
@ -6409,6 +6412,13 @@ static void output_redir(ShellState *p, FILE *pfNew){
sqlite3_fputs("Output already redirected.\n", stderr);
}else{
p->out = pfNew;
if( p->mode==MODE_Www ){
sqlite3_fputs(
"<!DOCTYPE html>\n"
"<HTML><BODY><PRE>\n",
p->out
);
}
}
}
@ -6425,6 +6435,9 @@ static void output_reset(ShellState *p){
pclose(p->out);
#endif
}else{
if( p->mode==MODE_Www ){
sqlite3_fputs("</PRE></BODY></HTML>\n", p->out);
}
output_file_close(p->out);
#ifndef SQLITE_NOHAVE_SYSTEM
if( p->doXdgOpen ){
@ -9717,8 +9730,6 @@ static int do_meta_command(char *zLine, ShellState *p){
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
}else if( cli_strncmp(zMode,"html",n2)==0 ){
p->mode = MODE_Html;
}else if( cli_strncmp(zMode,"www",n2)==0 ){
p->mode = MODE_Www;
}else if( cli_strncmp(zMode,"tcl",n2)==0 ){
p->mode = MODE_Tcl;
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
@ -13007,8 +13018,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
i++;
}else if( cli_strcmp(z,"-html")==0 ){
data.mode = MODE_Html;
}else if( cli_strcmp(z,"-www")==0 ){
data.mode = MODE_Www;
}else if( cli_strcmp(z,"-list")==0 ){
data.mode = MODE_List;
}else if( cli_strcmp(z,"-quote")==0 ){