forked from Mynigma/HTMLPurifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLPurifier_HTMLModule_Edit.m
More file actions
51 lines (37 loc) · 1.29 KB
/
HTMLPurifier_HTMLModule_Edit.m
File metadata and controls
51 lines (37 loc) · 1.29 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
//
// HTMLPurifier_HTMLModule_Edit.m
// HTMLPurifier
//
// Created by Roman Priebe on 18.01.14.
#import "HTMLPurifier_HTMLModule_Edit.h"
#import "HTMLPurifier_ElementDef.h"
#import "BasicPHP.h"
#import "HTMLPurifier_ChildDef_Chameleon.h"
/**
* XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
* Module.
*/
@implementation HTMLPurifier_HTMLModule_Edit
- (id)initWithConfig:(HTMLPurifier_Config*)config
{
self = [super initWithConfig:config];
if (self) {
self.name = @"Edit";
NSString* contents = @"Chameleon: #PCDATA | Inline ! #PCDATA | Flow";
NSMutableDictionary* attr = [@{@"cite":@"URI"} mutableCopy];
[self addElement:@"del" type:@"Inline" contents:contents attrIncludes:@"Common" attr:attr];
[self addElement:@"ins" type:@"Inline" contents:contents attrIncludes:@"Common" attr:attr];
self.defines_child_def = YES;
}
return self;
}
- (HTMLPurifier_ChildDef_Chameleon*)getChildDef:(HTMLPurifier_ElementDef*)def
{
if (![[def.content_model_type lowercaseString] isEqual:@"chameleon"])
{
return nil;
}
NSArray* value = explode(@"!", def.content_model);
return [[HTMLPurifier_ChildDef_Chameleon alloc] initWithInline:value[0] block:value[1]];
}
@end