- app/: app demo (Kivy/buildozer) da API do robo - software/: servidor RoboMovel (SLAM, profundidade, navegacao) e firmware da base movel (movido de firmware/) - simulacao/: projeto Godot do robo e script de lancamento servidor + simulacao - modelos/: planta do 5o andar do bloco D, cena Blender do corredor e modelo real do robo - partes/mdf/: chapas identificadas e nesting da base do robo (DXF/SVG/FCStd) - projeto/render, relatorio/imagens, slides: renders finais e apresentacoes de progresso - ferramentas/scripts: encaixe de chapas, planta do bloco D e render do corredor no Blender - .gitignore: ignora backups do Blender/FreeCAD e .godot/ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.4 KiB
GDScript
38 lines
1.4 KiB
GDScript
## Converts a (small, practical) subset of Markdown to Godot's RichTextLabel
|
|
## BBCode: fenced code blocks, inline code, bold, italic, headers, bullets.
|
|
## Not a full CommonMark implementation — just enough for chat responses.
|
|
class_name ClaudeGodotMarkdown
|
|
extends RefCounted
|
|
|
|
static func to_bbcode(text: String) -> String:
|
|
var fence_re := RegEx.new()
|
|
fence_re.compile("```([a-zA-Z0-9_+-]*)\\n?([\\s\\S]*?)```")
|
|
|
|
var out := ""
|
|
var pos := 0
|
|
for m in fence_re.search_all(text):
|
|
out += _inline_to_bbcode(text.substr(pos, m.get_start() - pos))
|
|
var lang := m.get_string(1)
|
|
var code := m.get_string(2)
|
|
out += "\n" + ClaudeGodotSyntaxHighlight.highlight(code, lang) + "\n"
|
|
pos = m.get_end()
|
|
out += _inline_to_bbcode(text.substr(pos))
|
|
return out
|
|
|
|
static func _inline_to_bbcode(text: String) -> String:
|
|
# Escape stray brackets first so only tags we insert below are live BBCode.
|
|
text = text.replace("[", "[lb]")
|
|
|
|
text = _sub(text, "(?m)^#{1,6}\\s+(.*)$", "[b]$1[/b]")
|
|
text = _sub(text, "(?m)^\\s*[-*]\\s+(.*)$", "• $1")
|
|
text = _sub(text, "\\*\\*([^*]+)\\*\\*", "[b]$1[/b]")
|
|
text = _sub(text, "`([^`]+)`", "[code]$1[/code]")
|
|
text = _sub(text, "\\*([^*]+)\\*", "[i]$1[/i]")
|
|
return text
|
|
|
|
static func _sub(text: String, pattern: String, replacement: String) -> String:
|
|
var re := RegEx.new()
|
|
if re.compile(pattern) != OK:
|
|
return text
|
|
return re.sub(text, replacement, true)
|