Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Scenes/intro.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ bbcode_text = "[center][color=red]WARNING[/color][color=white]
This game uses auto save
Please do not turn off the game while this icon is being displayed
[/color][/center]"
text = "WARNING
text = "[center][color=red]WARNING[/color][color=white]
This game uses auto save
Please do not turn off the game while this icon is being displayed
"
[/color][/center]"
__meta__ = {
"_edit_use_anchors_": false
}
Expand Down
3 changes: 3 additions & 0 deletions assets/themes/new_gui/base_theme.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[gd_resource type="Theme" format=2]

[resource]
1 change: 1 addition & 0 deletions assets/themes/new_gui/neon.tres
Original file line number Diff line number Diff line change
Expand Up @@ -8743,6 +8743,7 @@ shadow_color = Color( 0, 0, 0, 0.3 )
shadow_size = 8

[sub_resource type="ImageTexture" id=1154]
resource_local_to_scene = true

[sub_resource type="StyleBoxFlat" id=1155]
bg_color = Color( 0, 0.6, 0.8, 1 )
Expand Down
47 changes: 28 additions & 19 deletions markdown_processor/markdown_processor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,18 @@ func process_to_bbcode(_text:String):
bbcode_text = new_text

func _parse_line(_text:String):
var base_text = _text
var text_to_return = _text
for i in tags:
print(_text.begins_with(i))
if _text.begins_with(i): #has one of tags
if base_text.begins_with(i): #has one of tags
if i == "<!--":
text_to_return = ""
else:
var _nt = _text.trim_prefix(i)
print("NT: " + _nt)
var _nt = base_text.trim_prefix(i)
print("NT: " + str(str(tags[i]) % _nt))
base_text=str(str(tags[i]) % _nt)
text_to_return=str(str(tags[i]) % _nt)
else:#none, go try other methods
var regex = RegEx.new()
var patterns = {
"(http|ftp|https):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])": "url", #url address
"(\\*+)(\\s*\\b)([^\\*]*)(\\b\\s*)(\\*+)": "bold"
}
for i2 in patterns:
regex.compile(i2)
var result = regex.search(_text)
if result != null:
print("Regex result is: " + result.get_string())
if patterns[i2] == "url":
text_to_return = _text.replace(result.get_string(), _parse_url(result.get_string()))
elif patterns[i2] == "bold":
text_to_return = _text.replace(result.get_string(), _parse_bold(result.get_string()))
text_to_return=_recurse_regex(base_text)
return text_to_return + "\n"


Expand All @@ -75,3 +62,25 @@ func _parse_bold(t:String):
var t1 = t.trim_prefix('**')
var t2 = t1.trim_suffix('**')
return "[b]" + t2 + "[/b]"


func _recurse_regex(_text:String):
var text_to_return = _text
var base_text = _text
var regex = RegEx.new()
var patterns = {
"(http|ftp|https):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])": "url", #url address
"(\\*+)(\\s*\\b)([^\\*]*)(\\b\\s*)(\\*+)": "bold"
}
var pattern_results = {}
for i2 in patterns:
regex.compile(i2)
print("REGEX is Searching for %s in: %s" % [patterns[i2], base_text])
var result = regex.search(base_text)
if result != null:
print("Regex result is: " + result.get_string())
if patterns[i2] == "url":
text_to_return = base_text.replace(result.get_string(), _parse_url(result.get_string()))
elif patterns[i2] == "bold":
text_to_return = base_text.replace(result.get_string(), _parse_bold(result.get_string()))
return text_to_return
6 changes: 3 additions & 3 deletions markdown_processor/markdown_processor.tscn
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]

[ext_resource path="res://markdown_processor/markdown_processor.gd" type="Script" id=1]
[ext_resource path="res://assets/themes/new_gui/neon.tres" type="Theme" id=2]

[node name="Control" type="RichTextLabel"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 2 )
margin_right = -779.0
margin_bottom = -544.0
bbcode_enabled = true
script = ExtResource( 1 )
__meta__ = {
Expand Down
5 changes: 3 additions & 2 deletions updater/GithubUpdate.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://updater/GithubUpdate.gd" type="Script" id=1]
[ext_resource path="res://markdown_processor/markdown_processor.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/themes/new_gui/neon.tres" type="Theme" id=3]
[ext_resource path="res://assets/fonts/RobotoRegular.tres" type="DynamicFont" id=4]
[ext_resource path="res://assets/fonts/RobotoRegularBold.tres" type="DynamicFont" id=5]
[ext_resource path="res://updater/unzipper.py" type="Script" id=6]
[ext_resource path="res://assets/themes/new_gui/base_theme.tres" type="Theme" id=7]

[node name="GithubUpdate" type="WindowDialog"]
visible = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
Expand All @@ -35,6 +35,7 @@ margin_left = -0.118
margin_top = 0.0719986
margin_right = -0.0180664
margin_bottom = -0.136017
theme = ExtResource( 7 )
custom_fonts/bold_font = ExtResource( 5 )
custom_fonts/normal_font = ExtResource( 4 )

Expand Down