WebView 1.0 Beta 5: fixes in ViewSource

git-svn-id: svn://kolibrios.org@4719 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2014-03-30 13:51:53 +00:00
parent cb9906f10d
commit 4de8ce80c2
2 changed files with 22 additions and 14 deletions

View File

@ -29,14 +29,14 @@
char homepage[] = FROM "html\homepage.htm"; char homepage[] = FROM "html\homepage.htm";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 4"; char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 5";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
char page_not_found[] = FROM "html\page_not_found_ru.htm"; char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n"; char accept_language[]= "Accept-Language: ru\n";
#else #else
char version[]=" Text-based Browser 1.0 Beta 4"; char version[]=" Text-based Browser 1.0 Beta 5";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -390,6 +390,7 @@ void Scan(int id)
return; return;
case 052: //F3 case 052: //F3
ShowSource(); ShowSource();
WB1.Parse();
break; break;
case 053: //F4 case 053: //F4
if (strncmp(#URL,"http:",5)==0) if (strncmp(#URL,"http:",5)==0)

View File

@ -1,8 +1,10 @@
enum { TAG, OPTION_VALUE, TEXT, COMMENT };
//you are butifull, you are butifull //you are butifull, you are butifull
dword ShowSource() dword ShowSource()
{ {
dword new_buf, new_buf_start, i; dword new_buf, new_buf_start, i;
byte ww, param, comment; byte ww, mode;
if (souce_mode) return; if (souce_mode) return;
souce_mode = true; souce_mode = true;
@ -19,46 +21,51 @@ dword ShowSource()
{ {
strcat(new_buf, "<font color=#ccc>&lt;"); strcat(new_buf, "<font color=#ccc>&lt;");
new_buf+=20; new_buf+=20;
mode = COMMENT;
} }
else else
{ {
strcat(new_buf, "<font color=#00f>&lt;"); strcat(new_buf, "<font color=#00f>&lt;");
new_buf+=20; new_buf+=20;
mode = TAG;
} }
break; break;
case '>': case '>':
if (!param) //fix non-closed quote if (mode == OPTION_VALUE) //fix non-closed quote in TAG
{ {
param = 1;
strcat(new_buf, "&quot;</font>"); strcat(new_buf, "&quot;</font>");
new_buf+=12; new_buf+=12;
mode = TAG;
} }
if (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-') if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
{ {
strcat(new_buf, "&gt;</font>"); strcat(new_buf, "&gt;</font>");
new_buf+=10; new_buf+=10;
mode = TEXT;
} }
else if (mode == TAG)
{ {
strcat(new_buf, "&gt;</font>"); strcat(new_buf, "&gt;</font>");
new_buf+=10; new_buf+=10;
mode = TEXT;
} }
break; break;
case '\"': case '\"':
case '\'': case '\'':
if (param) if (mode == TAG)
{ {
param = 0;
strcat(new_buf, "<font color=#f0f>&quot;"); strcat(new_buf, "<font color=#f0f>&quot;");
new_buf+=22; new_buf+=22;
mode = OPTION_VALUE;
break;
} }
else if (mode == OPTION_VALUE)
{ {
param = 1;
strcat(new_buf, "&quot;</font>"); strcat(new_buf, "&quot;</font>");
new_buf+=12; new_buf+=12;
} mode = TAG;
break; break;
}
default: default:
chrcat(new_buf, ww); chrcat(new_buf, ww);
} }