User:NewseX

From Trials in Tainted Space Wiki
Revision as of 18:11, 17 September 2017 by NewseX (talk | contribs) (welp)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PowerShell script to convert actionscript to mediawiki content for codex

  1. Goto Public Github CodexEntries.as
  2. Find the function for the Codex entry you want( fenoxo names functions stupidly sometimes, but the configureCodex() main function will include a short list of them all).
  3. Highlight all the lines starting with "outputCodex" within the function.
  4. Copy paste those lines into notepad and save the file as codex.txt
  5. Open PowerShell. Should be included with windows.
  6. cd into the dir that you stored codex.txt
  7. Paste this code:
$path = ".\codex.txt";
(Get-Content $path -Raw) | Foreach-Object {
    $_ -replace "`t","" `
    -replace "outputCodex\(header\(`".*.`"\)\);","" `
    -replace "\/\/.*","" `
    -replace "outputCodex\(`"","" `
    -replace "\r\n","" `
    -replace "\n","" `
    -replace "\r","" `
    -replace "\\n\\n","`n" `
    -replace "\\n","`n`n" `
    -replace "`"\);","" `
    -replace "outputCodex\(blockHeader\(`"","</blockquote>`n===" `
    -replace "`"\)\);","===`n<blockquote>" `
    -replace "\\`'","`'" `
    -replace "\\`"","`"" `
    -replace "\\\(","\(" `
    -replace "\\\)","\)" `
    -replace "if *\([\=\ a-zA-Z0-9\(&*\[\]$^\*<!=>%|\-+/_`"]*\)","" `
    } | Set-Content $path -Force;
"__NOTOC__ `r`n<onlyinclude>`r`n<blockquote>`r`n" + (Get-Content $path -Raw) | Set-Content $path -Force;
Add-Content $path "`r`n</blockquote>`r`n</onlyinclude>`r`n[[Category: Codices ]]"; 

If everything worked the text in codex.txt should have changed and can be copy/pasted into any codex wiki article. It should include the right categories, formatting, and deal with any other weirdness. You should still read the article to make sure. I tested it on PS5 (default in Windows 10), but I believe back to Windows 7 is okay.

Troubleshooting

  • Get-Content : Cannot bind argument to parameter 'Path' because it is null.
    • Your path variable wasn't set to a valid destination. Make sure to do $path = ".\dongs.txt" and that you are in the right directory.