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

View File

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