version 1.249, 2019/01/06 04:55:09 |
version 1.252, 2019/01/18 14:36:21 |
Line 271 html_close_paragraph(struct html *h) |
|
Line 271 html_close_paragraph(struct html *h) |
|
{ |
{ |
struct tag *t; |
struct tag *t; |
|
|
for (t = h->tag; t != NULL; t = t->next) { |
for (t = h->tag; t != NULL && t->closed == 0; t = t->next) { |
if (t->tag == TAG_P) { |
switch(t->tag) { |
|
case TAG_P: |
|
case TAG_PRE: |
print_tagq(h, t); |
print_tagq(h, t); |
break; |
break; |
|
case TAG_A: |
|
print_tagq(h, t); |
|
continue; |
|
default: |
|
continue; |
} |
} |
|
break; |
} |
} |
} |
} |
|
|
Line 579 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 587 print_otag(struct html *h, enum htmltag tag, const cha |
|
t = mandoc_malloc(sizeof(struct tag)); |
t = mandoc_malloc(sizeof(struct tag)); |
t->tag = tag; |
t->tag = tag; |
t->next = h->tag; |
t->next = h->tag; |
|
t->refcnt = 0; |
|
t->closed = 0; |
h->tag = t; |
h->tag = t; |
} else |
} else |
t = NULL; |
t = NULL; |
Line 657 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 667 print_otag(struct html *h, enum htmltag tag, const cha |
|
print_encode(h, arg1, NULL, 1); |
print_encode(h, arg1, NULL, 1); |
fmt++; |
fmt++; |
break; |
break; |
case 'T': |
|
print_encode(h, arg1, NULL, 1); |
|
print_word(h, "\" title=\""); |
|
print_encode(h, arg1, NULL, 1); |
|
fmt++; |
|
break; |
|
default: |
default: |
print_encode(h, arg1, NULL, 1); |
print_encode(h, arg1, NULL, 1); |
break; |
break; |
Line 717 print_ctag(struct html *h, struct tag *tag) |
|
Line 721 print_ctag(struct html *h, struct tag *tag) |
|
{ |
{ |
int tflags; |
int tflags; |
|
|
/* |
if (tag->closed == 0) { |
* Remember to close out and nullify the current |
tag->closed = 1; |
* meta-font and table, if applicable. |
if (tag == h->metaf) |
*/ |
h->metaf = NULL; |
if (tag == h->metaf) |
if (tag == h->tblt) |
h->metaf = NULL; |
h->tblt = NULL; |
if (tag == h->tblt) |
|
h->tblt = NULL; |
|
|
|
tflags = htmltags[tag->tag].flags; |
tflags = htmltags[tag->tag].flags; |
|
if (tflags & HTML_INDENT) |
if (tflags & HTML_INDENT) |
h->indent--; |
h->indent--; |
if (tflags & HTML_NOINDENT) |
if (tflags & HTML_NOINDENT) |
h->noindent--; |
h->noindent--; |
if (tflags & HTML_NLEND) |
if (tflags & HTML_NLEND) |
print_endline(h); |
print_endline(h); |
print_indent(h); |
print_indent(h); |
print_byte(h, '<'); |
print_byte(h, '<'); |
print_byte(h, '/'); |
print_byte(h, '/'); |
print_word(h, htmltags[tag->tag].name); |
print_word(h, htmltags[tag->tag].name); |
print_byte(h, '>'); |
print_byte(h, '>'); |
if (tflags & HTML_NLAFTER) |
if (tflags & HTML_NLAFTER) |
print_endline(h); |
print_endline(h); |
} |
|
if (tag->refcnt == 0) { |
h->tag = tag->next; |
h->tag = tag->next; |
free(tag); |
free(tag); |
|
} |
} |
} |
|
|
void |
void |
Line 830 print_text(struct html *h, const char *word) |
|
Line 833 print_text(struct html *h, const char *word) |
|
void |
void |
print_tagq(struct html *h, const struct tag *until) |
print_tagq(struct html *h, const struct tag *until) |
{ |
{ |
struct tag *tag; |
struct tag *this, *next; |
|
|
while ((tag = h->tag) != NULL) { |
for (this = h->tag; this != NULL; this = next) { |
print_ctag(h, tag); |
next = this == until ? NULL : this->next; |
if (until && tag == until) |
print_ctag(h, this); |
return; |
|
} |
} |
} |
} |
|
|
|
/* |
|
* Close out all open elements up to but excluding suntil. |
|
* Note that a paragraph just inside stays open together with it |
|
* because paragraphs include subsequent phrasing content. |
|
*/ |
void |
void |
print_stagq(struct html *h, const struct tag *suntil) |
print_stagq(struct html *h, const struct tag *suntil) |
{ |
{ |
struct tag *tag; |
struct tag *this, *next; |
|
|
while ((tag = h->tag) != NULL) { |
for (this = h->tag; this != NULL; this = next) { |
if (suntil && tag == suntil) |
next = this->next; |
return; |
if (this == suntil || (next == suntil && |
print_ctag(h, tag); |
(this->tag == TAG_P || this->tag == TAG_PRE))) |
|
break; |
|
print_ctag(h, this); |
} |
} |
} |
|
|
|
void |
|
print_paragraph(struct html *h) |
|
{ |
|
struct tag *t; |
|
|
|
t = print_otag(h, TAG_DIV, "c", "Pp"); |
|
print_tagq(h, t); |
|
} |
} |
|
|
|
|