JeremyStarTM
ab5b3ade52
- Rewrote mkdevprj/rmdevprj in Makefile - Add MOAM modloader - Add core.exception() - Add protection mode - Rewrote module initialization - Add experimental markdown parser - Many more very small changes
29 lines
1.2 KiB
GDScript
29 lines
1.2 KiB
GDScript
extends Node
|
|
|
|
@onready
|
|
var core = get_node("/root/core")
|
|
var fsizes = {"text":"16","h1":"29","h2":"24","h3":"19","h4":"14","h5":"9","h6":"4"}
|
|
|
|
func parse(content:String) -> String:
|
|
var parse_text = ""
|
|
for line in content.split("\n",false):
|
|
var line_mod = line
|
|
if line_mod.begins_with("######"):
|
|
line_mod = line_mod.replace("######","[font_size=" + fsizes["h6"] + "]") + "[/font_size]"
|
|
elif line_mod.begins_with("#####"):
|
|
line_mod = line_mod.replace("#####","[font_size=" + fsizes["h5"] + "]") + "[/font_size]"
|
|
elif line_mod.begins_with("####"):
|
|
line_mod = line_mod.replace("####","[font_size=" + fsizes["h4"] + "]") + "[/font_size]"
|
|
elif line_mod.begins_with("###"):
|
|
line_mod = line_mod.replace("###","[font_size=" + fsizes["h3"] + "]") + "[/font_size]"
|
|
elif line_mod.begins_with("##"):
|
|
line_mod = line_mod.replace("##","[font_size=" + fsizes["h2"] + "]") + "[/font_size]"
|
|
elif line_mod.begins_with("#"):
|
|
line_mod = line_mod.replace("#","[font_size=" + fsizes["h1"] + "]") + "[/font_size]"
|
|
else:
|
|
line_mod = "[font_size=" + fsizes["text"] + "]" + line_mod + "[/font_size]"
|
|
parse_text = parse_text + line_mod + "\n"
|
|
return parse_text
|
|
|
|
func initialize() -> void:
|
|
core.setready()
|