forked from Mynigma/HTMLPurifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLPurifier_HTMLModule_Tables.m
More file actions
53 lines (36 loc) · 2.28 KB
/
HTMLPurifier_HTMLModule_Tables.m
File metadata and controls
53 lines (36 loc) · 2.28 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// HTMLPurifier_HTMLModule_Tables.m
// HTMLPurifier
//
// Created by Roman Priebe on 18.01.14.
#import "HTMLPurifier_HTMLModule_Tables.h"
#import "HTMLPurifier_ChildDef_Tables.h"
/**
* XHTML 1.1 Tables Module, fully defines accessible table elements.
*/
@implementation HTMLPurifier_HTMLModule_Tables
- (id)initWithConfig:(HTMLPurifier_Config*)config
{
self = [super initWithConfig:config];
if (self) {
self.name = @"Tables";
[self addElement:@"caption" type:nil contents:@"Inline" attrIncludes:@"Common" attr:nil];
[self addElement:@"table" type:@"Block" contents:[HTMLPurifier_ChildDef_Tables new] attrIncludes:@"Common" attr:@{@"border":@"Pixels", @"cellpadding":@"Length", @"cellspacing":@"Length", @"frame":@"Enum#void,above,below,hsides,lhs,rhs,vsides,box,border", @"rules":@"Enum#none,groups,rows,cols,all", @"summary":@"Text", @"width":@"Length"}];
// common attributes
NSDictionary* cell_align = @{@"align":@"Enum#left,center,right,justify,char", @"charoff":@"Length", @"valign":@"Enum#top,middle,bottom,baseline"};
NSMutableDictionary* cell_t = [cell_align mutableCopy];
[cell_t addEntriesFromDictionary:@{@"abbr":@"Text", @"colspan":@"Number", @"rowspan":@"Number", @"scope":@"Enum#row,col,rowgroup,colgroup"}];
[self addElement:@"td" type:nil contents:@"Flow" attrIncludes:@"Common" attr:cell_t];
[self addElement:@"th" type:nil contents:@"Flow" attrIncludes:@"Common" attr:cell_t];
[self addElement:@"tr" type:nil contents:@"Required: td | th" attrIncludes:@"Common" attr:cell_align];
NSMutableDictionary* cell_col = [cell_align mutableCopy];
[cell_col addEntriesFromDictionary:@{@"span":@"Number",@"width":@"MultiLength"}];
[self addElement:@"col" type:nil contents:@"Empty" attrIncludes:@"Common" attr:cell_col];
[self addElement:@"colgroup" type:nil contents:@"Optional: col" attrIncludes:@"Common" attr:cell_col];
[self addElement:@"tbody" type:nil contents:@"Required: tr" attrIncludes:@"Common" attr:cell_align];
[self addElement:@"thead" type:nil contents:@"Required: tr" attrIncludes:@"Common" attr:cell_align];
[self addElement:@"tfoot" type:nil contents:@"Required: tr" attrIncludes:@"Common" attr:cell_align];
}
return self;
}
@end