[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lynx-dev] colo(u)red figcaptions
From: |
rbell |
Subject: |
Re: [Lynx-dev] colo(u)red figcaptions |
Date: |
Tue, 25 Oct 2022 22:37:28 -0600 |
I needed -p0. Here's the patch - do you want me to do
something else?
Index: WWW/Library/Implementation/hdr_HTMLDTD.h
*** lynx2.9.0dev.10/WWW/Library/Implementation/hdr_HTMLDTD.h 2021-07-15
18:40:16.000000000 -0600
---
lynx2.9.0dev.10_patchedforfigcaption/WWW/Library/Implementation/hdr_HTMLDTD.h
2022-10-24 12:30:41.189510975 -0600
***************
*** 60,65 ****
--- 60,66 ----
HTML_EMBED,
HTML_FIELDSET,
HTML_FIG,
+ HTML_FIGCAPTION,
HTML_FIGURE,
HTML_FN,
HTML_FONT,
***************
*** 426,431 ****
--- 427,443 ----
#define HTML_FIG_WIDTH 16
#define HTML_FIG_ATTRIBUTES 17
+ #define HTML_FIGCAPTION_ACCESSKEY 0
+ #define HTML_FIGCAPTION_ALIGN 1
+ #define HTML_FIGCAPTION_CLASS 2
+ #define HTML_FIGCAPTION_CLEAR 3
+ #define HTML_FIGCAPTION_DIR 4
+ #define HTML_FIGCAPTION_ID 5
+ #define HTML_FIGCAPTION_LANG 6
+ #define HTML_FIGCAPTION_STYLE 7
+ #define HTML_FIGCAPTION_TITLE 8
+ #define HTML_FIGCAPTION_ATTRIBUTES 9
+
#define HTML_FONT_CLASS 0
#define HTML_FONT_CLEAR 1
#define HTML_FONT_COLOR 2
Index: WWW/Library/Implementation/src0_HTMLDTD.h
*** lynx2.9.0dev.10/WWW/Library/Implementation/src0_HTMLDTD.h 2021-07-23
15:36:23.000000000 -0600
---
lynx2.9.0dev.10_patchedforfigcaption/WWW/Library/Implementation/src0_HTMLDTD.h
2022-10-24 12:28:06.688442504 -0600
***************
*** 50,55 ****
--- 50,56 ----
#define T_EMBED
0x02000,0x8F107,0x8FFF7,0xB6FBF,0xB7FBF,0x1FF7F,0x00001
#define T_FIELDSET
0x00200,0x8FB4F,0x8FF7F,0x186787,0x1B7FF7,0x8805F,0x00000
#define T_FIG
0x00200,0x0FB00,0x8FFFF,0x136680,0x1B6FBF,0x8834F,0x00000
+ #define T_FIGCAPTION
0x00100,0x0B04F,0x8FFFF,0x106A00,0x1B6FA7,0x8035F,0x00000
#define T_FIGURE
0x00200,0x8FBCF,0x8FFFF,0x1B66A0,0x1B7FFF,0x8031F,0x00004
#define T_FN
0x00200,0x8FBCF,0x8FFFF,0x1B6680,0x1B7EBF,0x8114F,0x00000
#define T_FONT
0x00001,0x8B04F,0x8FFFF,0xB778F,0xF7FBF,0x00001,0x00014
***************
*** 538,543 ****
--- 539,559 ----
{ 0, 0 },
};
+ static const attr FIGCAPTION_attr_list[] = {
+ { "ACCESSKEY" T(N) },
+ { "CLEAR" T(N) },
+ { 0 T(N) } /* Terminate list */
+ };
+
+ static const AttrType FIGCAPTION_attr_type[] = {
+ { ATTR_TYPE(align) },
+ { ATTR_TYPE(core) },
+ { ATTR_TYPE(events) },
+ { ATTR_TYPE(i18n) },
+ { ATTR_TYPE(FIGCAPTION) },
+ { 0, 0 },
+ };
+
static const attr FONT_attr_list[] = {
{ "CLEAR" T(N) },
{ "COLOR" T(N) },
***************
*** 1529,1534 ****
--- 1545,1563 ----
{ 0 T(N) } /* Terminate list */
};
+ static const attr FIGCAPTION_attr[] = { /* FIGCAPTION attributes */
+ { "ACCESSKEY" T(N) },
+ { "ALIGN" T(N) },
+ { "CLASS" T(c) },
+ { "CLEAR" T(N) },
+ { "DIR" T(N) },
+ { "ID" T(i) },
+ { "LANG" T(N) },
+ { "STYLE" T(N) },
+ { "TITLE" T(N) },
+ { 0 T(N) } /* Terminate list */
+ };
+
static const attr FONT_attr[] = { /* BASEFONT attributes */
{ "CLASS" T(c) },
{ "CLEAR" T(N) },
***************
*** 2207,2212 ****
--- 2236,2242 ----
#undef BR
#undef BUTTON
#undef CAPTION
+ #undef FIGCAPTION
#undef CENTER
#undef CITE
#undef CODE
***************
*** 2470,2475 ****
--- 2500,2508 ----
/* This one will be used as a temporary substitute within the parser when
it has been signalled to parse OBJECT content as MIXED. - kw */
{ P(OBJECT), ATTR_DATA(OBJECT), SGML_MIXED, T_OBJECT_PCDATA, 0,
0},
+ { P(FIGCAPTION), ATTR_DATA(FIGCAPTION), SGML_MIXED, T_CAPTION, 0, 0},
+ { P(LEGEND), ATTR_DATA(FIGCAPTION), SGML_MIXED, T_LEGEND, 0, 0},
+
};
/* *INDENT-ON* */
Index: WWW/Library/Implementation/src0_HTMLDTD.txt
*** lynx2.9.0dev.10/WWW/Library/Implementation/src0_HTMLDTD.txt 2021-07-23
15:36:20.000000000 -0600
---
lynx2.9.0dev.10_patchedforfigcaption/WWW/Library/Implementation/src0_HTMLDTD.txt
2022-10-24 11:52:10.762395289 -0600
***************
*** 528,533 ****
--- 528,539 ----
5:2:SRC
6:0:TYPE
7:0:WRAP
+
+ 60:FIGCAPTION
+ 2 attributes:
+ 0:0:ACCESSKEY
+ 1:0:CLEAR
+
128 tags
0:A
justify
***************
*** 2463,2468 ****
--- 2469,2475 ----
events
i18n
CAPTION
+ FIGCAPTION
contents: SGML_MIXED
tagclass: EMlike
contains: FONTlike EMlike MATHlike Alike SELECTlike BRlike
APPLETlike MAPlike
***************
*** 3897,3899 ****
--- 3904,3933 ----
icontained: FONTlike EMlike MATHlike Alike formula TRlike
SELECTlike FORMlike Plike DIVlike LIlike ULlike APPLETlike HRlike outer
BODYlike DELlike
canclose: FONTlike EMlike MATHlike Alike formula SELECTlike
Plike DIVlike LIlike MAPlike
flags: endO
+
+ 128:FIGCAPTION
+ justify
+ 9 attributes:
+ 0:0:ACCESSKEY
+ 1:0:ALIGN
+ 2:4:CLASS
+ 3:0:CLEAR
+ 4:0:DIR
+ 5:1:ID
+ 6:0:LANG
+ 7:0:STYLE
+ 8:0:TITLE
+ 5 attr_types
+ align
+ core
+ events
+ i18n
+ FIGCAPTION
+ contents: SGML_MIXED
+ tagclass: Plike
+ contains: FONTlike EMlike MATHlike Alike SELECTlike BRlike
APPLETlike MAPlike
+ icontains: FONTlike EMlike MATHlike Alike formula TRlike
SELECTlike FORMlike Plike DIVlike LIlike ULlike BRlike APPLETlike HRlike
MAPlike same
+ contained: DIVlike ULlike APPLETlike HRlike DELlike
+ icontained: FONTlike EMlike MATHlike TRlike FORMlike Plike
DIVlike LIlike ULlike APPLETlike HRlike outer BODYlike same DELlike
+ canclose: FONTlike EMlike MATHlike Alike formula SELECTlike
Plike DIVlike same
+ flags:
Index: WWW/Library/Implementation/src1_HTMLDTD.h
*** lynx2.9.0dev.10/WWW/Library/Implementation/src1_HTMLDTD.h 2021-07-23
15:36:23.000000000 -0600
---
lynx2.9.0dev.10_patchedforfigcaption/WWW/Library/Implementation/src1_HTMLDTD.h
2022-10-24 12:36:16.754315838 -0600
***************
*** 50,55 ****
--- 50,56 ----
#define T_EMBED
0x02000,0x8F107,0x8FFF7,0xB6FBF,0xB7FBF,0x1FF7F,0x00001
#define T_FIELDSET
0x00200,0x8FB4F,0x8FF7F,0x186787,0x1B7FF7,0x8805F,0x00000
#define T_FIG
0x00200,0x0FB00,0x8FFFF,0x136680,0x1B6FBF,0x8834F,0x00000
+ #define T_FIGCAPTION
0x00100,0x0B04F,0x8FFFF,0x106A00,0x1B6FA7,0x8035F,0x00000
#define T_FIGURE
0x00200,0x8FBCF,0x8FFFF,0x1B66A0,0x1B7FFF,0x8031F,0x00004
#define T_FN
0x00200,0x8FBCF,0x8FFFF,0x1B6680,0x1B7EBF,0x8114F,0x00000
#define T_FONT
0x00001,0x8B04F,0x8FFFF,0xB778F,0xF7FBF,0x00001,0x00014
***************
*** 538,543 ****
--- 539,559 ----
{ 0, 0 },
};
+ static const attr FIGCAPTION_attr_list[] = {
+ { "ACCESSKEY" T(N) },
+ { "CLEAR" T(N) },
+ { 0 T(N) } /* Terminate list */
+ };
+
+ static const AttrType FIGCAPTION_attr_type[] = {
+ { ATTR_TYPE(align) },
+ { ATTR_TYPE(core) },
+ { ATTR_TYPE(events) },
+ { ATTR_TYPE(i18n) },
+ { ATTR_TYPE(FIGCAPTION) },
+ { 0, 0 },
+ };
+
static const attr FONT_attr_list[] = {
{ "CLEAR" T(N) },
{ "COLOR" T(N) },
***************
*** 1528,1533 ****
--- 1544,1561 ----
{ "WIDTH" T(N) },
{ 0 T(N) } /* Terminate list */
};
+ static const attr FIGCAPTION_attr[] = { /* FIGCAPTION attributes */
+ { "ACCESSKEY" T(N) },
+ { "ALIGN" T(N) },
+ { "CLASS" T(c) },
+ { "CLEAR" T(N) },
+ { "DIR" T(N) },
+ { "ID" T(i) },
+ { "LANG" T(N) },
+ { "STYLE" T(N) },
+ { "TITLE" T(N) },
+ { 0 T(N) } /* Terminate list */
+ };
static const attr FONT_attr[] = { /* BASEFONT attributes */
{ "CLASS" T(c) },
***************
*** 2170,2175 ****
--- 2198,2204 ----
{ 0 T(N) } /* Terminate list */
};
+
/* *INDENT-ON* */
/* justification-flags */
***************
*** 2227,2232 ****
--- 2256,2262 ----
#undef EMBED
#undef FIELDSET
#undef FIG
+ #undef FIGCAPTION
#undef FIGURE
#undef FN
#undef FONT
***************
*** 2311,2317 ****
#undef WBR
#undef XMP
#undef OBJECT_PCDATA
-
/* these definitions are used in the tags-tables */
#undef P
#undef P_
--- 2341,2346 ----
***************
*** 2384,2389 ****
--- 2413,2419 ----
{ P(FIELDSET), ATTR_DATA(GEN), SGML_MIXED, T_FIELDSET, 0, 0},
{ P(FIG), ATTR_DATA(FIG), SGML_MIXED, T_FIG, 0, 0},
{ P(FIGURE), ATTR_DATA(GEN5), SGML_MIXED, T_FIGURE, 0, 0},
+ { P(FIGCAPTION), ATTR_DATA(FIGCAPTION), SGML_MIXED, T_FIGCAPTION, 0, 0},
{ P(FN), ATTR_DATA(GEN), SGML_MIXED, T_FN, 0, 0},
{ P(FONT), ATTR_DATA(FONT), SGML_MIXED, T_FONT, 0, 0},
{ P(FOOTER), ATTR_DATA(GEN5), SGML_MIXED, T_FOOTER, 0, 0},
Index: WWW/Library/Implementation/src1_HTMLDTD.txt
*** lynx2.9.0dev.10/WWW/Library/Implementation/src1_HTMLDTD.txt 2021-07-23
15:35:40.000000000 -0600
---
lynx2.9.0dev.10_patchedforfigcaption/WWW/Library/Implementation/src1_HTMLDTD.txt
2022-10-24 11:46:58.047304766 -0600
***************
*** 2463,2468 ****
--- 2463,2469 ----
events
i18n
CAPTION
+ FIGCAPTION
contents: SGML_MIXED
tagclass: EMlike
contains: FONTlike EMlike MATHlike Alike SELECTlike BRlike
APPLETlike MAPlike
***************
*** 3897,3899 ****
--- 3898,3931 ----
icontained: FONTlike EMlike MATHlike Alike formula TRlike
SELECTlike FORMlike Plike DIVlike LIlike ULlike APPLETlike HRlike outer
BODYlike DELlike
canclose: FONTlike EMlike MATHlike Alike formula SELECTlike
Plike DIVlike LIlike MAPlike
flags: endO
+
+ 128: FIGCAPTION
+ 2 attributes:
+ 0:0:ACCESSKEY
+ 1:0:CLEAR
+ 129:FIGCAPTION
+ justify
+ 9 attributes:
+ 0:0:ACCESSKEY
+ 1:0:ALIGN
+ 2:4:CLASS
+ 3:0:CLEAR
+ 4:0:DIR
+ 5:1:ID
+ 6:0:LANG
+ 7:0:STYLE
+ 8:0:TITLE
+ 5 attr_types
+ align
+ core
+ events
+ i18n
+ FIGCAPTION
+ contents: SGML_MIXED
+ tagclass: Plike
+ contains: FONTlike EMlike MATHlike Alike SELECTlike BRlike
APPLETlike MAPlike
+ icontains: FONTlike EMlike MATHlike Alike formula TRlike
SELECTlike FORMlike Plike DIVlike LIlike ULlike BRlike APPLETlike HRlike
MAPlike same
+ contained: DIVlike ULlike APPLETlike HRlike DELlike
+ icontained: FONTlike EMlike MATHlike TRlike FORMlike Plike
DIVlike LIlike ULlike APPLETlike HRlike outer BODYlike same DELlike
+ canclose: FONTlike EMlike MATHlike Alike formula SELECTlike
Plike DIVlike same
+ flags:
+ Index: src/HTML.c
+ --- lynx2.9.0dev.9+/src/HTML.c 2021-07-23 20:23:54.000000000 +0000
+ +++ lynx2.9.0dev.10/src/HTML.c 2021-10-24 19:10:57.000000000 +0000
+ @@ -1,5 +1,5 @@
+ /*
+ - * $LynxId: HTML.c,v 1.195 2021/07/23 20:23:54 tom Exp $
+ + * $LynxId: HTML.c,v 1.196 2021/10/24 19:10:57 tom Exp $
+ *
+ * Structured stream to Rich hypertext converter
+ * ============================================
+ @@ -6753,7 +6753,8 @@
+ *cp = '\0';
+ StrAllocCopy(temp, data);
+ *cp = '\n';
+ - data = (cp + 1);
+ + data = NULL; /* HTML_put_characters may overwrite this */
+ + StrAllocCopy(data, cp + 1);
+ } else {
+ if (*data != '\0') {
+ StrAllocCopy(temp, data);
+ @@ -6827,6 +6828,9 @@
+ FREE(temp);
+ }
+ }
+ + if (data != empty) {
+ + FREE(data);
+ + }
+ FREE(temp);
+ cp = NULL;
+ me->UsePlainSpace = FALSE;
+ Index: src/LYCharUtils.c
+ --- lynx2.9.0dev.9+/src/LYCharUtils.c 2021-06-29 22:01:12.000000000 +0000
+ +++ lynx2.9.0dev.10/src/LYCharUtils.c 2021-10-24 00:47:08.000000000 +0000
+ @@ -1,5 +1,5 @@
+ /*
+ - * $LynxId: LYCharUtils.c,v 1.136 2021/06/29 22:01:12 tom Exp $
+ + * $LynxId: LYCharUtils.c,v 1.137 2021/10/24 00:47:08 tom Exp $
+ *
+ * Functions associated with LYCharSets.c and the Lynx version of HTML.c -
FM
+ *
==========================================================================
+ @@ -2912,8 +2912,11 @@
+ p = StrChr(p, '\0');
+ *pound = '#'; /* restore */
+ convert_to_spaces(pound, FALSE);
+ - if (p < pound)
+ - strcpy(p, pound);
+ + if (p < pound) {
+ + int n;
+ +
+ + for (n = 0; (p[n] = pound[n]) != '\0'; ++n) ;
+ + }
+ }
+ }
+ }
Index: src/HTML.c
*** lynx2.9.0dev.10/src/HTML.c 2021-10-24 13:10:57.000000000 -0600
--- lynx2.9.0dev.10_patchedforfigcaption/src/HTML.c 2022-10-20
14:24:11.502729167 -0600
***************
*** 4088,4093 ****
--- 4088,4125 ----
me->inP = FALSE;
break;
+ case HTML_FIGCAPTION:
+ LYEnsureDoubleSpace(me);
+ LYResetParagraphAlignment(me);
+ me->inFIGCAPTION = TRUE;
+ CHECK_ID(HTML_FIGCAPTION_ID);
+ if (me->inUnderline == FALSE)
+ HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
+ HTML_put_string(me, "FIGCAPTION:");
+ if (me->inUnderline == FALSE)
+ HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
+ HTML_put_character(me, ' ');
+ CAN_JUSTIFY_START;
+
+ if (me->inFIG)
+ /*
+ * Assume all text in the FIG container is intended to be
+ * paragraphed. - FM
+ */
+ me->inFIGwithP = TRUE;
+
+ if (me->inAPPLET)
+ /*
+ * Assume all text in the APPLET container is intended to be
+ * paragraphed. - FM
+ */
+ me->inAPPLETwithP = TRUE;
+
+ me->inLABEL = TRUE;
+ me->in_word = NO;
+ me->inP = FALSE;
+ break;
+
case HTML_FORM:
{
char *action = NULL;
***************
*** 6564,6569 ****
--- 6596,6609 ----
me->inLABEL = FALSE;
break;
+ case HTML_FIGCAPTION:
+ LYEnsureDoubleSpace(me);
+ LYResetParagraphAlignment(me);
+ me->inFIGCAPTION = FALSE;
+ change_paragraph_style(me, me->sp->style); /* Often won't really
change */
+ me->inLABEL = FALSE;
+ break;
+
case HTML_CREDIT:
LYEnsureDoubleSpace(me);
LYResetParagraphAlignment(me);
***************
*** 7612,7617 ****
--- 7652,7658 ----
me->inBoldA = FALSE;
me->inBoldH = FALSE;
me->inCAPTION = FALSE;
+ me->inFIGCAPTION = FALSE;
me->inCREDIT = FALSE;
me->inFIG = FALSE;
me->inFIGwithP = FALSE;
Index: src/HTML.h
*** lynx2.9.0dev.10/src/HTML.h 2019-08-23 17:18:06.000000000 -0600
--- lynx2.9.0dev.10_patchedforfigcaption/src/HTML.h 2022-10-20
14:21:26.323794187 -0600
***************
*** 168,174 ****
BOOL inUnderline;
BOOL needBoldH;
!
char *xinclude; /* if no include strin address passed */
/*
* UCI and UCLYhndl give the UCInfo and charset registered for the HTML
--- 168,174 ----
BOOL inUnderline;
BOOL needBoldH;
! BOOL inFIGCAPTION;
char *xinclude; /* if no include strin address passed */
/*
* UCI and UCLYhndl give the UCInfo and charset registered for the HTML
Index: src/LYCharUtils.c
*** lynx2.9.0dev.10/src/LYCharUtils.c 2021-10-23 18:47:08.000000000 -0600
--- lynx2.9.0dev.10_patchedforfigcaption/src/LYCharUtils.c 2022-10-24
12:43:08.816164356 -0600
***************
*** 2596,2602 ****
*/
if (me->inP) {
if (me->inFIG || me->inAPPLET ||
! me->inCAPTION || me->inCREDIT ||
me->sp->style->spaceAfter > 0 ||
(start && me->sp->style->spaceBefore > 0)) {
LYEnsureDoubleSpace(me);
--- 2596,2602 ----
*/
if (me->inP) {
if (me->inFIG || me->inAPPLET ||
! me->inCAPTION || me->inCREDIT || me->inFIGCAPTION ||
me->sp->style->spaceAfter > 0 ||
(start && me->sp->style->spaceBefore > 0)) {
LYEnsureDoubleSpace(me);