-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix encoding for broken microsoft word html format
- Loading branch information
1 parent
841ffcc
commit c1a1fc4
Showing
4 changed files
with
48 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import re | ||
# Replace custom tags with HTML spans and apply classes | ||
# https://raw.githubusercontent.com/rr-/TRCustoms/develop/frontend/src/components/markdown-composer/MarkdownButtons/index.tsx | ||
def custom_markdown_parser(text): | ||
text = re.sub(r'\[o\](.*?)\[/o\]', r'<span class="object">\1</span>', text) # blue text for objects | ||
text = re.sub(r'\[s\](.*?)\[/s\]', r'<span class="secret">\1</span>', text) # secret styling | ||
text = re.sub(r'\[p\](.*?)\[/p\]', r'<span class="pickup">\1</span>', text) # pickup styling | ||
text = re.sub(r'\[e\](.*?)\[/e\]', r'<span class="enemy">\1</span>', text) # enemy styling | ||
text = re.sub(r'\[t\](.*?)\[/t\]', r'<span class="trap">\1</span>', text) # trap styling | ||
text = re.sub(r'\[center\](.*?)\[/center\]', r'<div style="text-align: center;">\1</div>', text) # center align | ||
|
||
return text | ||
|
||
# Example usage | ||
#description = """[center]**Tomb Raider: Pandora's Box**[/center] | ||
#[s]Secret text[/s] [o]Object text[/o] [p]Pickup text[/p]""" | ||
|
||
#parsed_description = custom_markdown_parser(description) | ||
#print(parsed_description) | ||
|
||
|