Skip to content

Commit

Permalink
Teach it to pitch style and script tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Jan 19, 2014
1 parent f25076a commit e2ce096
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libhtmlw/HTML.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ struct ref_rec {
#define M_CITATION 34
#define M_BLOCKQUOTE 35

#define M_SCRIPT 36
#define M_STYLE 37

/* syntax of Mark types */
#define MT_TITLE "title"
#define MT_HEADER_1 "h1"
Expand Down Expand Up @@ -258,6 +261,8 @@ struct ref_rec {
#define MT_VARIABLE "var"
#define MT_CITATION "cite"
#define MT_BLOCKQUOTE "blockquote"
#define MT_SCRIPT "script"
#define MT_STYLE "style"


/* anchor tags */
Expand Down
16 changes: 16 additions & 0 deletions libhtmlw/HTMLformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static int TextIndent;
static int MarginW;
static int Ignore;
static int Preformat;
static int Droptext;
static int PF_LF_State; /* Pre-formatted linefeed state. Hack for bad HTMLs */
static int NeedSpace;
static Boolean Internal;
Expand Down Expand Up @@ -1324,6 +1325,10 @@ FormatPlace(hw, mptr, x, y, width)
int line_x;

text = mptr->text;
if ( Droptext ) {
fprintf(stderr,"X %s\n",text);
return;
}

line_x = *x;
line = (char *)malloc(1);
Expand Down Expand Up @@ -2549,6 +2554,17 @@ TriggerMarkChanges(hw, mptr, x, y)
font = hw->html.font;
}
break;
case M_STYLE:
case M_SCRIPT:
if (mark->is_end)
{
Droptext = 0;
}
else
{
Droptext = 1;
}
break;
case M_INDEX:
hw->html.is_index = True;
break;
Expand Down
6 changes: 6 additions & 0 deletions libhtmlw/HTMLlists.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ PrintType(type)
case M_BLOCKQUOTE:
printf("M_BLOCKQUOTE");
break;
case M_SCRIPT:
printf("M_SCRIPT");
break;
case M_STYLE:
printf("M_STYLE");
break;
default:
printf("UNKNOWN %d", type);
break;
Expand Down
8 changes: 8 additions & 0 deletions libhtmlw/HTMLparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,14 @@ ParseMarkType(str)
{
type = M_ANCHOR;
}
else if (caseless_equal(str, MT_SCRIPT))
{
type = M_SCRIPT;
}
else if (caseless_equal(str, MT_STYLE))
{
type = M_STYLE;
}
else if (caseless_equal(str, MT_TITLE))
{
type = M_TITLE;
Expand Down

0 comments on commit e2ce096

Please sign in to comment.