Convert MediaWiki to INI
Max file size 100mb.
MediaWiki vs INI Format Comparison
| Aspect | MediaWiki (Source Format) | INI (Target Format) |
|---|---|---|
| Format Overview |
MediaWiki
Wiki Markup Language
Lightweight markup language created by Magnus Manske and Lee Daniel Crocker for Wikipedia in 2002. Uses intuitive wiki syntax for headings, text formatting, hyperlinks, templates, and tables. Powers Wikipedia, Wiktionary, Wikimedia Commons, Fandom, and thousands of wikis worldwide. Wiki Markup Wikipedia Standard |
INI
Initialization File
Simple configuration file format using sections in square brackets and key-value pairs separated by equals signs. Originated in early Windows and MS-DOS applications. Despite its simplicity, INI files remain widely used for application settings, game configuration, PHP (php.ini), and MySQL (my.ini) configuration. Configuration Key-Value |
| Technical Specifications |
Structure: Plain text with wiki markup tags
Encoding: UTF-8 Format: Text-based markup language Compression: None (plain text) Extensions: .mediawiki, .wiki, .txt |
Structure: [Sections] with key=value pairs
Encoding: UTF-8 / ASCII Format: Plain text configuration Compression: None (plain text) Extensions: .ini, .cfg, .conf |
| Syntax Examples |
MediaWiki uses wiki markup syntax: == Database Settings ==
* '''Host''': localhost
* '''Port''': 3306
* '''Name''': mydb
== Application ==
{{Config|debug=true}}
{| class="wikitable"
|-
| timeout || 30
|}
|
INI uses sections and key-value pairs: [Database Settings] Host = localhost Port = 3306 Name = mydb [Application] debug = true timeout = 30 ; Comments use semicolons # or hash marks |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2002 (Wikipedia/MediaWiki)
Current Version: MediaWiki 1.42 (2024) Status: Actively developed Evolution: Continuous updates since 2002 |
Introduced: 1980s (MS-DOS/Windows)
Current Version: No formal specification Status: Stable, widely used Evolution: Informal extensions over time |
| Software Support |
MediaWiki: Native support
Pandoc: Full read/write support Editors: Any text editor Other: Wikipedia, Fandom, wiki engines |
Python: configparser (stdlib)
PHP: parse_ini_file (built-in) Windows: GetPrivateProfileString API Other: Every text editor, most languages |
Why Convert MediaWiki to INI?
Converting MediaWiki markup to INI format extracts structured data from wiki pages and organizes it into simple, machine-readable configuration files. This is particularly valuable when wiki pages document system configurations, application settings, or parameter lists that need to be consumed by software applications rather than read by humans in a browser.
The conversion maps MediaWiki's hierarchical heading structure to INI sections. Top-level headings (==) become [Section] headers, and the content within each section is parsed for key-value pairs. Wiki lists with labeled items, infobox template parameters, and table key-value columns are extracted into clean key=value lines that any configuration parser can read.
This conversion is especially useful in DevOps and system administration contexts where configuration documentation lives in a wiki but needs to be applied to actual systems. Instead of manually copying settings from wiki pages, administrators can convert the MediaWiki documentation directly to INI files that applications can consume. This reduces transcription errors and keeps documentation and configuration in sync.
INI files are supported by virtually every programming language and operating system. Python has configparser in its standard library, PHP has parse_ini_file, and .NET has built-in INI support. By converting wiki content to INI format, you create configuration files that can be used immediately without any additional parsing libraries or custom code.
Key Benefits of Converting MediaWiki to INI:
- Structured Extraction: Wiki headings become INI sections automatically
- Machine-Readable: Clean key=value pairs for application consumption
- Universal Parsing: Supported by Python, PHP, .NET, and all major languages
- Simple Format: Easy to read, edit, and maintain
- Doc-to-Config: Bridge wiki documentation and actual system configuration
- Minimal Size: Compact text output with no overhead
- Legacy Compatible: Works with older systems that expect INI format
Practical Examples
Example 1: Server Configuration Wiki Page
Input MediaWiki file (server.mediawiki):
== Database == * '''host''': db.example.com * '''port''': 5432 * '''name''': production_db * '''ssl''': true == Cache == * '''driver''': redis * '''host''': cache.example.com * '''ttl''': 3600
Output INI file (server.ini):
[Database] host = db.example.com port = 5432 name = production_db ssl = true [Cache] driver = redis host = cache.example.com ttl = 3600
Example 2: Application Settings Documentation
Input MediaWiki file (settings.mediawiki):
== General ==
{{Config
| app_name = MyApplication
| version = 2.1.0
| debug = false
}}
== Logging ==
{| class="wikitable"
|-
! Setting !! Value
|-
| level || INFO
|-
| file || /var/log/app.log
|-
| rotate || daily
|}
Output INI file (settings.ini):
[General] app_name = MyApplication version = 2.1.0 debug = false [Logging] level = INFO file = /var/log/app.log rotate = daily
Example 3: Game Configuration Wiki
Input MediaWiki file (game.mediawiki):
== Graphics == * '''resolution''': 1920x1080 * '''fullscreen''': true * '''vsync''': enabled * '''antialiasing''': 4x MSAA == Audio == * '''master_volume''': 80 * '''music_volume''': 60 * '''effects_volume''': 100 * '''voice_chat''': enabled
Output INI file (game.ini):
[Graphics] resolution = 1920x1080 fullscreen = true vsync = enabled antialiasing = 4x MSAA [Audio] master_volume = 80 music_volume = 60 effects_volume = 100 voice_chat = enabled
Frequently Asked Questions (FAQ)
Q: What is the INI file format?
A: INI (Initialization) is a simple configuration file format that uses sections enclosed in square brackets and key-value pairs separated by equals signs. It originated in MS-DOS and early Windows systems in the 1980s. Despite its age, INI remains widely used for application configuration (php.ini, my.ini, setup.cfg), game settings, and system preferences due to its simplicity and universal readability.
Q: How are MediaWiki headings mapped to INI sections?
A: Each MediaWiki heading (== Section Name ==) becomes an INI section header ([Section Name]). Sub-headings can be represented as nested section names using dots or underscores (e.g., [Section.Subsection]). Content under each heading is parsed for key-value pairs, which become the settings within that INI section. This natural mapping preserves the organizational structure of the wiki page.
Q: What happens to wiki formatting like bold and italic?
A: Text formatting markup ('''bold''', ''italic'') is stripped during conversion since INI files are plain text configuration files that do not support formatting. The plain text content of formatted elements is preserved as values. If formatting indicates key names (commonly bolded in wiki documentation), the bold text becomes the INI key and the following text becomes the value.
Q: How are wiki tables converted to INI format?
A: Wiki tables with two columns are interpreted as key-value pairs, where the first column becomes the INI key and the second column becomes the value. Tables with more columns may be serialized as indexed keys (column1_1, column1_2, etc.) or concatenated values. Single-column tables are stored as sequential numbered keys within the current section.
Q: Can INI files handle complex nested data from wiki pages?
A: INI files have limited support for nested data structures. While some INI parsers support dotted key names (database.host) for simulated nesting, true hierarchical data is not natively supported. For complex nested wiki content, consider converting to JSON, YAML, or TOML instead. INI is best suited for flat configuration data with simple sections and key-value pairs.
Q: Are wiki template parameters preserved in the INI output?
A: Yes, template parameters with named values are excellent candidates for INI conversion. A template call like {{Config|host=localhost|port=8080}} naturally maps to INI key-value pairs: host=localhost and port=8080. The template name can become the section header or a comment annotation. This makes wiki templates one of the best-preserved elements in the conversion.
Q: How are comments handled in the conversion?
A: Descriptive text from the MediaWiki source that doesn't map to key-value pairs is converted to INI comments, prefixed with semicolons (;). This preserves the documentation and explanatory content from the wiki page as contextual information in the INI file. Wiki comments (HTML comments) are also converted to INI comments, maintaining any developer notes.
Q: What programming languages can read INI files?
A: Virtually every programming language has INI parsing support. Python includes configparser in its standard library; PHP has the built-in parse_ini_file() function; .NET provides System.Configuration; Java has java.util.Properties; Ruby has the iniparse gem; and Node.js has the ini npm package. Even shell scripts can parse INI files using grep and sed. This universal support makes INI one of the most accessible configuration formats.