This website is a read-only preview of RuneLibris. Some features may not work. For more information about the full feature-complete version of this wiki, please visit this link.

(Return to archive index)

Meta/Automated page creation

From RuneLibris
Jump to: navigation, search

It appears that this method do not work for pages containing special characters such as "é" and "è".

Requirements[edit]

This method require LibreOffice.

Parsing redlinks[edit]

To automatically generate pages, you will need a list of will-be page titles. This is usually done by parsing redlinks from a set of pages:

  • Go to a RuneLibris page
  • Press CTRL + A
  • Using "Copy Selected Links" Firefox addon, copy all links[Note 1]
  • Paste data in Notepad++
  • Trim out unrelated data
  • Only preserve lines that contains &redlink=1
  • Replace http://localhost/RuneLibris/index.php?title=RS/ with nothing
  • Replace &action=edit&redlink=1 with nothing
  • Make sure there is no "&" in the data.
  • In Notepad++, go to Compléments, MIME Tools, URL Decode
  • Replace every _ with a space.
  • Name said list 4 - Page list.txt.
    • If any name have a ",", subsitute it for something else.

Protocol[edit]

  • Make a wiki page that will serve as the base model.
  • Make sure to name it with an obvious debug name (i.e KUPPACLE)
  • Go to Special:Export and export the page (make sure to only include current revision)
  • Save it as 1 - original page.xml.
  • Create a copy of the exported page and name it 2 - HTML template.xml.
  • Edit the content to make sure it it only contains content within the <page>.

The HTML template should look similar to this:

  <page>
    <title>RS/Locs/Tree (ID 84030)</title>
    <ns>0</ns>
    <id>9564</id>
    <revision>
      <id>25227</id>
      <parentid>25215</parentid>
      <timestamp>2025-04-16T17:53:36Z</timestamp>
      <contributor>
        <username>Admin</username>
        <id>1</id>
      </contributor>
	  <comment>Page created automatically</comment>
      <origin>25227</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="392" sha1="aqzv04eh4mudr2v6i85cf1zhg1d82ij" xml:space="preserve">
==Interactions==
{| class="wikitable sortable"
| OP || Examine
|-
| &nbsp; || ''Examines are consigned to data pages''
|}

==Meta notes==
This page was automatically generated as part of the [[User:Dev notes/2025-04-16: Making Examine-only Loc Pages|2025-04-16: Making Examine-only Loc Pages]] task.

==References==

[[Category:Examine-only locs]]

[[Category:Automatically generated pages]]</text>
      <sha1>aqzv04eh4mudr2v6i85cf1zhg1d82ij</sha1>
    </revision>
  </page>
  • It is reccomended that you make sure that the "Page created automatically" is there.
  • Create another copy of the original export, name it 3 - Import template.xml.
  • Edit the document, this time remove the content betwen the <page> tags. Here's an example:

Data for "Import template":

<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.11/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.11/ http://www.mediawiki.org/xml/export-0.11.xsd" version="0.11" xml:lang="en">
  <siteinfo>
    <sitename>RuneLibris</sitename>
    <dbname>RuneLibris</dbname>
    <base>http://localhosthttps://runelibris.github.io/RuneLibris/Main_Page</base>
    <generator>MediaWiki 1.35.5</generator>
    <case>first-letter</case>
    <namespaces>
      <namespace key="-2" case="first-letter">Media</namespace>
      <namespace key="-1" case="first-letter">Special</namespace>
      <namespace key="0" case="first-letter" />
      <namespace key="1" case="first-letter">Talk</namespace>
      <namespace key="2" case="first-letter">User</namespace>
      <namespace key="3" case="first-letter">User talk</namespace>
      <namespace key="4" case="first-letter">RuneLibris</namespace>
      <namespace key="5" case="first-letter">RuneLibris talk</namespace>
      <namespace key="6" case="first-letter">File</namespace>
      <namespace key="7" case="first-letter">File talk</namespace>
      <namespace key="8" case="first-letter">MediaWiki</namespace>
      <namespace key="9" case="first-letter">MediaWiki talk</namespace>
      <namespace key="10" case="first-letter">Template</namespace>
      <namespace key="11" case="first-letter">Template talk</namespace>
      <namespace key="12" case="first-letter">Help</namespace>
      <namespace key="13" case="first-letter">Help talk</namespace>
      <namespace key="14" case="first-letter">Category</namespace>
      <namespace key="15" case="first-letter">Category talk</namespace>
      <namespace key="2300" case="first-letter">Gadget</namespace>
      <namespace key="2301" case="first-letter">Gadget talk</namespace>
      <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
      <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
    </namespaces>
  </siteinfo>

</mediawiki>
  • In LibreOffice, create a standard spreadsheet with a simple header (i.e page_title)
  • Import the list of names
  • Make sure that headers have NO space (i.e page_title is a good title)
  • Export the spreadsheet in .xlsx, name the file as a single string (i.e dataset.xlsx.)
  • Create a new LibreOffice Text Document (can be done in any LibreOffice windows)
  • Copy the contents of 2 - HTML template.xml in the document.
  • In LibreOffce go to File, Wizards, Adress Data Source
  • Select "other external data source" and click next.
  • Click on "settings" button.
  • Click "next" button.
  • Browse for the 5 - Database.xlsx file, click "finish"
  • Click "next"
  • In "Adress book name" field, give it a custom name (avoid spaces)
  • If there is a "file already exists" message, overwrite it.
  • Goto View, Data source.
  • Look for the data source you just created.
  • Drag the table header in an empty area of the text document. This should produce a tag like <Page_title>.
  • Put the tags at the places where data will need to be substitued.
  • Once done, go to File, Print.
  • Click yes
  • Select "file" radio button (small selectable circle)
  • Select "save as single document"
  • Click OK
  • Save the ouput file in .txt format with the filename 6 - Output.txt.
  • Wait for the data merging process to finish (this might take a while)
  • Transfer the content of 6 - Output.txt to a file called 6 - Output.txt
  • Look for non-printable chararacters in Notepad++
  • Make a copy of 3 - import template.xml called data.xml
  • Paste 6 - Output.txt within the <siteinfo> and </mediawiki> tags. Do not worry if some of the tabulation/spaces are missing
  • Save the document.
  • Copy the following CMD command in Notepad++ and tweak the filepaths to match your XAMPP installation:

Make sure to not overwrite any other path

"R:\Xampp\php\php.exe" "R:\Xampp\htdocs\RuneLibris\maintenance\importDump.php" --conf "R:\Xampp\htdocs\RuneLibris\LocalSettings.php" "data.xml" --username-prefix="en" > result.txt
  • Replace "data.xml. with the path to your test run file.
  • Check if the command formating is all on one line.
  • Execute the command in CMD.
    • The importation may take a while
  • Once the command is finished, check "result.txt" for any error.
  • On the wiki make list of link featuring expected pages on RuneLibris:Sandbox, to see if everything is here.
  • Tweak and run the following command:
"R:\Xampp\php\php.exe" "R:\Xampp\htdocs\RuneLibris\maintenance\rebuildrecentchanges.php"
  • Wait for the command to finish, this can take a long while (30+ minutes)

Notes[edit]

  1. A copy of this addon can be found in RueLibris' SoftwareSuite