Product Page Processing Methods

From Salish Sea Wiki
  1. For all pages containing {{Product}}
    1. If namespace is not "File" or "Main" then flag as "Product in other namespace" and END
    2. Where free text contains [[Category:Document]] Then:
      1. Look for four digit number in name string, and make YEAR = four-digit Number, if there is no number then flag as "Document with no year" (a few.. )
      2. Take text to left of the number and make AUTHOR = left text string (strip of rightmost space)
      3. Take text to right of the number, starting at first non-space character and make TITLE = right text string; if no text then
      4. Take all categories and add as comma delimited structured data in the field CATEGORIES
      5. Where namespace = File Then
        1. Create a new page with page name AUTHOR + YEAR + TITLE
        2. Create a link directly to the File Media at the top of the new page
        3. Add all the free text and structured data created above to the new page
        4. Delete the original File:Page content and replace with #redirect[[NEWPAGENAME]] //or alternately a link to the main namespace product page?
    3. Where free text contains [[Category:Dataset]] Then:
      1. Look for four digit number in name string, and make YEAR = Number, if there is no number then flag as "Document with no year" (a few.. )
      2. Take text to left of the number and make AUTHOR = left text string (strip of rightmost space)
      3. Take text to right of the number, starting at first non-space character and make TITLE = right text string; if no text then
      4. Take all categories and add as comma delimited structured data in the field CATEGORIES
    4. Where free text contains [[Category:Graphic]] or [[Category:Image]] or [[Category:Map]][[Category:Diagram]]
      1. Replace {{Product}} with {{Cosmetic Graphic}} //Right now, all the media in the graphic category are just images used to decorate pages. At a later date, they can be "promoted" to full Products if it is merited. We will need to start flagging and managing a set of File namespace media that are in the Cosmetic Image category (as opposed to an graphic that is a product with an author and year).
    5. If contains [[Category:Webpage]]
      1. AUTHOR = Null, YEAR = Null
      2. TITLE = pagename
      3. Take all categories and add as comma delimited structured data in the field CATEGORIES
    6. For any remaining product pages flag as "Product without subtype"

//This is to clean up a number of pages in File that contain media that are categorized irregularly, and also assigns them to the template {{Cosmetic Graphic}} so they can be managed more easily later. I will need to do some manual work to sort these... some may become products, and otherwise I'll have to start managing cosmetic graphics separate from products.

  1. Where page does NOT contain {{Product}} but does contains [[Category:Graphic]] or [[Category:Image]] or [[Category:Map]][[Category:Diagram]] add {{Cosmetic Graphic}} at the top of free text. //This is the support the future cleanup described above.