2023-08-25 14:34:57 +02:00
|
|
|
######################################
|
|
|
|
# THE CORE FRAMEWORK #
|
|
|
|
# MADE BY THE STAROPENSOURCE PROJECT #
|
|
|
|
# AND CONTRIBUTERS (THANK YOU!) #
|
|
|
|
# #
|
|
|
|
# COPYRIGHT 2023 THE STAROPENSOURCE #
|
|
|
|
# PROJECT AND CONTRIBUTERS #
|
|
|
|
# #
|
|
|
|
# LICENSED UNDER THE GNU GENERAL #
|
|
|
|
# PUBLIC LICENSE VERSION 3 (ONLY) #
|
|
|
|
######################################
|
2023-08-07 14:49:12 +02:00
|
|
|
extends Node
|
|
|
|
|
2023-08-25 14:34:57 +02:00
|
|
|
# CORE modules
|
|
|
|
var core: Node = null
|
|
|
|
var logger: Node = null
|
|
|
|
|
|
|
|
# Font sizes
|
|
|
|
var fsizes: Dictionary = {"text":"16","h1":"29","h2":"24","h3":"19","h4":"14","h5":"9","h6":"4"}
|
2023-08-07 14:49:12 +02:00
|
|
|
|
|
|
|
func parse(content:String) -> String:
|
2023-08-25 14:34:57 +02:00
|
|
|
var parse_text: String = ""
|
2023-08-07 14:49:12 +02:00
|
|
|
for line in content.split("\n",false):
|
2023-08-25 14:34:57 +02:00
|
|
|
var line_mod: String = line
|
2023-08-07 14:49:12 +02:00
|
|
|
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
|