diff options
| Commit | 9ae6631a116ed65bd890cbcc9d2d1fb0947f8cb2 (patch) | |
|---|---|---|
| Author | 2023-09-10 19:17:15 +0300 | |
| Committer | 2023-09-10 19:17:15 +0300 | |
| Files | 61e8faef1d24aa6dc5850329ad8e3a6de8fd7079 | |
| syndamia.com-9ae6631a116ed65bd890cbcc9d2d1fb0947f8cb2.tar syndamia.com-9ae6631a116ed65bd890cbcc9d2d1fb0947f8cb2.tar.gz syndamia.com-9ae6631a116ed65bd890cbcc9d2d1fb0947f8cb2.zip | ||
| Parent | b2c316691aba4000438e26be569870c115bdc0d7 (diff) | |
[Header-description] More optimizations by replacing match with index
1 files changed, 4 insertions, 4 deletions
| -rw-r--r-- | awk-edits/Header-description.awk | 8 |
diff --git a/awk-edits/Header-description.awk b/awk-edits/Header-description.awk index 645a1ac..cdadf4d 100644 --- a/awk-edits/Header-description.awk +++ b/awk-edits/Header-description.awk @@ -28,17 +28,17 @@ BEGIN { # Loop over the whole file, extract all text in first couple of paragraphs, # store it in desc (but no more than 200 characters will be saved) while(getline < ARGV[1]) { - if (match($0, /<h[23456]/) && substr($0, RSTART, 17) != "<h2 id=\"contents\"") + if ((index($0, "<h1") || index($0, "<h2")) && substr($0, RSTART, 17) != "<h2 id=\"contents\"") break; - if (match($0, /^<p>/)) + if (index($0, "<p>")) parstar = 4; - if (match($0, /<\/p>$/)) + if (index($0, "</p>")) parends = 3; if (parcont || parstar == 4) { if (appToDesc($0)) break; - parcont = RSTART == 0; + parcont = parends == 0; parstar = 1; parends = 0; } |