User:AllyUnion/Did you know pseudocode process

From Wikipedia, the free encyclopedia
  • Note: '\n' indicates a "newline"

Template talk:Did you know to Wikipedia:Recent additions[edit]

  1. 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>"
  2. Set a counter for the number of did you know lines to zero
  3. Set a counter for the number of did you know blocks to zero
  4. 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.\'\'\'"
    1. In an inner loop (use do-while), repeat until the following text has been found: '\n\n'
      1. Find "...that" and split until newline
      2. If a line has been found, increase counter for the number of did you know lines
    2. If '\n\n' has been found, increase counter for the number of did you know blocks
  5. 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]

  1. Scan for the first "<!-- newly archived items should go in at the top -->"
  2. 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)
  3. Repeat the following steps: (inner loop)
    1. Look for: "...that" or "[[Image:" (the latter is case insensitive)
    2. Find the next: "...that" or "[[Image:" (the latter is case insensitive)
    3. Save this as a "Did you know" line
    4. Increase did you know line count
  4. If "<br>\n\n" or "<br/>\n\n" or "<br />\n\n" has been found, increase the block count