MCPcopy Create free account
hub / github.com/ByConity/ByConity / extract

Function extract

src/Functions/extractTextFromHTML.cpp:264–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264size_t extract(const char * __restrict src, size_t size, char * __restrict dst)
265{
266 /** There are the following rules:
267 * - comments are removed with all their content;
268 * - elements 'script' and 'style' are removed with all their content;
269 * - for other elements tags are removed but content is processed as text;
270 * - CDATA should be copied verbatim;
271 */
272
273 const char * end = src + size;
274 char * dst_begin = dst;
275
276 while (src < end)
277 {
278 bool needs_whitespace = dst != dst_begin && dst[-1] != ' ';
279 copyText(src, end, dst, needs_whitespace);
280
281 processComment(src, end)
282 || processCDATA(src, end, dst)
283 || processElementAndSkipContent(src, end, "script")
284 || processElementAndSkipContent(src, end, "style")
285 || skipTag(src, end);
286 }
287
288 return dst - dst_begin;
289}
290
291}
292

Callers 15

mockInfoFunction · 0.85
isInliningCandidateMethod · 0.85
isJoinClauseMethod · 0.85
extractMethod · 0.85
rewriteMethod · 0.85
isScopedMethod · 0.85
isNotScopedMethod · 0.85
pruneMethod · 0.85
containsCorrelationMethod · 0.85

Calls 5

copyTextFunction · 0.85
processCommentFunction · 0.85
processCDATAFunction · 0.85
skipTagFunction · 0.85

Tested by

no test coverage detected