mothra: more tags

This commit is contained in:
cinap_lenrek 2011-11-06 16:13:46 +01:00
parent ff0dc1668f
commit b4fb5e2384
4 changed files with 45 additions and 21 deletions

View file

@ -178,14 +178,16 @@ void rdform(Hglob *g){
f->type=TYPEIN; f->type=TYPEIN;
if(cistrcmp(s, "password")==0) if(cistrcmp(s, "password")==0)
f->type=PASSWD; f->type=PASSWD;
s=f->name;
if(s && cistrcmp(s, "isindex")==0)
f->type=INDEX;
/* /*
* If there's exactly one attribute, use its value as the name, * If there's exactly one attribute, use its value as the name,
* regardless of the attribute name. This makes * regardless of the attribute name. This makes
* http://linus.att.com/ias/puborder.html work. * http://linus.att.com/ias/puborder.html work.
*/ */
s=f->name;
if(s && cistrcmp(s, "isindex")==0)
f->type=INDEX;
if(s==0){ if(s==0){
if(g->attr[0].name && g->attr[1].name==0) if(g->attr[0].name && g->attr[1].name==0)
f->name=strdup(g->attr[0].value); f->name=strdup(g->attr[0].value);

View file

@ -119,8 +119,13 @@ enum{
*/ */
enum{ enum{
Tag_comment, Tag_comment,
Tag_a, Tag_a,
Tag_abbr,
Tag_acronym,
Tag_address, Tag_address,
Tag_applet,
Tag_audio,
Tag_b, Tag_b,
Tag_base, Tag_base,
Tag_blockquot, Tag_blockquot,
@ -136,8 +141,10 @@ enum{
Tag_dl, Tag_dl,
Tag_dt, Tag_dt,
Tag_em, Tag_em,
Tag_embed,
Tag_font, Tag_font,
Tag_form, Tag_form,
Tag_frame, /* rm 5.8.97 */
Tag_h1, Tag_h1,
Tag_h2, Tag_h2,
Tag_h3, Tag_h3,
@ -148,6 +155,7 @@ enum{
Tag_hr, Tag_hr,
Tag_html, Tag_html,
Tag_i, Tag_i,
Tag_iframe,
Tag_img, Tag_img,
Tag_input, Tag_input,
Tag_isindex, Tag_isindex,
@ -159,31 +167,31 @@ enum{
Tag_menu, Tag_menu,
Tag_meta, Tag_meta,
Tag_nextid, Tag_nextid,
Tag_object,
Tag_ol, Tag_ol,
Tag_option, Tag_option,
Tag_p, Tag_p,
Tag_plaintext, Tag_plaintext,
Tag_pre, Tag_pre,
Tag_samp, Tag_samp,
Tag_script,
Tag_select, Tag_select,
Tag_strong, Tag_strong,
Tag_style,
Tag_source,
Tag_table, /* rm 3.8.00 */
Tag_td,
Tag_textarea, Tag_textarea,
Tag_title, Tag_title,
Tag_tr,
Tag_tt, Tag_tt,
Tag_u, Tag_u,
Tag_ul, Tag_ul,
Tag_var, Tag_var,
Tag_xmp,
Tag_frame, /* rm 5.8.97 */
Tag_table, /* rm 3.8.00 */
Tag_td,
Tag_tr,
Tag_video, Tag_video,
Tag_object, Tag_xmp,
Tag_script,
Tag_style,
Tag_end, /* also used to indicate unrecognized start tag */
Tag_end, /* also used to indicate unrecognized start tag */
Tag_text, Tag_text,
}; };
enum{ enum{

View file

@ -6,9 +6,12 @@
#include "mothra.h" #include "mothra.h"
#include "html.h" #include "html.h"
Tag tag[]={ Tag tag[]={
[Tag_comment] "!--", NOEND,
[Tag_a] "a", END, [Tag_a] "a", END,
[Tag_abbr] "abbr", END,
[Tag_acronym] "acronym", END,
[Tag_address] "address", END, [Tag_address] "address", END,
[Tag_applet] "applet", NOEND,
[Tag_audio] "audio", NOEND,
[Tag_b] "b", END, [Tag_b] "b", END,
[Tag_base] "base", NOEND, [Tag_base] "base", NOEND,
[Tag_blockquot] "blockquote", END, [Tag_blockquot] "blockquote", END,
@ -18,14 +21,18 @@ Tag tag[]={
[Tag_center] "center", END, [Tag_center] "center", END,
[Tag_cite] "cite", END, [Tag_cite] "cite", END,
[Tag_code] "code", END, [Tag_code] "code", END,
[Tag_comment] "!--", NOEND,
[Tag_dd] "dd", NOEND, /* OPTEND */ [Tag_dd] "dd", NOEND, /* OPTEND */
[Tag_dfn] "dfn", END, [Tag_dfn] "dfn", END,
[Tag_dir] "dir", END, [Tag_dir] "dir", END,
[Tag_dl] "dl", END, [Tag_dl] "dl", END,
[Tag_dt] "dt", NOEND, /* OPTEND */ [Tag_dt] "dt", NOEND, /* OPTEND */
[Tag_em] "em", END, [Tag_em] "em", END,
[Tag_embed] "embed", NOEND,
[Tag_end] 0, ERR,
[Tag_font] "font", END, [Tag_font] "font", END,
[Tag_form] "form", END, [Tag_form] "form", END,
[Tag_frame] "frame", NOEND,
[Tag_h1] "h1", END, [Tag_h1] "h1", END,
[Tag_h2] "h2", END, [Tag_h2] "h2", END,
[Tag_h3] "h3", END, [Tag_h3] "h3", END,
@ -36,8 +43,9 @@ Tag tag[]={
[Tag_hr] "hr", NOEND, [Tag_hr] "hr", NOEND,
[Tag_html] "html", END, /* OPTEND */ [Tag_html] "html", END, /* OPTEND */
[Tag_i] "i", END, [Tag_i] "i", END,
[Tag_input] "input", NOEND, [Tag_iframe] "iframe", NOEND,
[Tag_img] "img", NOEND, [Tag_img] "img", NOEND,
[Tag_input] "input", NOEND,
[Tag_isindex] "isindex", NOEND, [Tag_isindex] "isindex", NOEND,
[Tag_kbd] "kbd", END, [Tag_kbd] "kbd", END,
[Tag_key] "key", END, [Tag_key] "key", END,
@ -47,20 +55,20 @@ Tag tag[]={
[Tag_menu] "menu", END, [Tag_menu] "menu", END,
[Tag_meta] "meta", NOEND, [Tag_meta] "meta", NOEND,
[Tag_nextid] "nextid", NOEND, [Tag_nextid] "nextid", NOEND,
[Tag_object] "object", END,
[Tag_ol] "ol", END, [Tag_ol] "ol", END,
[Tag_option] "option", NOEND, /* OPTEND */ [Tag_option] "option", NOEND, /* OPTEND */
[Tag_p] "p", NOEND, /* OPTEND */ [Tag_p] "p", NOEND, /* OPTEND */
[Tag_plaintext] "plaintext", NOEND, [Tag_plaintext] "plaintext", NOEND,
[Tag_pre] "pre", END, [Tag_pre] "pre", END,
[Tag_samp] "samp", END, [Tag_samp] "samp", END,
[Tag_video] "video", NOEND,
[Tag_object] "object", END,
[Tag_script] "script", END, [Tag_script] "script", END,
[Tag_style] "style", END,
[Tag_select] "select", END, [Tag_select] "select", END,
[Tag_strong] "strong", END, [Tag_strong] "strong", END,
[Tag_table] "table", END, [Tag_style] "style", END,
[Tag_td] "td", END, [Tag_source] "source", NOEND,
[Tag_table] "table", END,
[Tag_td] "td", END,
[Tag_textarea] "textarea", END, [Tag_textarea] "textarea", END,
[Tag_title] "title", END, [Tag_title] "title", END,
[Tag_tr] "tr", END, [Tag_tr] "tr", END,
@ -68,7 +76,6 @@ Tag tag[]={
[Tag_u] "u", END, [Tag_u] "u", END,
[Tag_ul] "ul", END, [Tag_ul] "ul", END,
[Tag_var] "var", END, [Tag_var] "var", END,
[Tag_video] "video", NOEND,
[Tag_xmp] "xmp", END, [Tag_xmp] "xmp", END,
[Tag_frame] "frame", NOEND,
[Tag_end] 0, ERR,
}; };

View file

@ -729,8 +729,12 @@ void plrdhtml(char *name, int fd, Www *dst){
g.linebrk=1; g.linebrk=1;
g.spacc=0; g.spacc=0;
break; break;
case Tag_source:
case Tag_video: case Tag_video:
case Tag_audio:
case Tag_embed:
case Tag_frame: case Tag_frame:
case Tag_iframe:
if(str=pl_getattr(g.attr, "src")) if(str=pl_getattr(g.attr, "src"))
strncpy(g.state->link, str, sizeof(g.state->link)); strncpy(g.state->link, str, sizeof(g.state->link));
if(str=pl_getattr(g.attr, "name")) if(str=pl_getattr(g.attr, "name"))
@ -780,6 +784,7 @@ void plrdhtml(char *name, int fd, Www *dst){
/* more to come */ /* more to come */
break; break;
case Tag_cite: case Tag_cite:
case Tag_acronym:
g.state->font=ITALIC; g.state->font=ITALIC;
g.state->size=NORMAL; g.state->size=NORMAL;
break; break;
@ -795,6 +800,7 @@ void plrdhtml(char *name, int fd, Www *dst){
break; break;
case Tag_dfn: case Tag_dfn:
htmlerror(g.name, g.lineno, "<dfn> deprecated"); htmlerror(g.name, g.lineno, "<dfn> deprecated");
case Tag_abbr:
g.state->font=BOLD; g.state->font=BOLD;
g.state->size=NORMAL; g.state->size=NORMAL;
break; break;
@ -940,6 +946,7 @@ void plrdhtml(char *name, int fd, Www *dst){
break; break;
case Tag_script: case Tag_script:
case Tag_object: case Tag_object:
case Tag_applet:
case Tag_style: case Tag_style:
/* /*
* ignore the content of these tags, eat tokens until we * ignore the content of these tags, eat tokens until we