Fossil SCM

Merged in the relevant bits of branch markdown-details-open to allow the "open" attribute on the HTML \<details\> element. This pushes the attribute mask to 64-bit, so changed from raw 32-bit hex constants to a data-typed 64-bit shifting scheme to allow further expansion. Builds without warnings on 32-bit ARM at least.

wyoung 2026-06-21 14:25 UTC safe-html-extensions merge
Commit c799e2e5048e290a0672e79d906167c40095118df55f485a6a18c0fb731cb290
2 files changed +41 -39 +41 -39
+41 -39
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -88,10 +88,11 @@
8888
ATTR_LOW,
8989
ATTR_MAX,
9090
ATTR_MEDIA,
9191
ATTR_MIN,
9292
ATTR_NAME,
93
+ ATTR_OPEN,
9394
ATTR_OPTIMUM,
9495
ATTR_ROWSPAN,
9596
ATTR_SIZE,
9697
ATTR_SIZES,
9798
ATTR_SRC,
@@ -105,48 +106,48 @@
105106
ATTR_VALUE,
106107
ATTR_VSPACE,
107108
ATTR_WIDTH
108109
};
109110
110
-enum amsk_t {
111
- AMSK_ALIGN = 0x00000001,
112
- AMSK_ALT = 0x00000002,
113
- AMSK_BGCOLOR = 0x00000004,
114
- AMSK_BORDER = 0x00000008,
115
- AMSK_CELLPADDING = 0x00000010,
116
- AMSK_CELLSPACING = 0x00000020,
117
- AMSK_CLASS = 0x00000040,
118
- AMSK_CLEAR = 0x00000080,
119
- AMSK_COLOR = 0x00000100,
120
- AMSK_COLSPAN = 0x00000200,
121
- AMSK_COMPACT = 0x00000400,
122
- AMSK_FACE = 0x00000800,
123
- AMSK_HEIGHT = 0x00001000,
124
- AMSK_HREF = 0x00002000,
125
- AMSK_HSPACE = 0x00004000,
126
- AMSK_ID = 0x00008000,
127
- AMSK_LINKS = 0x00010000,
128
- AMSK_NAME = 0x00020000,
129
- AMSK_ROWSPAN = 0x00040000,
130
- AMSK_SIZE = 0x00080000,
131
- AMSK_SRC = 0x00100000,
132
- AMSK_START = 0x00200000,
133
- AMSK_STYLE = 0x00400000,
134
- AMSK_TARGET = 0x00800000,
135
- AMSK_TITLE = 0x01000000,
136
- AMSK_TYPE = 0x02000000,
137
- AMSK_VALIGN = 0x04000000,
138
- AMSK_VALUE = 0x08000000,
139
- AMSK_VSPACE = 0x10000000,
140
- AMSK_WIDTH = 0x20000000,
141
- AMSK_CITE = 0x40000000,
142
- AMSK_DATETIME = 0x80000000
143
-};
111
+typedef uint64_t amsk_t;
112
+#define AMSK_ALIGN ((amsk_t)1 << 0)
113
+#define AMSK_ALT ((amsk_t)1 << 1)
114
+#define AMSK_BGCOLOR ((amsk_t)1 << 2)
115
+#define AMSK_BORDER ((amsk_t)1 << 3)
116
+#define AMSK_CELLPADDING ((amsk_t)1 << 4)
117
+#define AMSK_CELLSPACING ((amsk_t)1 << 5)
118
+#define AMSK_CLASS ((amsk_t)1 << 6)
119
+#define AMSK_CLEAR ((amsk_t)1 << 7)
120
+#define AMSK_COLOR ((amsk_t)1 << 8)
121
+#define AMSK_COLSPAN ((amsk_t)1 << 9)
122
+#define AMSK_COMPACT ((amsk_t)1 << 10)
123
+#define AMSK_FACE ((amsk_t)1 << 11)
124
+#define AMSK_HEIGHT ((amsk_t)1 << 12)
125
+#define AMSK_HREF ((amsk_t)1 << 13)
126
+#define AMSK_HSPACE ((amsk_t)1 << 14)
127
+#define AMSK_ID ((amsk_t)1 << 15)
128
+#define AMSK_LINKS ((amsk_t)1 << 16)
129
+#define AMSK_NAME ((amsk_t)1 << 17)
130
+#define AMSK_OPEN ((amsk_t)1 << 18)
131
+#define AMSK_ROWSPAN ((amsk_t)1 << 19)
132
+#define AMSK_SIZE ((amsk_t)1 << 20)
133
+#define AMSK_SRC ((amsk_t)1 << 21)
134
+#define AMSK_START ((amsk_t)1 << 22)
135
+#define AMSK_STYLE ((amsk_t)1 << 23)
136
+#define AMSK_TARGET ((amsk_t)1 << 24)
137
+#define AMSK_TITLE ((amsk_t)1 << 25)
138
+#define AMSK_TYPE ((amsk_t)1 << 26)
139
+#define AMSK_VALIGN ((amsk_t)1 << 27)
140
+#define AMSK_VALUE ((amsk_t)1 << 28)
141
+#define AMSK_VSPACE ((amsk_t)1 << 29)
142
+#define AMSK_WIDTH ((amsk_t)1 << 30)
143
+#define AMSK_CITE ((amsk_t)1 << 31)
144
+#define AMSK_DATETIME ((amsk_t)1 << 32)
144145
145146
static const struct AllowedAttribute {
146147
const char *zName;
147
- unsigned int iMask;
148
+ amsk_t iMask;
148149
} aAttribute[] = {
149150
/* These indexes MUST line up with their
150151
corresponding allowed_attr_t enum values.
151152
*/
152153
{ 0, 0 },
@@ -174,10 +175,11 @@
174175
{ "low", 0 },
175176
{ "max", 0 },
176177
{ "media", 0 },
177178
{ "min", 0 },
178179
{ "name", AMSK_NAME },
180
+ { "open", AMSK_OPEN },
179181
{ "optimum", 0 },
180182
{ "rowspan", AMSK_ROWSPAN },
181183
{ "size", AMSK_SIZE },
182184
{ "sizes", 0 },
183185
{ "src", AMSK_SRC },
@@ -335,11 +337,11 @@
335337
336338
static const struct AllowedMarkup {
337339
const char *zName; /* Name of the markup */
338340
char iCode; /* The MARKUP_* code */
339341
short int iType; /* The MUTYPE_* code */
340
- int allowedAttr; /* Allowed attributes on this markup */
342
+ amsk_t allowedAttr; /* Allowed attributes on this markup */
341343
} aMarkup[] = {
342344
{ 0, MARKUP_INVALID, 0, 0 },
343345
{ "a", MARKUP_A, MUTYPE_HYPERLINK,
344346
AMSK_HREF|AMSK_NAME|AMSK_CLASS|AMSK_TARGET|AMSK_STYLE|
345347
AMSK_TITLE},
@@ -364,11 +366,11 @@
364366
{ "colgroup", MARKUP_COLGROUP, MUTYPE_BLOCK,
365367
AMSK_ALIGN|AMSK_CLASS|AMSK_COLSPAN|AMSK_WIDTH|AMSK_STYLE},
366368
{ "dd", MARKUP_DD, MUTYPE_LI, AMSK_STYLE },
367369
{ "del", MARKUP_DEL, MUTYPE_FONT, AMSK_STYLE },
368370
{ "details", MARKUP_DETAILS, MUTYPE_BLOCK,
369
- AMSK_ID|AMSK_CLASS|AMSK_STYLE },
371
+ AMSK_ID|AMSK_CLASS|AMSK_STYLE|AMSK_OPEN },
370372
{ "dfn", MARKUP_DFN, MUTYPE_FONT, AMSK_STYLE },
371373
{ "div", MARKUP_DIV, MUTYPE_BLOCK,
372374
AMSK_ID|AMSK_CLASS|AMSK_STYLE },
373375
{ "dl", MARKUP_DL, MUTYPE_LIST,
374376
AMSK_COMPACT|AMSK_STYLE },
@@ -894,15 +896,15 @@
894896
** Parse this element into the p structure.
895897
**
896898
** The content of z[] might be modified by converting characters
897899
** to lowercase and by inserting some "\000" characters.
898900
*/
899
-static int parseMarkup(ParsedMarkup *p, char *z){
901
+static amsk_t parseMarkup(ParsedMarkup *p, char *z){
900902
int i, j, c;
901903
int iACode;
902904
char *zValue;
903
- int seen = 0;
905
+ amsk_t seen = 0;
904906
char zTag[100];
905907
906908
if( z[1]=='/' ){
907909
p->endTag = 1;
908910
i = 2;
909911
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -88,10 +88,11 @@
88 ATTR_LOW,
89 ATTR_MAX,
90 ATTR_MEDIA,
91 ATTR_MIN,
92 ATTR_NAME,
 
93 ATTR_OPTIMUM,
94 ATTR_ROWSPAN,
95 ATTR_SIZE,
96 ATTR_SIZES,
97 ATTR_SRC,
@@ -105,48 +106,48 @@
105 ATTR_VALUE,
106 ATTR_VSPACE,
107 ATTR_WIDTH
108 };
109
110 enum amsk_t {
111 AMSK_ALIGN = 0x00000001,
112 AMSK_ALT = 0x00000002,
113 AMSK_BGCOLOR = 0x00000004,
114 AMSK_BORDER = 0x00000008,
115 AMSK_CELLPADDING = 0x00000010,
116 AMSK_CELLSPACING = 0x00000020,
117 AMSK_CLASS = 0x00000040,
118 AMSK_CLEAR = 0x00000080,
119 AMSK_COLOR = 0x00000100,
120 AMSK_COLSPAN = 0x00000200,
121 AMSK_COMPACT = 0x00000400,
122 AMSK_FACE = 0x00000800,
123 AMSK_HEIGHT = 0x00001000,
124 AMSK_HREF = 0x00002000,
125 AMSK_HSPACE = 0x00004000,
126 AMSK_ID = 0x00008000,
127 AMSK_LINKS = 0x00010000,
128 AMSK_NAME = 0x00020000,
129 AMSK_ROWSPAN = 0x00040000,
130 AMSK_SIZE = 0x00080000,
131 AMSK_SRC = 0x00100000,
132 AMSK_START = 0x00200000,
133 AMSK_STYLE = 0x00400000,
134 AMSK_TARGET = 0x00800000,
135 AMSK_TITLE = 0x01000000,
136 AMSK_TYPE = 0x02000000,
137 AMSK_VALIGN = 0x04000000,
138 AMSK_VALUE = 0x08000000,
139 AMSK_VSPACE = 0x10000000,
140 AMSK_WIDTH = 0x20000000,
141 AMSK_CITE = 0x40000000,
142 AMSK_DATETIME = 0x80000000
143 };
144
145 static const struct AllowedAttribute {
146 const char *zName;
147 unsigned int iMask;
148 } aAttribute[] = {
149 /* These indexes MUST line up with their
150 corresponding allowed_attr_t enum values.
151 */
152 { 0, 0 },
@@ -174,10 +175,11 @@
174 { "low", 0 },
175 { "max", 0 },
176 { "media", 0 },
177 { "min", 0 },
178 { "name", AMSK_NAME },
 
179 { "optimum", 0 },
180 { "rowspan", AMSK_ROWSPAN },
181 { "size", AMSK_SIZE },
182 { "sizes", 0 },
183 { "src", AMSK_SRC },
@@ -335,11 +337,11 @@
335
336 static const struct AllowedMarkup {
337 const char *zName; /* Name of the markup */
338 char iCode; /* The MARKUP_* code */
339 short int iType; /* The MUTYPE_* code */
340 int allowedAttr; /* Allowed attributes on this markup */
341 } aMarkup[] = {
342 { 0, MARKUP_INVALID, 0, 0 },
343 { "a", MARKUP_A, MUTYPE_HYPERLINK,
344 AMSK_HREF|AMSK_NAME|AMSK_CLASS|AMSK_TARGET|AMSK_STYLE|
345 AMSK_TITLE},
@@ -364,11 +366,11 @@
364 { "colgroup", MARKUP_COLGROUP, MUTYPE_BLOCK,
365 AMSK_ALIGN|AMSK_CLASS|AMSK_COLSPAN|AMSK_WIDTH|AMSK_STYLE},
366 { "dd", MARKUP_DD, MUTYPE_LI, AMSK_STYLE },
367 { "del", MARKUP_DEL, MUTYPE_FONT, AMSK_STYLE },
368 { "details", MARKUP_DETAILS, MUTYPE_BLOCK,
369 AMSK_ID|AMSK_CLASS|AMSK_STYLE },
370 { "dfn", MARKUP_DFN, MUTYPE_FONT, AMSK_STYLE },
371 { "div", MARKUP_DIV, MUTYPE_BLOCK,
372 AMSK_ID|AMSK_CLASS|AMSK_STYLE },
373 { "dl", MARKUP_DL, MUTYPE_LIST,
374 AMSK_COMPACT|AMSK_STYLE },
@@ -894,15 +896,15 @@
894 ** Parse this element into the p structure.
895 **
896 ** The content of z[] might be modified by converting characters
897 ** to lowercase and by inserting some "\000" characters.
898 */
899 static int parseMarkup(ParsedMarkup *p, char *z){
900 int i, j, c;
901 int iACode;
902 char *zValue;
903 int seen = 0;
904 char zTag[100];
905
906 if( z[1]=='/' ){
907 p->endTag = 1;
908 i = 2;
909
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -88,10 +88,11 @@
88 ATTR_LOW,
89 ATTR_MAX,
90 ATTR_MEDIA,
91 ATTR_MIN,
92 ATTR_NAME,
93 ATTR_OPEN,
94 ATTR_OPTIMUM,
95 ATTR_ROWSPAN,
96 ATTR_SIZE,
97 ATTR_SIZES,
98 ATTR_SRC,
@@ -105,48 +106,48 @@
106 ATTR_VALUE,
107 ATTR_VSPACE,
108 ATTR_WIDTH
109 };
110
111 typedef uint64_t amsk_t;
112 #define AMSK_ALIGN ((amsk_t)1 << 0)
113 #define AMSK_ALT ((amsk_t)1 << 1)
114 #define AMSK_BGCOLOR ((amsk_t)1 << 2)
115 #define AMSK_BORDER ((amsk_t)1 << 3)
116 #define AMSK_CELLPADDING ((amsk_t)1 << 4)
117 #define AMSK_CELLSPACING ((amsk_t)1 << 5)
118 #define AMSK_CLASS ((amsk_t)1 << 6)
119 #define AMSK_CLEAR ((amsk_t)1 << 7)
120 #define AMSK_COLOR ((amsk_t)1 << 8)
121 #define AMSK_COLSPAN ((amsk_t)1 << 9)
122 #define AMSK_COMPACT ((amsk_t)1 << 10)
123 #define AMSK_FACE ((amsk_t)1 << 11)
124 #define AMSK_HEIGHT ((amsk_t)1 << 12)
125 #define AMSK_HREF ((amsk_t)1 << 13)
126 #define AMSK_HSPACE ((amsk_t)1 << 14)
127 #define AMSK_ID ((amsk_t)1 << 15)
128 #define AMSK_LINKS ((amsk_t)1 << 16)
129 #define AMSK_NAME ((amsk_t)1 << 17)
130 #define AMSK_OPEN ((amsk_t)1 << 18)
131 #define AMSK_ROWSPAN ((amsk_t)1 << 19)
132 #define AMSK_SIZE ((amsk_t)1 << 20)
133 #define AMSK_SRC ((amsk_t)1 << 21)
134 #define AMSK_START ((amsk_t)1 << 22)
135 #define AMSK_STYLE ((amsk_t)1 << 23)
136 #define AMSK_TARGET ((amsk_t)1 << 24)
137 #define AMSK_TITLE ((amsk_t)1 << 25)
138 #define AMSK_TYPE ((amsk_t)1 << 26)
139 #define AMSK_VALIGN ((amsk_t)1 << 27)
140 #define AMSK_VALUE ((amsk_t)1 << 28)
141 #define AMSK_VSPACE ((amsk_t)1 << 29)
142 #define AMSK_WIDTH ((amsk_t)1 << 30)
143 #define AMSK_CITE ((amsk_t)1 << 31)
144 #define AMSK_DATETIME ((amsk_t)1 << 32)
145
146 static const struct AllowedAttribute {
147 const char *zName;
148 amsk_t iMask;
149 } aAttribute[] = {
150 /* These indexes MUST line up with their
151 corresponding allowed_attr_t enum values.
152 */
153 { 0, 0 },
@@ -174,10 +175,11 @@
175 { "low", 0 },
176 { "max", 0 },
177 { "media", 0 },
178 { "min", 0 },
179 { "name", AMSK_NAME },
180 { "open", AMSK_OPEN },
181 { "optimum", 0 },
182 { "rowspan", AMSK_ROWSPAN },
183 { "size", AMSK_SIZE },
184 { "sizes", 0 },
185 { "src", AMSK_SRC },
@@ -335,11 +337,11 @@
337
338 static const struct AllowedMarkup {
339 const char *zName; /* Name of the markup */
340 char iCode; /* The MARKUP_* code */
341 short int iType; /* The MUTYPE_* code */
342 amsk_t allowedAttr; /* Allowed attributes on this markup */
343 } aMarkup[] = {
344 { 0, MARKUP_INVALID, 0, 0 },
345 { "a", MARKUP_A, MUTYPE_HYPERLINK,
346 AMSK_HREF|AMSK_NAME|AMSK_CLASS|AMSK_TARGET|AMSK_STYLE|
347 AMSK_TITLE},
@@ -364,11 +366,11 @@
366 { "colgroup", MARKUP_COLGROUP, MUTYPE_BLOCK,
367 AMSK_ALIGN|AMSK_CLASS|AMSK_COLSPAN|AMSK_WIDTH|AMSK_STYLE},
368 { "dd", MARKUP_DD, MUTYPE_LI, AMSK_STYLE },
369 { "del", MARKUP_DEL, MUTYPE_FONT, AMSK_STYLE },
370 { "details", MARKUP_DETAILS, MUTYPE_BLOCK,
371 AMSK_ID|AMSK_CLASS|AMSK_STYLE|AMSK_OPEN },
372 { "dfn", MARKUP_DFN, MUTYPE_FONT, AMSK_STYLE },
373 { "div", MARKUP_DIV, MUTYPE_BLOCK,
374 AMSK_ID|AMSK_CLASS|AMSK_STYLE },
375 { "dl", MARKUP_DL, MUTYPE_LIST,
376 AMSK_COMPACT|AMSK_STYLE },
@@ -894,15 +896,15 @@
896 ** Parse this element into the p structure.
897 **
898 ** The content of z[] might be modified by converting characters
899 ** to lowercase and by inserting some "\000" characters.
900 */
901 static amsk_t parseMarkup(ParsedMarkup *p, char *z){
902 int i, j, c;
903 int iACode;
904 char *zValue;
905 amsk_t seen = 0;
906 char zTag[100];
907
908 if( z[1]=='/' ){
909 p->endTag = 1;
910 i = 2;
911
+41 -39
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -88,10 +88,11 @@
8888
ATTR_LOW,
8989
ATTR_MAX,
9090
ATTR_MEDIA,
9191
ATTR_MIN,
9292
ATTR_NAME,
93
+ ATTR_OPEN,
9394
ATTR_OPTIMUM,
9495
ATTR_ROWSPAN,
9596
ATTR_SIZE,
9697
ATTR_SIZES,
9798
ATTR_SRC,
@@ -105,48 +106,48 @@
105106
ATTR_VALUE,
106107
ATTR_VSPACE,
107108
ATTR_WIDTH
108109
};
109110
110
-enum amsk_t {
111
- AMSK_ALIGN = 0x00000001,
112
- AMSK_ALT = 0x00000002,
113
- AMSK_BGCOLOR = 0x00000004,
114
- AMSK_BORDER = 0x00000008,
115
- AMSK_CELLPADDING = 0x00000010,
116
- AMSK_CELLSPACING = 0x00000020,
117
- AMSK_CLASS = 0x00000040,
118
- AMSK_CLEAR = 0x00000080,
119
- AMSK_COLOR = 0x00000100,
120
- AMSK_COLSPAN = 0x00000200,
121
- AMSK_COMPACT = 0x00000400,
122
- AMSK_FACE = 0x00000800,
123
- AMSK_HEIGHT = 0x00001000,
124
- AMSK_HREF = 0x00002000,
125
- AMSK_HSPACE = 0x00004000,
126
- AMSK_ID = 0x00008000,
127
- AMSK_LINKS = 0x00010000,
128
- AMSK_NAME = 0x00020000,
129
- AMSK_ROWSPAN = 0x00040000,
130
- AMSK_SIZE = 0x00080000,
131
- AMSK_SRC = 0x00100000,
132
- AMSK_START = 0x00200000,
133
- AMSK_STYLE = 0x00400000,
134
- AMSK_TARGET = 0x00800000,
135
- AMSK_TITLE = 0x01000000,
136
- AMSK_TYPE = 0x02000000,
137
- AMSK_VALIGN = 0x04000000,
138
- AMSK_VALUE = 0x08000000,
139
- AMSK_VSPACE = 0x10000000,
140
- AMSK_WIDTH = 0x20000000,
141
- AMSK_CITE = 0x40000000,
142
- AMSK_DATETIME = 0x80000000
143
-};
111
+typedef uint64_t amsk_t;
112
+#define AMSK_ALIGN ((amsk_t)1 << 0)
113
+#define AMSK_ALT ((amsk_t)1 << 1)
114
+#define AMSK_BGCOLOR ((amsk_t)1 << 2)
115
+#define AMSK_BORDER ((amsk_t)1 << 3)
116
+#define AMSK_CELLPADDING ((amsk_t)1 << 4)
117
+#define AMSK_CELLSPACING ((amsk_t)1 << 5)
118
+#define AMSK_CLASS ((amsk_t)1 << 6)
119
+#define AMSK_CLEAR ((amsk_t)1 << 7)
120
+#define AMSK_COLOR ((amsk_t)1 << 8)
121
+#define AMSK_COLSPAN ((amsk_t)1 << 9)
122
+#define AMSK_COMPACT ((amsk_t)1 << 10)
123
+#define AMSK_FACE ((amsk_t)1 << 11)
124
+#define AMSK_HEIGHT ((amsk_t)1 << 12)
125
+#define AMSK_HREF ((amsk_t)1 << 13)
126
+#define AMSK_HSPACE ((amsk_t)1 << 14)
127
+#define AMSK_ID ((amsk_t)1 << 15)
128
+#define AMSK_LINKS ((amsk_t)1 << 16)
129
+#define AMSK_NAME ((amsk_t)1 << 17)
130
+#define AMSK_OPEN ((amsk_t)1 << 18)
131
+#define AMSK_ROWSPAN ((amsk_t)1 << 19)
132
+#define AMSK_SIZE ((amsk_t)1 << 20)
133
+#define AMSK_SRC ((amsk_t)1 << 21)
134
+#define AMSK_START ((amsk_t)1 << 22)
135
+#define AMSK_STYLE ((amsk_t)1 << 23)
136
+#define AMSK_TARGET ((amsk_t)1 << 24)
137
+#define AMSK_TITLE ((amsk_t)1 << 25)
138
+#define AMSK_TYPE ((amsk_t)1 << 26)
139
+#define AMSK_VALIGN ((amsk_t)1 << 27)
140
+#define AMSK_VALUE ((amsk_t)1 << 28)
141
+#define AMSK_VSPACE ((amsk_t)1 << 29)
142
+#define AMSK_WIDTH ((amsk_t)1 << 30)
143
+#define AMSK_CITE ((amsk_t)1 << 31)
144
+#define AMSK_DATETIME ((amsk_t)1 << 32)
144145
145146
static const struct AllowedAttribute {
146147
const char *zName;
147
- unsigned int iMask;
148
+ amsk_t iMask;
148149
} aAttribute[] = {
149150
/* These indexes MUST line up with their
150151
corresponding allowed_attr_t enum values.
151152
*/
152153
{ 0, 0 },
@@ -174,10 +175,11 @@
174175
{ "low", 0 },
175176
{ "max", 0 },
176177
{ "media", 0 },
177178
{ "min", 0 },
178179
{ "name", AMSK_NAME },
180
+ { "open", AMSK_OPEN },
179181
{ "optimum", 0 },
180182
{ "rowspan", AMSK_ROWSPAN },
181183
{ "size", AMSK_SIZE },
182184
{ "sizes", 0 },
183185
{ "src", AMSK_SRC },
@@ -335,11 +337,11 @@
335337
336338
static const struct AllowedMarkup {
337339
const char *zName; /* Name of the markup */
338340
char iCode; /* The MARKUP_* code */
339341
short int iType; /* The MUTYPE_* code */
340
- int allowedAttr; /* Allowed attributes on this markup */
342
+ amsk_t allowedAttr; /* Allowed attributes on this markup */
341343
} aMarkup[] = {
342344
{ 0, MARKUP_INVALID, 0, 0 },
343345
{ "a", MARKUP_A, MUTYPE_HYPERLINK,
344346
AMSK_HREF|AMSK_NAME|AMSK_CLASS|AMSK_TARGET|AMSK_STYLE|
345347
AMSK_TITLE},
@@ -364,11 +366,11 @@
364366
{ "colgroup", MARKUP_COLGROUP, MUTYPE_BLOCK,
365367
AMSK_ALIGN|AMSK_CLASS|AMSK_COLSPAN|AMSK_WIDTH|AMSK_STYLE},
366368
{ "dd", MARKUP_DD, MUTYPE_LI, AMSK_STYLE },
367369
{ "del", MARKUP_DEL, MUTYPE_FONT, AMSK_STYLE },
368370
{ "details", MARKUP_DETAILS, MUTYPE_BLOCK,
369
- AMSK_ID|AMSK_CLASS|AMSK_STYLE },
371
+ AMSK_ID|AMSK_CLASS|AMSK_STYLE|AMSK_OPEN },
370372
{ "dfn", MARKUP_DFN, MUTYPE_FONT, AMSK_STYLE },
371373
{ "div", MARKUP_DIV, MUTYPE_BLOCK,
372374
AMSK_ID|AMSK_CLASS|AMSK_STYLE },
373375
{ "dl", MARKUP_DL, MUTYPE_LIST,
374376
AMSK_COMPACT|AMSK_STYLE },
@@ -894,15 +896,15 @@
894896
** Parse this element into the p structure.
895897
**
896898
** The content of z[] might be modified by converting characters
897899
** to lowercase and by inserting some "\000" characters.
898900
*/
899
-static int parseMarkup(ParsedMarkup *p, char *z){
901
+static amsk_t parseMarkup(ParsedMarkup *p, char *z){
900902
int i, j, c;
901903
int iACode;
902904
char *zValue;
903
- int seen = 0;
905
+ amsk_t seen = 0;
904906
char zTag[100];
905907
906908
if( z[1]=='/' ){
907909
p->endTag = 1;
908910
i = 2;
909911
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -88,10 +88,11 @@
88 ATTR_LOW,
89 ATTR_MAX,
90 ATTR_MEDIA,
91 ATTR_MIN,
92 ATTR_NAME,
 
93 ATTR_OPTIMUM,
94 ATTR_ROWSPAN,
95 ATTR_SIZE,
96 ATTR_SIZES,
97 ATTR_SRC,
@@ -105,48 +106,48 @@
105 ATTR_VALUE,
106 ATTR_VSPACE,
107 ATTR_WIDTH
108 };
109
110 enum amsk_t {
111 AMSK_ALIGN = 0x00000001,
112 AMSK_ALT = 0x00000002,
113 AMSK_BGCOLOR = 0x00000004,
114 AMSK_BORDER = 0x00000008,
115 AMSK_CELLPADDING = 0x00000010,
116 AMSK_CELLSPACING = 0x00000020,
117 AMSK_CLASS = 0x00000040,
118 AMSK_CLEAR = 0x00000080,
119 AMSK_COLOR = 0x00000100,
120 AMSK_COLSPAN = 0x00000200,
121 AMSK_COMPACT = 0x00000400,
122 AMSK_FACE = 0x00000800,
123 AMSK_HEIGHT = 0x00001000,
124 AMSK_HREF = 0x00002000,
125 AMSK_HSPACE = 0x00004000,
126 AMSK_ID = 0x00008000,
127 AMSK_LINKS = 0x00010000,
128 AMSK_NAME = 0x00020000,
129 AMSK_ROWSPAN = 0x00040000,
130 AMSK_SIZE = 0x00080000,
131 AMSK_SRC = 0x00100000,
132 AMSK_START = 0x00200000,
133 AMSK_STYLE = 0x00400000,
134 AMSK_TARGET = 0x00800000,
135 AMSK_TITLE = 0x01000000,
136 AMSK_TYPE = 0x02000000,
137 AMSK_VALIGN = 0x04000000,
138 AMSK_VALUE = 0x08000000,
139 AMSK_VSPACE = 0x10000000,
140 AMSK_WIDTH = 0x20000000,
141 AMSK_CITE = 0x40000000,
142 AMSK_DATETIME = 0x80000000
143 };
144
145 static const struct AllowedAttribute {
146 const char *zName;
147 unsigned int iMask;
148 } aAttribute[] = {
149 /* These indexes MUST line up with their
150 corresponding allowed_attr_t enum values.
151 */
152 { 0, 0 },
@@ -174,10 +175,11 @@
174 { "low", 0 },
175 { "max", 0 },
176 { "media", 0 },
177 { "min", 0 },
178 { "name", AMSK_NAME },
 
179 { "optimum", 0 },
180 { "rowspan", AMSK_ROWSPAN },
181 { "size", AMSK_SIZE },
182 { "sizes", 0 },
183 { "src", AMSK_SRC },
@@ -335,11 +337,11 @@
335
336 static const struct AllowedMarkup {
337 const char *zName; /* Name of the markup */
338 char iCode; /* The MARKUP_* code */
339 short int iType; /* The MUTYPE_* code */
340 int allowedAttr; /* Allowed attributes on this markup */
341 } aMarkup[] = {
342 { 0, MARKUP_INVALID, 0, 0 },
343 { "a", MARKUP_A, MUTYPE_HYPERLINK,
344 AMSK_HREF|AMSK_NAME|AMSK_CLASS|AMSK_TARGET|AMSK_STYLE|
345 AMSK_TITLE},
@@ -364,11 +366,11 @@
364 { "colgroup", MARKUP_COLGROUP, MUTYPE_BLOCK,
365 AMSK_ALIGN|AMSK_CLASS|AMSK_COLSPAN|AMSK_WIDTH|AMSK_STYLE},
366 { "dd", MARKUP_DD, MUTYPE_LI, AMSK_STYLE },
367 { "del", MARKUP_DEL, MUTYPE_FONT, AMSK_STYLE },
368 { "details", MARKUP_DETAILS, MUTYPE_BLOCK,
369 AMSK_ID|AMSK_CLASS|AMSK_STYLE },
370 { "dfn", MARKUP_DFN, MUTYPE_FONT, AMSK_STYLE },
371 { "div", MARKUP_DIV, MUTYPE_BLOCK,
372 AMSK_ID|AMSK_CLASS|AMSK_STYLE },
373 { "dl", MARKUP_DL, MUTYPE_LIST,
374 AMSK_COMPACT|AMSK_STYLE },
@@ -894,15 +896,15 @@
894 ** Parse this element into the p structure.
895 **
896 ** The content of z[] might be modified by converting characters
897 ** to lowercase and by inserting some "\000" characters.
898 */
899 static int parseMarkup(ParsedMarkup *p, char *z){
900 int i, j, c;
901 int iACode;
902 char *zValue;
903 int seen = 0;
904 char zTag[100];
905
906 if( z[1]=='/' ){
907 p->endTag = 1;
908 i = 2;
909
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -88,10 +88,11 @@
88 ATTR_LOW,
89 ATTR_MAX,
90 ATTR_MEDIA,
91 ATTR_MIN,
92 ATTR_NAME,
93 ATTR_OPEN,
94 ATTR_OPTIMUM,
95 ATTR_ROWSPAN,
96 ATTR_SIZE,
97 ATTR_SIZES,
98 ATTR_SRC,
@@ -105,48 +106,48 @@
106 ATTR_VALUE,
107 ATTR_VSPACE,
108 ATTR_WIDTH
109 };
110
111 typedef uint64_t amsk_t;
112 #define AMSK_ALIGN ((amsk_t)1 << 0)
113 #define AMSK_ALT ((amsk_t)1 << 1)
114 #define AMSK_BGCOLOR ((amsk_t)1 << 2)
115 #define AMSK_BORDER ((amsk_t)1 << 3)
116 #define AMSK_CELLPADDING ((amsk_t)1 << 4)
117 #define AMSK_CELLSPACING ((amsk_t)1 << 5)
118 #define AMSK_CLASS ((amsk_t)1 << 6)
119 #define AMSK_CLEAR ((amsk_t)1 << 7)
120 #define AMSK_COLOR ((amsk_t)1 << 8)
121 #define AMSK_COLSPAN ((amsk_t)1 << 9)
122 #define AMSK_COMPACT ((amsk_t)1 << 10)
123 #define AMSK_FACE ((amsk_t)1 << 11)
124 #define AMSK_HEIGHT ((amsk_t)1 << 12)
125 #define AMSK_HREF ((amsk_t)1 << 13)
126 #define AMSK_HSPACE ((amsk_t)1 << 14)
127 #define AMSK_ID ((amsk_t)1 << 15)
128 #define AMSK_LINKS ((amsk_t)1 << 16)
129 #define AMSK_NAME ((amsk_t)1 << 17)
130 #define AMSK_OPEN ((amsk_t)1 << 18)
131 #define AMSK_ROWSPAN ((amsk_t)1 << 19)
132 #define AMSK_SIZE ((amsk_t)1 << 20)
133 #define AMSK_SRC ((amsk_t)1 << 21)
134 #define AMSK_START ((amsk_t)1 << 22)
135 #define AMSK_STYLE ((amsk_t)1 << 23)
136 #define AMSK_TARGET ((amsk_t)1 << 24)
137 #define AMSK_TITLE ((amsk_t)1 << 25)
138 #define AMSK_TYPE ((amsk_t)1 << 26)
139 #define AMSK_VALIGN ((amsk_t)1 << 27)
140 #define AMSK_VALUE ((amsk_t)1 << 28)
141 #define AMSK_VSPACE ((amsk_t)1 << 29)
142 #define AMSK_WIDTH ((amsk_t)1 << 30)
143 #define AMSK_CITE ((amsk_t)1 << 31)
144 #define AMSK_DATETIME ((amsk_t)1 << 32)
145
146 static const struct AllowedAttribute {
147 const char *zName;
148 amsk_t iMask;
149 } aAttribute[] = {
150 /* These indexes MUST line up with their
151 corresponding allowed_attr_t enum values.
152 */
153 { 0, 0 },
@@ -174,10 +175,11 @@
175 { "low", 0 },
176 { "max", 0 },
177 { "media", 0 },
178 { "min", 0 },
179 { "name", AMSK_NAME },
180 { "open", AMSK_OPEN },
181 { "optimum", 0 },
182 { "rowspan", AMSK_ROWSPAN },
183 { "size", AMSK_SIZE },
184 { "sizes", 0 },
185 { "src", AMSK_SRC },
@@ -335,11 +337,11 @@
337
338 static const struct AllowedMarkup {
339 const char *zName; /* Name of the markup */
340 char iCode; /* The MARKUP_* code */
341 short int iType; /* The MUTYPE_* code */
342 amsk_t allowedAttr; /* Allowed attributes on this markup */
343 } aMarkup[] = {
344 { 0, MARKUP_INVALID, 0, 0 },
345 { "a", MARKUP_A, MUTYPE_HYPERLINK,
346 AMSK_HREF|AMSK_NAME|AMSK_CLASS|AMSK_TARGET|AMSK_STYLE|
347 AMSK_TITLE},
@@ -364,11 +366,11 @@
366 { "colgroup", MARKUP_COLGROUP, MUTYPE_BLOCK,
367 AMSK_ALIGN|AMSK_CLASS|AMSK_COLSPAN|AMSK_WIDTH|AMSK_STYLE},
368 { "dd", MARKUP_DD, MUTYPE_LI, AMSK_STYLE },
369 { "del", MARKUP_DEL, MUTYPE_FONT, AMSK_STYLE },
370 { "details", MARKUP_DETAILS, MUTYPE_BLOCK,
371 AMSK_ID|AMSK_CLASS|AMSK_STYLE|AMSK_OPEN },
372 { "dfn", MARKUP_DFN, MUTYPE_FONT, AMSK_STYLE },
373 { "div", MARKUP_DIV, MUTYPE_BLOCK,
374 AMSK_ID|AMSK_CLASS|AMSK_STYLE },
375 { "dl", MARKUP_DL, MUTYPE_LIST,
376 AMSK_COMPACT|AMSK_STYLE },
@@ -894,15 +896,15 @@
896 ** Parse this element into the p structure.
897 **
898 ** The content of z[] might be modified by converting characters
899 ** to lowercase and by inserting some "\000" characters.
900 */
901 static amsk_t parseMarkup(ParsedMarkup *p, char *z){
902 int i, j, c;
903 int iACode;
904 char *zValue;
905 amsk_t seen = 0;
906 char zTag[100];
907
908 if( z[1]=='/' ){
909 p->endTag = 1;
910 i = 2;
911

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button