File: 0013-Issue-712-Make-global-attribute-dir-accept-auto-for-.patch

package info (click to toggle)
tidy-html5 2%3A5.6.0-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,508 kB
  • sloc: ansic: 40,477; ruby: 841; sh: 293; makefile: 30; cpp: 30
file content (37 lines) | stat: -rw-r--r-- 1,894 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From: Doron Behar <doron.behar@gmail.com>
Date: Wed, 4 Apr 2018 13:29:30 +0300
Subject: Issue #712 - Make global attribute `dir` accept auto for HTML5

Applied-Upstream: https://github.com/htacg/tidy-html5/commit/8723681275ce1a1ec43f11c21db196698878cca2

---
 src/attrs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/attrs.c b/src/attrs.c
index 2aaf638..0fd0241 100644
--- a/src/attrs.c
+++ b/src/attrs.c
@@ -144,7 +144,7 @@ static const Attribute attribute_defs [] =
   { TidyAttr_DATETIME,                "datetime",                CH_DATE      }, /* INS, DEL */
   { TidyAttr_DECLARE,                 "declare",                 CH_BOOL      }, /* OBJECT */
   { TidyAttr_DEFER,                   "defer",                   CH_BOOL      }, /* SCRIPT */
-  { TidyAttr_DIR,                     "dir",                     CH_TEXTDIR   }, /* ltr or rtl */
+  { TidyAttr_DIR,                     "dir",                     CH_TEXTDIR   }, /* ltr, rtl or auto */
   { TidyAttr_DISABLED,                "disabled",                CH_BOOL      }, /* form fields */
   { TidyAttr_DOWNLOAD,                "download",                CH_PCDATA    }, /* anchor */
   { TidyAttr_ENCODING,                "encoding",                CH_PCDATA    }, /* <?xml?> */
@@ -2015,8 +2015,11 @@ void CheckScroll( TidyDocImpl* doc, Node *node, AttVal *attval)
 /* checks dir attribute */
 void CheckTextDir( TidyDocImpl* doc, Node *node, AttVal *attval)
 {
-    ctmbstr const values[] = {"rtl", "ltr", NULL};
-    CheckAttrValidity( doc, node, attval, values );
+    ctmbstr const values4[] = { "rtl", "ltr", NULL };
+    /* PR #712 - add 'auto' for HTML5 - @doronbehar */
+    ctmbstr const values5[] = { "rtl", "ltr", "auto", NULL };
+    CheckAttrValidity(doc, node, attval,
+        (TY_(IsHTML5Mode)(doc) ? values5 : values4));
 }
 
 /* checks lang and xml:lang attributes */