User:AllyUnion/Did you know pseudocode process
Appearance
- Note: '\n' indicates a "newline"
- Find the following text:
"===ARCHIVE USED SUGGESTIONS HERE===\n\'\'include a link to the used picture behind the fact in which it has been \'\'\'used\'\'\' on the front page.\'\'<br>"
- Set a counter for the number of did you know lines to zero
- Set a counter for the number of did you know blocks to zero
- In loop (use while), repeat the following until the following text has been found:
"\'\'\'All older items have been archived at [[Wikipedia:Recent additions]]. Please check the [[Wikipedia talk:Did you know/ItemArchive 1|item archive]] to help check if other items are archived at \"Recent Additions\" or one of its archives as well.\'\'\'"
- In an inner loop (use do-while), repeat until the following text has been found: '\n\n'
- Find "...that" and split until newline
- If a line has been found, increase counter for the number of did you know lines
- If '\n\n' has been found, increase counter for the number of did you know blocks
- In an inner loop (use do-while), repeat until the following text has been found: '\n\n'
- If number of did you know lines exceeds 50, take the last did you know blocks and put it on Wikipedia:Recent additions
Wikipedia:Recent additions to archive page
[edit]- Scan for the first "<!-- newly archived items should go in at the top -->"
- While the next "<!-- newly archived items should go in at the top -->" has not been found then search for: (outer loop)
- Find "<br>\n\n" or "<br/>\n\n" or "<br />\n\n" (\n is newline in programming terms)
- Repeat the following steps: (inner loop)
- Look for: "...that" or "[[Image:" (the latter is case insensitive)
- Find the next: "...that" or "[[Image:" (the latter is case insensitive)
- Save this as a "Did you know" line
- Increase did you know line count
- If "<br>\n\n" or "<br/>\n\n" or "<br />\n\n" has been found, increase the block count