Module:AutoLinker
AutoLinker Documentation
This page documents the AutoLinker tool, which automatically finds and links existing wiki page titles in input text.
Installation Instructions
Step 1: Create the Lua Module
- Go to your wiki's Module namespace:
Module:AutoLinker - Copy the complete Lua code into the page (see the module page)
- Save
Step 2: Create the Template Wrapper
- Go to your wiki's Template namespace:
Template:AutoLinker - Copy the template code below into the page
- Save
Step 3: Customize the Page List
- Edit
Module:AutoLinker - Modify the
p.getStaticPages()function - Add/remove page titles that should be auto-linked
- Save
Basic Usage
Method 1: Direct Invoke (Recommended)
Use this syntax anywhere on your wiki:
<syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
The system will automatically link all matching page titles from your configured list.
Example:
Input: <syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
Output: <syntaxhighlight lang="wiki"> This discusses Targeted Individuals and Directed Energy Weapons. </syntaxhighlight>
Method 2: Using the Template
<syntaxhighlight lang="wiki"> Template:AutoLinker </syntaxhighlight>
This displays the form interface for processing text.
Method 3: Embedding in an Article
You can embed AutoLinker directly in article sections:
<syntaxhighlight lang="wiki">
Linked Section
Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
Advanced Parameters
When calling the module directly, you can use optional parameters:
<syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
- 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)
Customizing the Page List
To add or remove pages from auto-linking:
- Edit
Module:AutoLinker - Find the
p.getStaticPages()function - Add new pages to the return table:
<syntaxhighlight lang="lua"> return {
"Your Page Title", "Another Page", -- etc
} </syntaxhighlight>
Tips
- Add both singular and plural forms if needed
- Longer titles are automatically matched first
- Use proper capitalization (must match your page titles exactly)
- Test with
Lua error: Internal error: The interpreter exited with status 126.
Finding Pages to Add
To find your actual wiki page titles:
- Go to Special:AllPages
- Review all pages
- Copy exact titles (watch capitalization!)
- Paste into the
getStaticPages()function
Important: Page titles must match exactly, including capitalization and spacing.
Configuration Options
Edit Module:AutoLinker to adjust behavior:
<syntaxhighlight lang="lua"> local config = {
caseSensitive = false, -- Match "AI" and "ai"? wholeWordsOnly = true, -- Must be standalone words skipAlreadyLinked = true, -- Don't re-link existing links minLength = 2, -- Skip 1-character matches maxMatches = 500, -- Safety limit per invocation cacheExpiry = 3600, -- Cache time in seconds
} </syntaxhighlight>
Recommended Settings
For most wikis:
wholeWordsOnly = true— Prevents matching partial wordsskipAlreadyLinked = true— Prevents double-linkingmaxMatches = 500— Safe limit for performance
Debugging & Testing
View All Matched Pages
To see the complete list of pages that will be auto-linked:
<syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
This outputs a numbered list of all pages in the matching configuration.
Test with Sample Text
To test the module with sample text:
<syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
Test with Custom Text
To test with your own text:
<syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
Common Use Cases
Processing a New Article
Workflow:
- Write your article
- Use AutoLinker to add links to all relevant pages
- Copy the linked output
- Paste back into your article
- Save
Example:
<syntaxhighlight lang="wiki">
Draft Section
Original text: "This discusses surveillance programs, electromagnetic harassment, and targeted individuals."
Lua error: Internal error: The interpreter exited with status 126.
Result
Copy the output above and use it in your article. </syntaxhighlight>
Batch Processing Multiple Articles
Create a temporary page in your sandbox or user workspace for processing multiple texts:
<syntaxhighlight lang="wiki">
Text Processing Queue
Article 1
Lua error: Internal error: The interpreter exited with status 126.
Article 2
Lua error: Internal error: The interpreter exited with status 126.
Article 3
Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
Process all at once, then copy and distribute results.
Limitations & Behavior
- Already linked text is skipped — won't double-link
existing links - Maximum 500 matches per invocation — safety limit to prevent performance issues
- Whole words only — matches "Energy Weapons" but not partial words
- Static mode is fast — dynamic mode slower on large wikis
- Case sensitivity — can be configured in the module
Performance Notes
- Static mode (50-100 pages)
- Instant
- Static mode (500+ pages)
- Noticeable delay (1-2 seconds)
- Text length (10KB)
- Fast
- Text length (100KB+)
- Consider breaking into chunks
- Dynamic mode
- 1-5 seconds typical (not recommended)
Optimization Tip: If processing very long texts, run AutoLinker on sections separately.
Troubleshooting
Nothing is Getting Linked
Diagnosis: <syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
This shows all pages in the matching list.
Solutions:
- 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. - Capitalization and spacing must match exactly
Too Many False Matches
Solution:
- Remove overly generic terms from the list
- Put longer, more specific titles first (already done by default)
- Increase specificity of page titles
- Adjust matching configuration options
Scribunto Error
Likely Cause: Syntax error in the Lua code or module not found
Fix:
- Go to
Module:AutoLinker - Look for red error text
- Click the error to see details
- Fix the Lua code or reinstall the module
Pages with Special Characters Not Linking
Pages with [, ], (, ), etc. need special handling.
Workaround: Add alternate titles to your list:
<syntaxhighlight lang="lua"> "The Radiohead Protocol", "Radiohead Protocol", -- Alternative for matching </syntaxhighlight>
Complete Workflow Example
Scenario: Processing an Article About Surveillance
Original Article Text:
This exposé examines Targeted Individuals, Gang Stalking, and Directed Energy Weapons technology. It draws on COINTELPRO documents and recent research into Psychotronics.
Processing:
<syntaxhighlight lang="wiki"> Lua error: Internal error: The interpreter exited with status 126. </syntaxhighlight>
Result (after saving):
This exposé examines [[Targeted Individuals|Targeted Individuals]], [[Gang Stalking|Gang Stalking]], and [[Directed Energy Weapons|Directed Energy Weapons]] technology. It draws on [[COINTELPRO|COINTELPRO]] documents and recent research into [[Psychotronics|Psychotronics]].
Final Step: Copy the result and paste it into your article.
Creating a Tool Page
To give all editors easy access to AutoLinker, create a page like Tools:AutoLinker or Help:AutoLinker:
<syntaxhighlight lang="wiki">
Auto-Linking Tool
This tool automatically links all matching page titles in your text.
How to Use
Paste your text into the invoke below and save the page to see the linked result:
Lua error: Internal error: The interpreter exited with status 126.
Instructions
- Write or paste your text after
text= - Save the page
- View the result with all matching pages linked
- Copy the linked text and paste into your article
Need Help?
- Test the tool:
Lua error: Internal error: The interpreter exited with status 126. - View all linkable pages:
Lua error: Internal error: The interpreter exited with status 126. - See all configuration: Edit Module:AutoLinker
</syntaxhighlight>
Advanced: Modifying the Module
The module can be extended with custom features:
- Add custom filters — Skip pages from certain categories
- Change link format — Hide the page title in display text
- Add exclusion list — Pages that should never be auto-linked
- Implement dynamic page list — Query all wiki pages automatically
These modifications require editing the Lua code in Module:AutoLinker, but the structure is straightforward.
API Reference
Functions
linkify(frame)- Main function; takes text and mode parameters; returns linked text
getAllPages(mode)- Retrieves page list; mode can be "static", "dynamic", or "auto"
getStaticPages()- Returns curated page list for matching
getDynamicPages()- Queries wiki API for pages (currently simplified)
listPages(frame)- Debug function; lists all pages being matched
test(frame)- Test function; runs linkify with sample text
Configuration Variables
caseSensitive- Boolean; whether matching is case-sensitive (default: false)
wholeWordsOnly- Boolean; whether to match whole words only (default: true)
skipAlreadyLinked- Boolean; whether to skip already-linked text (default: true)
minLength- Number; minimum length of page titles to match (default: 2)
maxMatches- Number; maximum matches per invocation (default: 500)
cacheExpiry- Number; cache expiration time in seconds (default: 3600)
See Also
- Help:Contents — General wiki help
- Help:Formatting — Wiki markup formatting
- Help:Templates — Template usage guide
- Help:Links — Link formatting guide
- Special:AllPages — View all pages on this wiki
Questions or Issues?
For help with AutoLinker:
- Check the Troubleshooting section above
- Run
Lua error: Internal error: The interpreter exited with status 126.to debug - Review the module code (commented)
- Ask on the Community Portal
Script error: Lua error: Internal error: The interpreter exited with status 126.
-- Module:AutoLinker
-- Automatically finds and links existing wiki page titles in input text
-- Usage: {{#invoke:AutoLinker|linkify|text=Your text here|mode=auto}}
local p = {}
-- Configuration
local config = {
caseSensitive = false, -- Match "AI" and "ai"
wholeWordsOnly = true, -- Don't match "intelligence" when looking for "intel"
skipAlreadyLinked = true, -- Don't re-link [[already linked]] text
minLength = 3, -- Skip single-character matches
maxMatches = 500, -- Safety limit per invocation
cacheExpiry = 3600, -- Cache page list for 1 hour (in seconds)
}
-- Function to get all pages from the wiki
-- Mode: "auto" = try dynamic first, fall back to static
-- "static" = use curated list only
-- "dynamic" = query wiki API
function p.getAllPages(mode)
mode = mode or "auto"
if mode == "static" then
return p.getStaticPages()
elseif mode == "dynamic" then
return p.getDynamicPages()
else -- auto
local pages = p.getDynamicPages()
if not pages or #pages == 0 then
pages = p.getStaticPages()
end
return pages
end
end
-- Static curated list of important pages
-- Add your wiki's key terms here
function p.getStaticPages()
return {
-- Core concepts
"Targeted Individuals",
"Targeted Individual",
"Directed Energy Weapons",
"DEW",
"V2K",
"Voice to Skull",
"Gang Stalking",
"COINTELPRO",
"MKUltra",
"Mind Control",
"Neurotechnology",
"Remote Neural Monitoring",
"RNM",
"Psychotronic",
"Psychotronics",
"Electromagnetic Harassment",
"EMF",
"RF Exposure",
"Microwave",
"Surveillance",
"Covert Surveillance",
"Informant Networks",
"Gig Economy Surveillance",
"Psychological Operations",
"PSYOPS",
"Subliminal Programming",
"Brainwave Entrainment",
"Binaural Beats",
"Monaural Beats",
"Isochronic Tones",
-- Technologies/Programs
"DARPA",
"HI-MEMS",
"Neural Dust",
"IVN",
"IEEE 802.15.6",
"WBAN",
"MICS",
"Wireless Body Area Network",
"Frey Effect",
"TinySA",
"RTL-SDR",
"HackRF",
"PortaPack",
"CellMapper",
-- Scientific concepts
"Radiobiology",
"ROS",
"Fenton Chemistry",
"DC Perineural System",
"Bioelectricity",
"Antenna Theory",
"Biological Antenna",
-- People/Researchers
"Andrija Puharich",
"Robert O. Becker",
"James Giordano",
-- Organizations
"ARPANSA",
"ACMA",
"FBI",
"CIA",
-- Your wiki-specific pages
"The Radiohead Protocol",
"Chemtrails",
"Cloud Seeding",
"Transhuman Agenda",
"Distributed Surveillance",
"Methods of Mind Control",
"Covert Harassment Programs",
"Electromagnetic Torture",
"Australian Cloud Seeding Legislation",
}
end
-- Attempt to get pages dynamically from the wiki
function p.getDynamicPages()
-- Try to use the wiki's API to fetch all pages
-- This is more complete but slower
-- Check if we have mw.http available
if not mw.http then
return nil -- Fall back to static
end
-- Build API query
local title = mw.title.getCurrentTitle()
local baseUrl = mw.uri.encode("https://" .. mw.config.get("wgServer"):gsub("^https?://", ""))
-- Simplified approach: query recent pages
-- Full wiki dump would be too slow
local limit = 5000
-- This is a simplified version - in production you might cache this
-- or batch the requests
return nil -- For now, default to static list
end
-- Main linkify function
function p.linkify(frame)
local text = frame.args.text or frame.args[1] or ""
local mode = frame.args.mode or "auto"
if not text or text == "" then
return ""
end
-- Get the list of pages to match against
local pages = p.getAllPages(mode)
if not pages or #pages == 0 then
return text -- Return unchanged if no pages
end
-- Sort by length (longest first) to avoid partial matches
-- e.g., match "Directed Energy Weapons" before "Energy"
table.sort(pages, function(a, b) return #a > #b end)
-- Process the text
local result = text
local matches = 0
for _, pageTitle in ipairs(pages) do
if matches >= config.maxMatches then
break
end
-- Only process valid titles
if #pageTitle >= config.minLength then
local pattern = p.buildPattern(pageTitle)
local function replace(match)
matches = matches + 1
if match:sub(1, 2) == "[[" or match:sub(-2) == "]]" then
return match
end
return "[[" .. pageTitle .. "|" .. match .. "]]"
end
result = result:gsub(pattern, replace)
end
end
return result
end
-- Build a Lua regex pattern for a page title
function p.buildPattern(title)
-- Escape special Lua regex characters
local escaped = title:gsub("([%^$()%%.%[%]*+%-?])", "%%%1")
-- Ensure whole words (with non-word char or boundary on either side)
-- This handles "Directed Energy Weapons" but not "DirectedEnergy"
if config.wholeWordsOnly then
return "(%A)" .. escaped .. "(%A)"
else
return escaped
end
end
-- Utility: Get page list for debugging/admin purposes
function p.listPages(frame)
local mode = frame.args.mode or "auto"
local pages = p.getAllPages(mode)
local result = "Pages to be matched:\n\n"
for i, page in ipairs(pages) do
result = result .. i .. ". " .. page .. "\n"
end
result = result .. "\n'''Total pages: " .. #pages .. "'''"
return result
end
-- Utility: Test linkification on sample text
function p.test(frame)
local sampleText = frame.args.text or "This is about Targeted Individuals and Directed Energy Weapons."
return p.linkify({args = {text = sampleText, mode = "static"}})
end
return p