Module:AutoLinker/doc

From Nano World Order - Wiki
Revision as of 07:29, 4 June 2026 by Geckopico (talk | contribs) (Created page with "# Template:AutoLinker Documentation This template provides a user-friendly interface for the Module:AutoLinker Lua module. ## Installation Instructions 1. **Create the Lua module:** - Go to your wiki's Module namespace: `Module:AutoLinker` - Copy the complete Lua code (autolinker_module.lua) into the page - Save 2. **Create the template wrapper:** - Go to your wiki's Template namespace: `Template:AutoLinker` - Copy the template code below into the page...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:AutoLinker

  1. Template:AutoLinker Documentation

This template provides a user-friendly interface for the Module:AutoLinker Lua module.

    1. Installation Instructions

1. **Create the Lua module:**

  - Go to your wiki's Module namespace: `Module:AutoLinker`
  - Copy the complete Lua code (autolinker_module.lua) into the page
  - Save

2. **Create the template wrapper:**

  - Go to your wiki's Template namespace: `Template:AutoLinker`
  - Copy the template code below into the page
  - Save

3. **Customize the page list:**

  - Edit `Module:AutoLinker`
  - Modify the `p.getStaticPages()` function
  - Add/remove page titles that should be auto-linked
  - Save

---

    1. Template Code

Copy this into `Template:AutoLinker`:

```

Auto-Linker Tool

Paste text below to automatically link all matching page titles in your wiki.

Input Text: <textarea id="autolinker-input" style="width: 100%; height: 200px; font-family: monospace; padding: 8px; border: 1px solid #ccc;"></textarea>

Output Text (linked): <textarea id="autolinker-output" style="width: 100%; height: 200px; font-family: monospace; padding: 8px; border: 1px solid #ccc; background-color: #fffacd;"></textarea>

<button onclick="autoLinkerProcess()">Process Text</button> <button onclick="autoLinkerCopy()">Copy Output</button> <button onclick="autoLinkerReset()">Reset</button>

Note: This tool uses the static page list. For more control, use the invoke syntax directly: Lua error: Internal error: The interpreter exited with status 126.

<script> function autoLinkerProcess() {

   var inputText = document.getElementById('autolinker-input').value;
   var outputText = document.getElementById('autolinker-output');
   
   // For now, show instructions
   outputText.value = 'JavaScript method coming soon.\n\n' +
                     'For immediate results, use the wiki markup syntax below:\n\n' +
                     'Lua error: Internal error: The interpreter exited with status 126.\n\n' +
                     'Copy the above into your page, save it, and the linked text will appear.';

}

function autoLinkerCopy() {

   var output = document.getElementById('autolinker-output');
   output.select();
   document.execCommand('copy');
   alert('Output copied to clipboard!');

}

function autoLinkerReset() {

   document.getElementById('autolinker-input').value = ;
   document.getElementById('autolinker-output').value = ;

} </script> ```

---

    1. Usage Methods
      1. Method 1: On a Wiki Page (Easiest)

Create a special page (e.g., `Tools:AutoLinker`) and use this syntax:

``` Lua error: Internal error: The interpreter exited with status 126. ```

The page will display the linked text:

``` Your text goes here. This is about Targeted Individuals and Directed Energy Weapons. ```

Copy and paste that result elsewhere.

      1. Method 2: Using the Template

``` Template:AutoLinker ```

This displays the form interface.

      1. Method 3: In Your Article

Embed it directly where you want auto-linking:

```

Linked Section

Lua error: Internal error: The interpreter exited with status 126. ```

---

    1. Advanced Parameters

When calling the module directly, you can use:

``` Lua error: Internal error: The interpreter exited with status 126. ```

- `text`: The input text to process (required) - `mode`: Where to get the page list

 - `static` = Use curated list only (fast, requires maintenance)
 - `dynamic` = Query wiki API (slower, more complete)
 - `auto` = Try dynamic first, fall back to static (default)

---

    1. Customizing the Page List

To add or remove pages from auto-linking:

1. Edit `Module:AutoLinker` 2. Find the `p.getStaticPages()` function 3. Add new pages to the return table:

```lua return {

   "Your Page Title",
   "Another Page",
   -- etc

} ```

    • Tips:**

- Add both singular and plural forms if needed - Longer titles first (handled automatically) - Use proper capitalization - Test with `Lua error: Internal error: The interpreter exited with status 126.`

---

    1. Debugging

To see the list of pages being matched:

``` Lua error: Internal error: The interpreter exited with status 126. ```

To test with sample text:

``` Lua error: Internal error: The interpreter exited with status 126. ```

---

    1. Limitations & Notes

- **Already linked text** is skipped (won't double-link existing links) - **Maximum 500 matches per invocation** (safety limit, prevents performance issues) - **Whole words only** (matches "Energy Weapons" but not inside other words) - **Performance:** Static mode is fast; dynamic mode slower on large wikis - **Case sensitivity:** Can be toggled in the module config

---

    1. Troubleshooting
    • Nothing is getting linked:**

- Check that page titles in the static list exactly match your wiki pages - Verify the module is in the `Module:` namespace - Test with `Lua error: Internal error: The interpreter exited with status 126.`

    • Too many false matches:**

- Add longer, more specific titles to the list first - Reduce the number of generic terms - Use the `wholeWordsOnly` setting

    • Performance is slow:**

- Use `mode=static` instead of `mode=auto` - Reduce the static page list - Don't process extremely long texts at once