diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-06-13 00:23:57 +0000 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-06-13 00:23:57 +0000 |
commit | 37961f38962e91a8a2c24ec9d9c9fc111b3dbad4 (patch) | |
tree | 90caa88868fe74ace75667083a69daa257de802f | |
parent | 409ae09bd0a4ca5e01f1482a6f1148c581586125 (diff) | |
download | lynx-snapshots-37961f38962e91a8a2c24ec9d9c9fc111b3dbad4.tar.gz |
snapshot of project "lynx", label v2-9-0dev_10h
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 18 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.h | 6 | ||||
-rw-r--r-- | src/HTInit.c | 4 | ||||
-rw-r--r-- | src/HTML.c | 20 | ||||
-rw-r--r-- | src/HTML.h | 7 |
6 files changed, 42 insertions, 17 deletions
diff --git a/CHANGES b/CHANGES index 2b0d937d..4e816cc0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,11 @@ --- $LynxId: CHANGES,v 1.1112 2022/06/12 17:05:20 tom Exp $ +-- $LynxId: CHANGES,v 1.1113 2022/06/13 00:23:57 tom Exp $ =============================================================================== Changes since Lynx 2.8 release =============================================================================== 2022-06-12 (2.9.0dev.11) +* add presentation type for xhtml, related state information to better handle + things such as "<script src=foo />" -Sholmi Fish, TD * improve line-breaks and whitespace for Japanese characters -KH + permit line breaks after any Japanese character (enabled by --enable-wcwidth-support configuration and only called on last byte of diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index d120644b..2534606e 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.c,v 1.182 2021/10/24 22:18:29 tom Exp $ + * $LynxId: SGML.c,v 1.183 2022/06/13 00:20:50 tom Exp $ * * General SGML Parser code SGML.c * ======================== @@ -1621,7 +1621,8 @@ static BOOL ignore_when_empty(HTTag * tag) && !(tag->flags & Tgf_mafse) && tag->contents != SGML_EMPTY && tag->tagclass != Tgc_Plike - && (tag->tagclass == Tgc_SELECTlike + && (tag->tagclass == Tgc_APPLETlike + || tag->tagclass == Tgc_SELECTlike || (tag->contains && tag->icontains))) { result = TRUE; } @@ -3644,9 +3645,9 @@ static void SGML_character(HTStream *me, int c_in) case S_attr: if (WHITE(c) || (c == '>') || (c == '=')) { /* End of word */ if ((c == '>') - && (string->size == 1) - && (string->data[0] == '/')) { - if (me->extended_html + && (string->size >= 1) + && (string->data[string->size - 1] == '/')) { + if ((LYxhtml_parsing || me->extended_html) && ignore_when_empty(me->current_tag)) { discard_empty(me); } @@ -4590,7 +4591,8 @@ const HTStreamClass SGMLParser = HTStream *SGML_new(const SGML_dtd * dtd, HTParentAnchor *anchor, - HTStructured * target) + HTStructured * target, + int extended_html) { HTStream *me = typecalloc(struct _HTStream); @@ -4660,6 +4662,10 @@ HTStream *SGML_new(const SGML_dtd * dtd, sgml_in_psrc_was_initialized = TRUE; } #endif + if (extended_html) + { + me->extended_html = TRUE; + } sgml_offset = 0; return me; diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h index 8b6445f6..7da79762 100644 --- a/WWW/Library/Implementation/SGML.h +++ b/WWW/Library/Implementation/SGML.h @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.h,v 1.47 2021/07/22 23:34:13 tom Exp $ + * $LynxId: SGML.h,v 1.48 2022/06/12 20:19:04 tom Exp $ * SGML parse and stream definition for libwww * SGML AND STRUCTURED STREAMS * @@ -281,7 +281,9 @@ Create an SGML parser */ extern HTStream *SGML_new(const SGML_dtd * dtd, HTParentAnchor *anchor, - HTStructured * target); + HTStructured * target, + int extended_html) + ; extern const HTStreamClass SGMLParser; diff --git a/src/HTInit.c b/src/HTInit.c index 4aa38e0c..466bc722 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTInit.c,v 1.97 2022/04/01 07:55:02 tom Exp $ + * $LynxId: HTInit.c,v 1.98 2022/06/12 21:17:37 tom Exp $ * * Configuration-specific Initialization HTInit.c * ---------------------------------------- @@ -178,7 +178,7 @@ void HTFormatInit(void) * application/xhtml+xml * text/html */ - SET_INTERNL("application/xhtml+xml", STR_PRESENT, HTMLPresent, 1.0); + SET_INTERNL("application/xhtml+xml", STR_PRESENT, XHTMLPresent, 1.0); SET_INTERNL("application/xhtml+xml", STR_SOURCE, HTPlainPresent, 1.0); SET_INTERNL("text/css", STR_PRESENT, HTPlainPresent, 1.0); SET_INTERNL(STR_HTML, STR_PRESENT, HTMLPresent, 1.0); diff --git a/src/HTML.c b/src/HTML.c index 14dfbc56..75c2bf91 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTML.c,v 1.198 2022/06/12 16:48:05 tom Exp $ + * $LynxId: HTML.c,v 1.199 2022/06/13 00:23:57 tom Exp $ * * Structured stream to Rich hypertext converter * ============================================ @@ -7963,7 +7963,7 @@ HTStream *HTMLToPlain(HTPresentation *pres, CTRACE((tfp, "HTMLToPlain calling CacheThru_new\n")); return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, - HTML_new(anchor, pres->rep_out, sink))); + HTML_new(anchor, pres->rep_out, sink), FALSE)); } /* HTConverter for HTML source to plain text @@ -8026,7 +8026,7 @@ HTStream *HTMLParsedPresent(HTPresentation *pres, CTRACE((tfp, "HTMLParsedPresent calling CacheThru_new\n")); return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, - HTMLGenerator(intermediate))); + HTMLGenerator(intermediate), FALSE)); } /* HTConverter for HTML to C code @@ -8054,7 +8054,7 @@ HTStream *HTMLToC(HTPresentation *pres GCC_UNUSED, HTML_put_string(html, html->comment_start); CTRACE((tfp, "HTMLToC calling CacheThru_new\n")); return CacheThru_new(anchor, - SGML_new(&HTML_dtd, anchor, html)); + SGML_new(&HTML_dtd, anchor, html, FALSE)); } /* Presenter for HTML @@ -8073,7 +8073,17 @@ HTStream *HTMLPresent(HTPresentation *pres GCC_UNUSED, CTRACE((tfp, "HTMLPresent calling CacheThru_new\n")); return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, - HTML_new(anchor, WWW_PRESENT, NULL))); + HTML_new(anchor, WWW_PRESENT, NULL), FALSE)); +} + +HTStream *XHTMLPresent(HTPresentation *pres GCC_UNUSED, + HTParentAnchor *anchor, + HTStream *sink GCC_UNUSED) +{ + CTRACE((tfp, "XHTMLPresent calling CacheThru_new\n")); + return CacheThru_new(anchor, + SGML_new(&HTML_dtd, anchor, + HTML_new(anchor, WWW_PRESENT, NULL), TRUE)); } #endif /* !GUI */ diff --git a/src/HTML.h b/src/HTML.h index 9f5d1d5d..2bc040fe 100644 --- a/src/HTML.h +++ b/src/HTML.h @@ -1,5 +1,5 @@ /* - * $LynxId: HTML.h,v 1.34 2019/08/23 23:18:06 tom Exp $ + * $LynxId: HTML.h,v 1.35 2022/06/12 20:19:04 tom Exp $ * * HTML to rich text converter for libwww * @@ -251,6 +251,11 @@ extern "C" { HTParentAnchor *anchor, HTStream *sink); + extern HTStream *XHTMLPresent(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); + + extern HTStructured *HTML_new(HTParentAnchor *anchor, HTFormat format_out, HTStream *target); |