UESPWiki:WikiAppApi

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Note: This extension/documentation is under development and may not be completely accurate/up-to-date.

This page details setup and use of the WikiAppApi MediaWiki extension. The purpose of the app is to provide custom API extensions that a mobile app uses to extract page data for use/display on the app.

App Home Page Data[edit]

The AppHomePage page contains JSON data that the app requests in order to customize the display and style of the app home page.

  • The content of the page must be valid JSON (everything outside the <noinclude> blocks). Use any JSON validator to check when editing.
  • Comments are supported with // at the end of a line (but are not recommended as it makes validating it harder).
  • The app caches requests the home page data so changes may not show up in the app for several hours.

JSON Format[edit]

TODO: Put JSON definition here (or a short version with a link to the full spec).

Other Page Formats[edit]

In addition to the AppHomePage the app gathers data from a variety of other pages and expects a certain page format/content as described below.

News[edit]

In the AppHomePage data define a card_news widget with a wikiPage member that points to the wiki article containing the list of current news pages.

For example:

       { // recent news widget
              "type" : "card_news",
              "title" : "Recent News",
              "wikiPage" : "UESPWiki:News"
              "header_link" : "https://en.uesp.net/wiki/UESPWiki:News",
              "footer_text" : "More news...",
              "footer_link": "https://en.uesp.net/wiki/UESPWiki:News"
       }

The API looks for a list of news article transclusions optionally contained within an <includeonly>...</includeonly> block with the prefix of the wikiPage parameter above.

For example:

       {{UESPWiki:News/News Article 1}}
       {{UESPWiki:News/News Article 2}}
       {{UESPWiki:News/News Article 3}}
       ...

If news content loading is on in the API then each news article found will be loaded and parsed. The first [[File:...]] tag will be used as the thumbnail image.

Featured Article[edit]

In the AppHomePage data define a card_featured_article widget with a wikiPage member that points to the wiki article containing the current featured image.

For example:

      {
              "type" : "card_featured_article",
              "title" : "Featured Article",
              "wikiPage" : "Main Page/Featured Article",            
              "header_link" : "https://en.uesp.net/wiki/UESPWiki:Featured_Articles/Old_FAs",
              "footer_text": "More featured articles",
              "footer_link": "https://en.uesp.net/wiki/UESPWiki:Featured_Articles/Old_FAs",
      }

The wikiPage article must have the featured article as the first [[...]] link in the text. Any image should be the first [[File:...]] tag in the text. The file tag should be in same format as specified in the Featured Image card. If you want a snippet text it should be enclosed in <caption>...</caption> tags.

Featured Image[edit]

In the AppHomePage data define a card_featured_image widget with a wikiPage member that points to the wiki article containing the current featured image.

For example:

      {
              "type" : "card_featured_image",
              "title" : "Featured Image",
              "wikiPage" : "Main Page/Featured Image",            
              "header_link" : "https://en.uesp.net/wiki/UESPWiki:Featured_Images/Old_FIs",
              "footer_text": "More featured images",
              "footer_link": "https://en.uesp.net/wiki/UESPWiki:Featured_Images/Old_FIs"
      }

The wikiPage article must have the featured image as the first [[File:...]] tag in the text. The file tag should be in the format of:

    [[File:Image Filename.jpg|option1|...|Caption]]
    [[File:Image Filename.jpg|option1|...|{{Template|Caption}}]]

Trivia Box[edit]

For a trivia box card specify the page where the list of trivia is stored by using the wikiPage parameter.

For example:

      { // trivia box segment
              "type" : "card_trivia",
              "title" : "Did You Know?",
              "wikiPage" : "Main Page/Did_You_Know_Transclusion",
              "items_per_page" : 5,
              "footer_link" : "https://en.uesp.net/wiki/Main_Page/Did_You_Know",
              "footer_text" : "Would you like to know more?",
              "footer_icon" : "question_marks"
      },

Trivia items on the given page is assumed to be held between <li>...</li> tags.

Generic Card[edit]

A generic card can be defined with content inserted from another article by using the template_content parameter to point to an existing wiki article.

For example:

      { // generic card
             "type" : "card_generic",
             "template_content" : "UESPWiki:About",
             "style" : "outlined",
             "header_title" : "About"
      }

The given article HTML will be inserted into the content parameter as a string (correctly escaped for JSON).

Supported Wikis[edit]

The following wikis have been confirmed to work with this extension:

Other Wiki Notes[edit]

Notes on working with other wikis.

  • News -- Does not use a specific news section but individual cards with specific information.
  • Trivia -- Uses trivia in page H2 sections (Template:WYPA_Submissions).
  • Featured Article -- Not used although there are cards to specific articles that might be changed from time to time.
  • Featured Image -- Called Pickman's Gallery. Uses a custom template so the current implementation of finding the image won't work. Probably can be replaced with a basic template transclusion as a generic card.