Created
November 6, 2018 00:14
-
-
Save tkisason/0f41ceadb1a9819fa1dd14352c22fc2b to your computer and use it in GitHub Desktop.
Convert markdown table to mediawiki table format (owasp.org wiki)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert(intext): | |
intext = intext.split('\n') | |
text = '{| class="wikitable"' +'\n' | |
line = intext[0].replace(' | ', ' !! ').replace('| ','! ') | |
text += line + '\n' | |
intext.pop(0) | |
for row in intext: | |
text += '|-' + '\n' | |
row = row.replace(' | ',' || ').replace('**','') | |
text += row[:-1] + '\n' | |
text += '|}' | |
return text | |
a = ""dump content here"" | |
print(convert(a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment