Skip to content

Commit 0a33462

Browse files
committed
fix: simplify namings
1 parent 51f62a2 commit 0a33462

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

ios/inputParser/EnrichedHTMLParser.mm

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ - (HTMLElement *)containerForBlock:(NSNumber *)currentParagraphType
139139
return outer;
140140
}
141141

142-
BOOL isTheSameBlock = currentParagraphType == previousParagraphType;
142+
BOOL isTheSameParagraph = currentParagraphType == previousParagraphType;
143143
id<BaseStyleProtocol> styleObject = _styles[currentParagraphType];
144144
Class styleClass = styleObject.class;
145145

146146
BOOL hasSubTags = [styleClass subTagName] != NULL;
147147

148-
if (isTheSameBlock && hasSubTags)
148+
if (isTheSameParagraph && hasSubTags)
149149
return previousNode;
150150

151151
HTMLElement *outer = [HTMLElement new];
@@ -187,32 +187,30 @@ - (HTMLNode *)getInlineStyleNodes:(NSAttributedString *)text
187187
for (NSNumber *sty in _inlineOrder) {
188188

189189
id<BaseStyleProtocol> obj = _styles[sty];
190-
Class cls = obj.class;
190+
Class styleClass = obj.class;
191191

192-
NSString *key = [cls attributeKey];
192+
NSString *key = [styleClass attributeKey];
193193
id v = attrs[key];
194194

195195
if (!v || ![obj styleCondition:v range:range])
196196
continue;
197197

198198
HTMLElement *wrap = [HTMLElement new];
199-
const char *tag = [cls tagName];
199+
const char *tag = [styleClass tagName];
200200

201201
wrap.tag = tag;
202202
wrap.attributes =
203-
[cls respondsToSelector:@selector(getParametersFromValue:)]
204-
? [cls getParametersFromValue:v]
203+
[styleClass respondsToSelector:@selector(getParametersFromValue:)]
204+
? [styleClass getParametersFromValue:v]
205205
: nullptr;
206-
wrap.selfClosing = [cls isSelfClosing];
206+
wrap.selfClosing = [styleClass isSelfClosing];
207207
[wrap.children addObject:currentNode];
208208
currentNode = wrap;
209209
}
210210

211211
return currentNode;
212212
}
213213

214-
#pragma mark - Rendering
215-
216214
- (void)createHtmlFromNode:(HTMLNode *)node
217215
into:(NSMutableData *)buf
218216
pretify:(BOOL)pretify {
@@ -225,25 +223,27 @@ - (void)createHtmlFromNode:(HTMLNode *)node
225223
if (![node isKindOfClass:[HTMLElement class]])
226224
return;
227225

228-
HTMLElement *el = (HTMLElement *)node;
226+
HTMLElement *element = (HTMLElement *)node;
229227

230-
BOOL addNewLineBefore = pretify && isBlockTag(el.tag);
231-
BOOL addNewLineAfter = pretify && needsNewLineAfter(el.tag);
228+
BOOL addNewLineBefore = pretify && isBlockTag(element.tag);
229+
BOOL addNewLineAfter = pretify && needsNewLineAfter(element.tag);
232230

233-
if (el.selfClosing) {
234-
appendSelfClosingTagC(buf, el.tag, el.attributes, addNewLineBefore);
231+
if (element.selfClosing) {
232+
appendSelfClosingTag(buf, element.tag, element.attributes,
233+
addNewLineBefore);
235234
return;
236235
}
237236

238-
appendOpenTagC(buf, el.tag, el.attributes ?: nullptr, addNewLineBefore);
237+
appendOpenTag(buf, element.tag, element.attributes ?: nullptr,
238+
addNewLineBefore);
239239

240-
for (HTMLNode *child in el.children)
240+
for (HTMLNode *child in element.children)
241241
[self createHtmlFromNode:child into:buf pretify:pretify];
242242

243243
if (addNewLineAfter)
244244
appendC(buf, "\n");
245245

246-
appendCloseTagC(buf, el.tag);
246+
appendCloseTag(buf, element.tag);
247247
}
248248

249249
@end

ios/inputParser/EnrichedHTMLTagUtils.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ static inline BOOL needsNewLineAfter(const char *t) {
9393
strcmp(t, "html") == 0);
9494
}
9595

96-
static inline void appendOpenTagC(NSMutableData *buf, const char *t,
97-
NSDictionary *attrs, BOOL block) {
96+
static inline void appendOpenTag(NSMutableData *buf, const char *t,
97+
NSDictionary *attrs, BOOL block) {
9898
if (block)
9999
appendC(buf, "\n<");
100100
else
@@ -107,8 +107,8 @@ static inline void appendOpenTagC(NSMutableData *buf, const char *t,
107107
appendC(buf, ">");
108108
}
109109

110-
static inline void appendSelfClosingTagC(NSMutableData *buf, const char *t,
111-
NSDictionary *attrs, BOOL block) {
110+
static inline void appendSelfClosingTag(NSMutableData *buf, const char *t,
111+
NSDictionary *attrs, BOOL block) {
112112
if (block)
113113
appendC(buf, "\n<");
114114
else
@@ -121,7 +121,7 @@ static inline void appendSelfClosingTagC(NSMutableData *buf, const char *t,
121121
appendC(buf, "/>");
122122
}
123123

124-
static inline void appendCloseTagC(NSMutableData *buf, const char *t) {
124+
static inline void appendCloseTag(NSMutableData *buf, const char *t) {
125125
appendC(buf, "</");
126126
appendC(buf, t);
127127
appendC(buf, ">");

0 commit comments

Comments
 (0)