<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.splurt.space/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Guide_to_autowiki</id>
	<title>Guide to autowiki - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.splurt.space/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Guide_to_autowiki"/>
	<link rel="alternate" type="text/html" href="https://wiki.splurt.space/mediawiki/index.php?title=Guide_to_autowiki&amp;action=history"/>
	<updated>2026-05-15T20:59:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://wiki.splurt.space/mediawiki/index.php?title=Guide_to_autowiki&amp;diff=1012&amp;oldid=prev</id>
		<title>imported&gt;Mothblocks: It&#039;s not Auto-wiki</title>
		<link rel="alternate" type="text/html" href="https://wiki.splurt.space/mediawiki/index.php?title=Guide_to_autowiki&amp;diff=1012&amp;oldid=prev"/>
		<updated>2023-07-24T04:27:19Z</updated>

		<summary type="html">&lt;p&gt;It&amp;#039;s not Auto-wiki&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Autowiki =&lt;br /&gt;
&lt;br /&gt;
Autowiki is a neat way of creating automatically generated wiki templates. &lt;br /&gt;
&lt;br /&gt;
If you are tasked with updating a large amount of sprites or information about a feature or system, you may see it fit to add an Autowiki to do. &lt;br /&gt;
&lt;br /&gt;
== Why Autowiki? ==&lt;br /&gt;
&lt;br /&gt;
Autowiki, while appearing complex to set up at first, will keep a page 100% up to date with the code-base for all future changes to that feature automatically. &lt;br /&gt;
&lt;br /&gt;
This means you don&amp;#039;t have to go in edit the page for the smallest of changes or to update sprites - the script, which runs daily, will do it for you. &lt;br /&gt;
&lt;br /&gt;
== Where to begin ==&lt;br /&gt;
&lt;br /&gt;
To begin, you need to create the actual Autowiki datum that collates all the data you are adding. &lt;br /&gt;
&lt;br /&gt;
You will need a decently firm understanding of the game&amp;#039;s code to accomplish this. &lt;br /&gt;
&lt;br /&gt;
The most important thing to note in the datum is the &amp;quot;include_template&amp;quot; proc. This proc is passed a template title and a list of data which is later passed to the wiki&lt;br /&gt;
&lt;br /&gt;
== Ok, I made the datum, how do I test it? ==&lt;br /&gt;
&lt;br /&gt;
Easiest way to test your setup is to look for &amp;quot;#define AUTOWIKI&amp;quot; in the code and uncomment it. Then, compile and run. &lt;br /&gt;
&lt;br /&gt;
In your local data files, you will see two relevant files - &amp;quot;Autowiki_edits.txt&amp;quot;, which contains all the raw text for your setup, and &amp;quot;Autowiki_files&amp;quot;, which is a folder of images created by your setup. &lt;br /&gt;
&lt;br /&gt;
There, you can verify it all looks correct. &lt;br /&gt;
&lt;br /&gt;
== And how do I apply it to the wiki? ==&lt;br /&gt;
&lt;br /&gt;
When all is said and done, the Autowiki datum doesn&amp;#039;t create the templates themselves - it creates data and automatically shoves it into templates for you to use elsewhere. &lt;br /&gt;
&lt;br /&gt;
You must make your own templates for the data to fill in.&lt;br /&gt;
&lt;br /&gt;
Once you have your base templates created, an easy way to test it is to manually enter some of your generated data to see how it works. &lt;br /&gt;
&lt;br /&gt;
Once you are happy, you can submit your code as a pull request. Once it&amp;#039;s merged, all is done!&lt;br /&gt;
&lt;br /&gt;
= Example = &lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ll go under two examples, one sample and one real world. &lt;br /&gt;
&lt;br /&gt;
== Sample == &lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s create a simple sample of an Autowiki. &lt;br /&gt;
&lt;br /&gt;
We start with the datum. The important thing to set here is the &amp;quot;page&amp;quot; variable. &lt;br /&gt;
This will be the location of the finished product / template on the wiki. This is what people (you) will use to put your result onto your page.&lt;br /&gt;
  /datum/autowiki/my_sample&lt;br /&gt;
    page = &amp;quot;Template:Autowiki/Content/MyNewAutowikiSample&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The only proc you MUST implement is called generate. It, well, generates the template. It&amp;#039;s where all the code goes. &lt;br /&gt;
  /datum/autowiki/my_sample/generate()&lt;br /&gt;
&lt;br /&gt;
Two important procs of the datum to know are &amp;#039;&amp;#039;&amp;#039;upload_icon&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;include_template&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
Another handy proc is &amp;#039;&amp;#039;&amp;#039;escape_value&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s talk about the &amp;#039;&amp;#039;&amp;#039;upload_icon&amp;#039;&amp;#039;&amp;#039; first.&lt;br /&gt;
If you want to upload images as a part of your code, you can do so with this proc. &lt;br /&gt;
We will upload an image of a lizard plushie as an example. &lt;br /&gt;
&lt;br /&gt;
  /datum/autowiki/my_sample/generate()&lt;br /&gt;
    // Creates a lizard plushie to take a snapshot of&lt;br /&gt;
    var/obj/item/plushie/lizard/edits_the_wiki = new()&lt;br /&gt;
    // Decides the filename of the resulting PNG. &lt;br /&gt;
    var/filename = &amp;quot;test_lizard&amp;quot;&lt;br /&gt;
    // Uploads an image of the lizard to the wiki, with the file &amp;quot;Autowiki-test_lizard.png&amp;quot;. &lt;br /&gt;
    // Note, attempting to split your images into subfolders will NOT work. &lt;br /&gt;
    upload_icon(getFlatIcon(edits_the_wiki, filename)&lt;br /&gt;
&lt;br /&gt;
Next, let&amp;#039;s look at &amp;#039;&amp;#039;&amp;#039;include_template&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This is the bread and butter of creating templates. &lt;br /&gt;
We will create a table with our lizard image we just created. &lt;br /&gt;
&lt;br /&gt;
  /datum/autowiki/my_sample/generate()&lt;br /&gt;
    var/obj/item/plushie/lizard/edits_the_wiki = new()&lt;br /&gt;
    var/filename = &amp;quot;test_lizard&amp;quot;&lt;br /&gt;
    upload_icon(getFlatIcon(edits_the_wiki, filename)&lt;br /&gt;
    ...&lt;br /&gt;
    // This is a sample of what template data might look like. &lt;br /&gt;
    // In actual practice this will be filled almost entirely automatically. &lt;br /&gt;
    var/list/template_data = list(&lt;br /&gt;
        &amp;quot;icon&amp;quot; = filename,&lt;br /&gt;
        &amp;quot;table_text&amp;quot; = &amp;quot;THAT is a lizard.&amp;quot;, &lt;br /&gt;
    )&lt;br /&gt;
    // This is essentially taking the template you pass and creating a fully filled out result with your data. &lt;br /&gt;
    // Instead of having to manually write { {Autowiki/MyNewAutowikiSampleTemplate|icon=&amp;quot;test_lizard&amp;quot;|table_text=&amp;quot;THAT is a lizard.&amp;quot;} }, &lt;br /&gt;
    // It&amp;#039;s just filling it on for you! &lt;br /&gt;
    // While it seems a little silly in this small sample, when you&amp;#039;re handling hundreds of things, this saves a ton of time. &lt;br /&gt;
    return include_template(&amp;quot;Autowiki/MyNewAutowikiSampleTemplate&amp;quot;, template_data)&lt;br /&gt;
&lt;br /&gt;
The last relevant proc is &amp;#039;&amp;#039;&amp;#039;escape_value&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
Its use is simple, it formats text in a way that won&amp;#039;t break wikicode. &lt;br /&gt;
Pretty much all text you&amp;#039;re sending to the wiki should be wrapped in this proc. &lt;br /&gt;
&lt;br /&gt;
That&amp;#039;s it for the datum side. &lt;br /&gt;
&lt;br /&gt;
All you need to do now is create the template &amp;#039;&amp;#039;&amp;#039;Autowiki/MyNewAutowikiSampleTemplate&amp;#039;&amp;#039;&amp;#039; how you see fit. &lt;br /&gt;
&lt;br /&gt;
== Real Example == &lt;br /&gt;
&lt;br /&gt;
See: https://github.com/tgstation/tgstation/pull/74931 . &lt;br /&gt;
&lt;br /&gt;
This datum goes through all soup reagent datums and extract a lot of information related to them - name, ingredients, food types, and so on. &lt;br /&gt;
It formats them all nicely in a list, then passes the list to a template, https://tgstation13.org/wiki/Template:Autowiki/SoupRecipeTemplate . &lt;br /&gt;
&lt;br /&gt;
Each soup entry uses one of the above templates. &lt;br /&gt;
&lt;br /&gt;
Finally, when all soups are parsed through, it wraps the entire output in this template https://tgstation13.org/wiki/Template:Autowiki/SoupRecipeTableTemplate to format it in one big text: &lt;br /&gt;
&lt;br /&gt;
As a result, you get the following content template, automatically generated: &lt;br /&gt;
&lt;br /&gt;
https://tgstation13.org/wiki/Template:Autowiki/Content/SoupRecipes&lt;br /&gt;
&lt;br /&gt;
{{Contribution guides}}&lt;br /&gt;
[[Category:Meta]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Mothblocks</name></author>
	</entry>
</feed>