Initial Android commit
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 6 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 8 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 3 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 8 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 76 KiB |
202
addons/dialogic/Documentation/Nodes/DocsMarkdownParser.gd
Normal file
|
@ -0,0 +1,202 @@
|
|||
extends Node
|
||||
|
||||
var heading1_font = "res://addons/dialogic/Documentation/Theme/DocumentationH1.tres"
|
||||
var heading2_font = "res://addons/dialogic/Documentation/Theme/DocumentationH2.tres"
|
||||
var heading3_font = "res://addons/dialogic/Documentation/Theme/DocumentationH3.tres"
|
||||
var heading4_font = "res://addons/dialogic/Documentation/Theme/DocumentationH4.tres"
|
||||
var heading5_font = "res://addons/dialogic/Documentation/Theme/DocumentationH5.tres"
|
||||
|
||||
|
||||
var heading1s = []
|
||||
var heading2s = []
|
||||
var heading3s = []
|
||||
var heading4s = []
|
||||
var heading5s = []
|
||||
var result = ""
|
||||
var bolded = []
|
||||
var italics = []
|
||||
var striked = []
|
||||
var coded = []
|
||||
var linknames = []
|
||||
var links = []
|
||||
var imagenames = []
|
||||
var imagelinks = []
|
||||
var lists = []
|
||||
var underlined = []
|
||||
|
||||
var accent_color: = Color()
|
||||
var sub_accent_color: = Color()
|
||||
|
||||
var editor_scale: = 1.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func set_accent_colors(new_accent_color:Color, new_sub_accent_color:Color)->void :
|
||||
accent_color = new_accent_color
|
||||
sub_accent_color = new_sub_accent_color
|
||||
|
||||
|
||||
func parse(content:String, file_path:String = "", docs_path:String = ""):
|
||||
|
||||
heading1s = []
|
||||
heading2s = []
|
||||
heading3s = []
|
||||
heading4s = []
|
||||
heading5s = []
|
||||
result = ""
|
||||
bolded = []
|
||||
italics = []
|
||||
striked = []
|
||||
coded = []
|
||||
linknames = []
|
||||
links = []
|
||||
imagenames = []
|
||||
imagelinks = []
|
||||
lists = []
|
||||
underlined = []
|
||||
|
||||
var parsed_text = content
|
||||
|
||||
var regex = RegEx.new()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
regex.compile("\\*\\*(?<boldtext>(\\.|[^(\\*\\*)])*)\\*\\*")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
parsed_text = parsed_text.replace("**" + res.get_string("boldtext") + "**", "[b]" + res.get_string("boldtext") + "[/b]")
|
||||
|
||||
|
||||
regex.compile("\\_\\_(?<underlinetext>.*)\\_\\_")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
parsed_text = parsed_text.replace("__" + res.get_string("underlinetext") + "__", "[u]" + res.get_string("underlinetext") + "[/u]")
|
||||
|
||||
|
||||
regex.compile("\\*(?<italictext>[^\\*]*)\\*")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
parsed_text = parsed_text.replace("*" + res.get_string("italictext") + "*", "[i]" + res.get_string("italictext") + "[/i]")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
regex.compile("~~(?<strikedtext>.*)~~")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
parsed_text = parsed_text.replace("~~" + res.get_string("strikedtext") + "~~", "[s]" + res.get_string("strikedtext") + "[/s]")
|
||||
|
||||
|
||||
regex.compile("(([^`]`)|(```))(?<coded>[^`]+)(?(2)(`)|(```))")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
if res.get_string().begins_with("```"):
|
||||
parsed_text = parsed_text.replace("```" + res.get_string("coded") + "```", "[indent][color=#" + accent_color.lightened(0.6).to_html() + "][code]" + res.get_string("coded") + "[/code][/color][/indent]")
|
||||
else :
|
||||
parsed_text = parsed_text.replace("`" + res.get_string("coded") + "`", "[color=#" + accent_color.lightened(0.6).to_html() + "][code]" + res.get_string("coded") + "[/code][/color]")
|
||||
|
||||
|
||||
|
||||
|
||||
regex.compile("\\n\\s*(?<symbol>[-+*])(?<element>\\s.*)")
|
||||
result = regex.search_all(parsed_text)
|
||||
if result:
|
||||
for res in result:
|
||||
var symbol = res.get_string("symbol")
|
||||
var element = res.get_string("element")
|
||||
if parsed_text.find(symbol + " " + element):
|
||||
parsed_text = parsed_text.replace(symbol + " " + element, "[indent]" + symbol + " " + element + "[/indent]")
|
||||
|
||||
|
||||
regex.compile("!\\[(?<imgname>.*)\\]\\((?<imglink>.*)\\)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
if res.get_string("imglink") != "":
|
||||
imagelinks.append(res.get_string("imglink"))
|
||||
if res.get_string("imgname") != "":
|
||||
imagenames.append(res.get_string("imgname"))
|
||||
|
||||
|
||||
regex.compile("[^!]\\[(?<linkname>[^\\[]+)\\]\\((?<link>[^\\)]*\\S*?)\\)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
if res.get_string("link") != "":
|
||||
links.append(res.get_string("link"))
|
||||
if res.get_string("linkname") != "":
|
||||
linknames.append(res.get_string("linkname"))
|
||||
|
||||
|
||||
regex.compile("(?:\\n|^)#(?<heading>[^#\\n]+[^\\n]+)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
var heading = res.get_string("heading")
|
||||
heading1s.append(heading)
|
||||
parsed_text = parsed_text.replace("#" + heading, "[color=#" + accent_color.lightened(0.2).to_html() + "][font=" + heading1_font + "]" + heading.strip_edges() + "[/font][/color]")
|
||||
|
||||
|
||||
regex.compile("(?:\\n|^)##(?<heading>[^#\\n]+[^\\n]+)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
var heading = res.get_string("heading")
|
||||
heading2s.append(heading)
|
||||
parsed_text = parsed_text.replace("\n##" + heading, "\n[color=#" + accent_color.lightened(0.5).to_html() + "][font=" + heading2_font + "]" + heading.strip_edges() + "[/font][/color]")
|
||||
|
||||
|
||||
regex.compile("(?:\\n|^)###(?<heading>[^#\\n]+[^\\n]+)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
var heading = res.get_string("heading")
|
||||
parsed_text = parsed_text.replace("\n###" + heading, "\n[color=#" + accent_color.lightened(0.7).to_html() + "][font=" + heading3_font + "]" + heading.strip_edges() + "[/font][/color]")
|
||||
|
||||
|
||||
regex.compile("(?:\\n|^)####(?<heading>[^#\\n]+[^\\n]+)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
var heading = res.get_string("heading")
|
||||
parsed_text = parsed_text.replace("\n####" + heading, "\n[color=#" + accent_color.lightened(0.85).to_html() + "][font=" + heading4_font + "]" + heading.strip_edges() + "[/font][/color]")
|
||||
|
||||
|
||||
|
||||
regex.compile("(?:\\n|^)#####(?<heading>[^#\\n]+[^\\n]+)")
|
||||
result = regex.search_all(content)
|
||||
if result:
|
||||
for res in result:
|
||||
var heading = res.get_string("heading")
|
||||
parsed_text = parsed_text.replace("\n#####" + heading, "\n[color=#" + accent_color.lightened(0.85).to_html() + "][font=" + heading5_font + "]" + heading.strip_edges() + "[/font][/color]")
|
||||
|
||||
for i in links.size():
|
||||
parsed_text = parsed_text.replace("[" + linknames[i] + "](" + links[i] + ")", "[color=#" + accent_color.to_html() + "][url=" + links[i] + "]" + linknames[i] + "[/url][/color]")
|
||||
|
||||
for i in imagenames.size():
|
||||
var imagelink_to_use = imagelinks[i]
|
||||
if imagelink_to_use.begins_with("http"):
|
||||
var path_parts = imagelink_to_use.split("/Documentation/")
|
||||
if path_parts.size() > 1:
|
||||
imagelink_to_use = docs_path + "/" + path_parts[1]
|
||||
else :
|
||||
imagelink_to_use = "icon.png"
|
||||
if imagelink_to_use.begins_with(".") and file_path:
|
||||
imagelink_to_use = file_path.trim_suffix(file_path.get_file()).trim_suffix("/") + imagelink_to_use.trim_prefix(".")
|
||||
parsed_text = parsed_text.replace("![" + imagenames[i] + "](" + imagelinks[i] + ")", "[img=" + str(int(700 * editor_scale)) + "]" + imagelink_to_use + "[/img]")
|
||||
|
||||
parsed_text += "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
|
||||
|
||||
return parsed_text
|
205
addons/dialogic/Documentation/Nodes/DocsPageViewer.gd
Normal file
|
@ -0,0 +1,205 @@
|
|||
tool
|
||||
extends Control
|
||||
|
||||
export (bool) var enable_editing = false
|
||||
|
||||
export (String) var documentation_path:String = "res://addons/dialogic/Documentation"
|
||||
var MarkdownParser = load("res://addons/dialogic/Documentation/Nodes/DocsMarkdownParser.gd").new()
|
||||
|
||||
var current_path:String = ""
|
||||
var current_headings = []
|
||||
|
||||
onready var Content = $Content
|
||||
|
||||
signal open_non_html_link(link, section)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func load_page(page_path:String, section:String = ""):
|
||||
Content.set("custom_styles/normal", StyleBoxEmpty.new())
|
||||
Content.get("custom_styles/normal").content_margin_left = 15
|
||||
Content.get("custom_styles/normal").content_margin_top = 15
|
||||
Content.get("custom_styles/normal").content_margin_right = 15
|
||||
Content.get("custom_styles/normal").content_margin_bottom = 15
|
||||
|
||||
var base_size = 16
|
||||
Content.set("custom_fonts/normal_font/size", int(base_size * get_constant("scale", "Editor")))
|
||||
Content.set("custom_fonts/bold_font/size", int(base_size * get_constant("scale", "Editor")))
|
||||
|
||||
Content.set("custom_fonts/mono_font/size", int(base_size * get_constant("scale", "Editor")))
|
||||
Content.set("custom_fonts/bold_italics_font/size", int(base_size * get_constant("scale", "Editor")))
|
||||
|
||||
|
||||
|
||||
Content.set("custom_fonts/mono_font", get_font("doc_source", "EditorFonts"))
|
||||
Content.set("custom_fonts/bold_font", Content.get_font("doc_bold", "EditorFonts"))
|
||||
|
||||
MarkdownParser.set_accent_colors(get_color("accent_color", "Editor"), get_color("disabled_font_color", "Editor"))
|
||||
|
||||
if page_path == "" and not section:
|
||||
return
|
||||
|
||||
show()
|
||||
_on_Content_resized()
|
||||
|
||||
|
||||
|
||||
if page_path.count("#") > 0:
|
||||
var result = page_path.split("#")
|
||||
page_path = result[0]
|
||||
section = "#" + result[1]
|
||||
|
||||
|
||||
if not page_path.begins_with("res://"):
|
||||
page_path = documentation_path + "/Content/" + page_path
|
||||
if not page_path.ends_with(".md"):
|
||||
page_path += ".md"
|
||||
|
||||
|
||||
var f = File.new()
|
||||
f.open(page_path, File.READ)
|
||||
current_path = page_path
|
||||
|
||||
|
||||
Content.bbcode_text = MarkdownParser.parse(f.get_as_text(), current_path, documentation_path)
|
||||
f.close()
|
||||
|
||||
|
||||
current_headings = MarkdownParser.heading1s + MarkdownParser.heading2s + MarkdownParser.heading3s + MarkdownParser.heading4s + MarkdownParser.heading5s
|
||||
create_content_menu(MarkdownParser.heading1s + MarkdownParser.heading2s)
|
||||
|
||||
|
||||
if not scroll_to_section(section):
|
||||
Content.scroll_to_line(0)
|
||||
|
||||
|
||||
yield (get_tree(), "idle_frame")
|
||||
_on_Up_pressed()
|
||||
|
||||
|
||||
|
||||
func scroll_to_section(title):
|
||||
if not title:
|
||||
return
|
||||
|
||||
for heading in current_headings:
|
||||
if (heading.to_lower().strip_edges().replace(" ", "-") == title.replace("#", "")) or (heading.to_lower().strip_edges() == title.to_lower().strip_edges()):
|
||||
var x = Content.bbcode_text.find(heading.replace("#", "").strip_edges() + "[/font]")
|
||||
x = Content.bbcode_text.count("\n", 0, x)
|
||||
Content.scroll_to_line(x)
|
||||
|
||||
$ContentMenu / Panel.hide()
|
||||
|
||||
return true
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _ready():
|
||||
$Up.icon = get_icon("ArrowUp", "EditorIcons")
|
||||
|
||||
$Editing.visible = enable_editing
|
||||
|
||||
|
||||
|
||||
func create_content_menu(headings):
|
||||
for child in $ContentMenu / Panel / VBox.get_children():
|
||||
child.queue_free()
|
||||
if len(headings) < 2:
|
||||
$ContentMenu.hide()
|
||||
return
|
||||
$ContentMenu.show()
|
||||
headings.pop_front()
|
||||
for heading in headings:
|
||||
var button = Button.new()
|
||||
button.set("custom_styles/normal", get_stylebox("sub_inspector_bg0", "Editor"))
|
||||
button.text = heading
|
||||
button.align = Button.ALIGN_LEFT
|
||||
button.connect("pressed", self, "content_button_pressed", [heading])
|
||||
$ContentMenu / Panel / VBox.add_child(button)
|
||||
|
||||
|
||||
func content_button_pressed(heading):
|
||||
scroll_to_section(heading)
|
||||
$ContentMenu / ToggleContents.pressed = false
|
||||
|
||||
|
||||
|
||||
func _on_meta_clicked(meta):
|
||||
|
||||
if meta.begins_with("http"):
|
||||
|
||||
|
||||
if meta.count("Documentation/Content") > 0:
|
||||
meta = meta.split("Documentation/Content")[1]
|
||||
|
||||
|
||||
else :
|
||||
OS.shell_open(meta)
|
||||
return
|
||||
|
||||
|
||||
if meta.begins_with("#"):
|
||||
|
||||
scroll_to_section(meta)
|
||||
|
||||
|
||||
else :
|
||||
|
||||
var link = meta
|
||||
var section = null
|
||||
if meta.count("#") > 0:
|
||||
var split = meta.split("#")
|
||||
link = split[0]
|
||||
section = split[1]
|
||||
if link.begins_with("."):
|
||||
link = current_path.trim_suffix(current_path.get_file()).trim_suffix("/") + link.trim_prefix(".")
|
||||
if not link.begins_with("res://"):
|
||||
link = documentation_path.plus_file("Content").plus_file(link)
|
||||
if not link.ends_with(".md"):
|
||||
link += ".md"
|
||||
|
||||
emit_signal("open_non_html_link", link, section)
|
||||
|
||||
|
||||
func _on_EditPage_pressed():
|
||||
var x = File.new()
|
||||
x.open(current_path, File.READ)
|
||||
OS.shell_open(x.get_path_absolute())
|
||||
|
||||
|
||||
func _on_RefreshPage_pressed():
|
||||
load_page(current_path)
|
||||
|
||||
|
||||
func _on_Up_pressed():
|
||||
Content.scroll_to_line(0)
|
||||
|
||||
|
||||
func _on_ToggleContents_toggled(button_pressed):
|
||||
$ContentMenu / Panel.visible = button_pressed
|
||||
|
||||
func toggle_editing():
|
||||
enable_editing = not enable_editing
|
||||
$Editing.visible = enable_editing
|
||||
|
||||
func _on_Content_resized():
|
||||
if not Content:return
|
||||
if Content.rect_size.x < 500:
|
||||
Content.get("custom_styles/normal").content_margin_left = 15
|
||||
Content.get("custom_styles/normal").content_margin_right = 15
|
||||
else :
|
||||
Content.get("custom_styles/normal").content_margin_left = (Content.rect_size.x - 500) / 4
|
||||
Content.get("custom_styles/normal").content_margin_right = (Content.rect_size.x - 500) / 3
|
||||
Content.update()
|
178
addons/dialogic/Documentation/Nodes/DocsPageViewer.tscn
Normal file
|
@ -0,0 +1,178 @@
|
|||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Regular.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Bold.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Italic.ttf" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Nodes/DocsPageViewer.gd" type="Script" id=6]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=1]
|
||||
content_margin_left = 89.5
|
||||
content_margin_right = 119.333
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
use_filter = true
|
||||
extra_spacing_char = 2
|
||||
extra_spacing_space = 2
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=6]
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="Image" id=9]
|
||||
data = {
|
||||
"data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ),
|
||||
"format": "LumAlpha8",
|
||||
"height": 16,
|
||||
"mipmaps": false,
|
||||
"width": 16
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id=8]
|
||||
flags = 4
|
||||
flags = 4
|
||||
image = SubResource( 9 )
|
||||
size = Vector2( 16, 16 )
|
||||
|
||||
[node name="DocsPageViewer" type="Control"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
focus_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Content" type="RichTextLabel" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 50, 0 )
|
||||
focus_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_styles/normal = SubResource( 1 )
|
||||
custom_fonts/mono_font = SubResource( 2 )
|
||||
custom_fonts/bold_italics_font = SubResource( 3 )
|
||||
custom_fonts/italics_font = SubResource( 4 )
|
||||
custom_fonts/bold_font = SubResource( 5 )
|
||||
custom_fonts/normal_font = SubResource( 6 )
|
||||
custom_colors/selection_color = Color( 0.45098, 0.45098, 0.45098, 0.45098 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "Can't find the specified file."
|
||||
text = "Can't find the specified file."
|
||||
scroll_following = true
|
||||
selection_enabled = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Editing" type="HBoxContainer" parent="."]
|
||||
visible = false
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -202.807
|
||||
margin_top = 8.09956
|
||||
margin_right = -8.80664
|
||||
margin_bottom = 33.0996
|
||||
grow_horizontal = 0
|
||||
alignment = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="RefreshPage" type="Button" parent="Editing"]
|
||||
margin_left = 94.0
|
||||
margin_right = 154.0
|
||||
margin_bottom = 25.0
|
||||
text = "Refresh"
|
||||
|
||||
[node name="EditPage" type="Button" parent="Editing"]
|
||||
margin_left = 158.0
|
||||
margin_right = 194.0
|
||||
margin_bottom = 25.0
|
||||
text = "Edit"
|
||||
|
||||
[node name="Up" type="Button" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -40.5946
|
||||
margin_top = -41.6541
|
||||
margin_right = -10.5946
|
||||
margin_bottom = -11.6541
|
||||
rect_min_size = Vector2( 30, 30 )
|
||||
hint_tooltip = "Back to top"
|
||||
icon = SubResource( 8 )
|
||||
expand_icon = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ContentMenu" type="VBoxContainer" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -207.0
|
||||
margin_top = -590.0
|
||||
margin_right = -49.0
|
||||
margin_bottom = -13.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
rect_min_size = Vector2( 50, 40 )
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 9
|
||||
custom_constants/separation = 20
|
||||
alignment = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Panel" type="Control" parent="ContentMenu"]
|
||||
visible = false
|
||||
margin_top = 537.0
|
||||
margin_right = 158.0
|
||||
margin_bottom = 537.0
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="ContentMenu/Panel"]
|
||||
margin_top = -88.0
|
||||
margin_right = 156.0
|
||||
margin_bottom = 4.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
size_flags_horizontal = 3
|
||||
alignment = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ToggleContents" type="Button" parent="ContentMenu"]
|
||||
margin_top = 557.0
|
||||
margin_right = 158.0
|
||||
margin_bottom = 577.0
|
||||
toggle_mode = true
|
||||
text = "Contents"
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[connection signal="meta_clicked" from="Content" to="." method="_on_meta_clicked"]
|
||||
[connection signal="resized" from="Content" to="." method="_on_Content_resized"]
|
||||
[connection signal="pressed" from="Editing/RefreshPage" to="." method="_on_RefreshPage_pressed"]
|
||||
[connection signal="pressed" from="Editing/EditPage" to="." method="_on_EditPage_pressed"]
|
||||
[connection signal="pressed" from="Up" to="." method="_on_Up_pressed"]
|
||||
[connection signal="toggled" from="ContentMenu/ToggleContents" to="." method="_on_ToggleContents_toggled"]
|
224
addons/dialogic/Documentation/Nodes/DocsTreeHelper.gd
Normal file
|
@ -0,0 +1,224 @@
|
|||
tool
|
||||
extends Control
|
||||
|
||||
|
||||
export (String) var documentation_path:String = "res://addons/dialogic/Documentation"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var use_folder_files = true
|
||||
|
||||
|
||||
var file_ignore_list = ["Welcome.md"]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func get_documentation_content():
|
||||
return get_dir_contents(documentation_path + "/Content")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func build_documentation_tree(tree:Tree, root_item:TreeItem = null, def_folder_info:Dictionary = {}, def_page_info:Dictionary = {}, filter_term:String = ""):
|
||||
return _build_documentation_tree(tree, root_item, def_folder_info, def_page_info, filter_term)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func get_dir_contents(rootPath:String)->Dictionary:
|
||||
var directory_structure = {}
|
||||
var dir: = Directory.new()
|
||||
|
||||
if dir.open(rootPath) == OK:
|
||||
dir.list_dir_begin(true, false)
|
||||
directory_structure = _add_dir_contents(dir)
|
||||
else :
|
||||
push_error("Docs: An error occurred when trying to access the path.")
|
||||
return directory_structure
|
||||
|
||||
func _add_dir_contents(dir:Directory)->Dictionary:
|
||||
var file_name = dir.get_next()
|
||||
|
||||
var structure = {}
|
||||
while (file_name != ""):
|
||||
var path = dir.get_current_dir() + "/" + file_name
|
||||
if dir.current_is_dir():
|
||||
|
||||
var subDir = Directory.new()
|
||||
subDir.open(path)
|
||||
subDir.list_dir_begin(true, false)
|
||||
var dir_content = _add_dir_contents(subDir)
|
||||
if dir_content.has("_files_"):
|
||||
structure[path] = dir_content
|
||||
else :
|
||||
|
||||
if not file_name.ends_with(".md"):
|
||||
file_name = dir.get_next()
|
||||
continue
|
||||
if file_name in file_ignore_list:
|
||||
file_name = dir.get_next()
|
||||
continue
|
||||
if not structure.has("_files_"):
|
||||
structure["_files_"] = []
|
||||
|
||||
structure["_files_"].append(path)
|
||||
|
||||
file_name = dir.get_next()
|
||||
dir.list_dir_end()
|
||||
return structure
|
||||
|
||||
|
||||
|
||||
|
||||
func _build_documentation_tree(tree:Tree, root_item:TreeItem = null, def_folder_info:Dictionary = {}, def_page_info:Dictionary = {}, filter_term:String = ""):
|
||||
|
||||
var documentation_tree
|
||||
if root_item == null:
|
||||
documentation_tree = tree.create_item()
|
||||
documentation_tree.set_text(0, "Documentation")
|
||||
|
||||
else :
|
||||
documentation_tree = root_item
|
||||
|
||||
|
||||
if not filter_term:
|
||||
documentation_tree.collapsed = true
|
||||
else :
|
||||
documentation_tree.collapsed = false
|
||||
|
||||
|
||||
var doc_structure = get_documentation_content()
|
||||
|
||||
create_doc_tree(tree, documentation_tree, def_folder_info, def_page_info, doc_structure, filter_term)
|
||||
return documentation_tree
|
||||
|
||||
|
||||
func create_doc_tree(tree, parent_item, def_folder_info, def_page_info, doc_structure, filter_term):
|
||||
for key in doc_structure.keys():
|
||||
|
||||
if typeof(doc_structure[key]) == TYPE_DICTIONARY:
|
||||
var folder_item = _add_documentation_folder(tree, parent_item, {"name":key.get_file(), "path":key}, def_folder_info)
|
||||
create_doc_tree(tree, folder_item, def_folder_info, def_page_info, doc_structure[key], filter_term)
|
||||
if not filter_term:
|
||||
folder_item.collapsed = true
|
||||
|
||||
elif typeof(doc_structure[key]) == TYPE_ARRAY:
|
||||
for file in doc_structure[key]:
|
||||
if use_folder_files and file.trim_suffix(".md") in doc_structure.keys():
|
||||
pass
|
||||
else :
|
||||
if not filter_term or (filter_term and filter_term.to_lower() in get_title(file, "").to_lower()):
|
||||
_add_documentation_page(tree, parent_item, {"name":file.get_file().trim_suffix(".md"), "path":file}, def_page_info)
|
||||
|
||||
func merge_dir(target:Dictionary, patch:Dictionary):
|
||||
var copy = target.duplicate()
|
||||
for key in patch:
|
||||
copy[key] = patch[key]
|
||||
return copy
|
||||
|
||||
|
||||
func _add_documentation_folder(tree, parent_item, folder_info, default_info):
|
||||
var item = tree.create_item(parent_item)
|
||||
item.set_text(0, folder_info["name"])
|
||||
item.set_icon(0, tree.get_icon("HelpSearch", "EditorIcons"))
|
||||
item.set_editable(0, false)
|
||||
if use_folder_files:
|
||||
var x = File.new()
|
||||
if x.file_exists(folder_info["path"] + ".md"):
|
||||
folder_info["path"] += ".md"
|
||||
else :
|
||||
folder_info["path"] = ""
|
||||
else :
|
||||
folder_info["path"] = ""
|
||||
item.set_metadata(0, merge_dir(default_info, folder_info))
|
||||
if not tree.get_constant("dark_theme", "Editor"):
|
||||
item.set_icon_modulate(0, get_color("property_color", "Editor"))
|
||||
return item
|
||||
|
||||
|
||||
func _add_documentation_page(tree, parent, page_info, default_info):
|
||||
var item = tree.create_item(parent)
|
||||
item.set_text(0, get_title(page_info["path"], page_info["name"]))
|
||||
item.set_tooltip(0, page_info["path"])
|
||||
item.set_editable(0, false)
|
||||
item.set_icon(0, tree.get_icon("Help", "EditorIcons"))
|
||||
var new_dir = merge_dir(default_info, page_info)
|
||||
|
||||
item.set_metadata(0, new_dir)
|
||||
if not tree.get_constant("dark_theme", "Editor"):
|
||||
item.set_icon_modulate(0, get_color("property_color", "Editor"))
|
||||
return item
|
||||
|
||||
|
||||
func get_title(path, default_name):
|
||||
|
||||
var f = File.new()
|
||||
f.open(path, File.READ)
|
||||
var arr = f.get_as_text().split("\n", false, 1)
|
||||
if not arr.empty():
|
||||
return arr[0].trim_prefix("#").strip_edges()
|
||||
else :
|
||||
return default_name
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func search_and_select_docs(docs_tree_item:TreeItem, info:String, key:String = "path"):
|
||||
if info == "":return
|
||||
if info == "/":
|
||||
docs_tree_item.select(0)
|
||||
return true
|
||||
|
||||
|
||||
var item = docs_tree_item.get_children()
|
||||
while item:
|
||||
|
||||
if not item.has_method("get_metadata"):
|
||||
item = item.get_next()
|
||||
|
||||
var meta = item.get_metadata(0)
|
||||
|
||||
if meta.has(key):
|
||||
if meta[key] == info:
|
||||
item.select(0)
|
||||
return true
|
||||
if search_and_select_docs(item, info, key):
|
||||
return true
|
||||
item = item.get_next()
|
||||
return false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
11
addons/dialogic/Documentation/Nodes/DocsTreeHelper.tscn
Normal file
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Nodes/DocsTreeHelper.gd" type="Script" id=1]
|
||||
|
||||
[node name="DocsTreeHelper" type="Control"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
32
addons/dialogic/Documentation/Nodes/DocumentationTree.gd
Normal file
|
@ -0,0 +1,32 @@
|
|||
tool
|
||||
extends Tree
|
||||
|
||||
var documentation_tree
|
||||
|
||||
|
||||
signal _page_selected(path)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func select_item(path):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _ready():
|
||||
connect("item_selected", self, "_on_item_selected")
|
||||
|
||||
|
||||
documentation_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
|
||||
|
||||
|
||||
func _on_item_selected():
|
||||
var item = get_selected()
|
||||
var metadata = item.get_metadata(0)
|
||||
if metadata.has("path"):
|
||||
emit_signal("_page_selected", metadata["path"])
|
14
addons/dialogic/Documentation/Nodes/DocumentationTree.tscn
Normal file
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Nodes/DocumentationTree.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[node name="DocumentationTree" type="Tree"]
|
||||
margin_right = 506.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
21
addons/dialogic/Documentation/Nodes/DocumentationViewer.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
tool
|
||||
extends Control
|
||||
|
||||
onready var DocTree = $HSplit / VBoxContainer / DocumentationTree
|
||||
onready var DocPageViewer = $HSplit / DocsPageViewer
|
||||
|
||||
|
||||
func _on_DocsPageViewer_open_non_html_link(link, section):
|
||||
DocTree.select_item(link)
|
||||
DocPageViewer.scroll_to_section(section)
|
||||
|
||||
func _on_DocumentationTree_page_selected(path):
|
||||
DocPageViewer.load_page(path)
|
||||
|
||||
func _on_FilterEntry_text_changed(new_text):
|
||||
var child = DocTree.documentation_tree.get_children()
|
||||
while child:
|
||||
child.call_recursive("call_deferred", "free")
|
||||
child = child.get_next()
|
||||
|
||||
DocTree.call_deferred("update")
|
49
addons/dialogic/Documentation/Nodes/DocumentationViewer.tscn
Normal file
|
@ -0,0 +1,49 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Nodes/DocsPageViewer.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Nodes/DocumentationTree.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Nodes/DocumentationViewer.gd" type="Script" id=3]
|
||||
|
||||
[node name="DocumentationViewer" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSplit" type="HSplitContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HSplit"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FilterEntry" type="LineEdit" parent="HSplit/VBoxContainer"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 24.0
|
||||
placeholder_text = "Filter Documentation"
|
||||
placeholder_alpha = 0.502
|
||||
|
||||
[node name="DocumentationTree" parent="HSplit/VBoxContainer" instance=ExtResource( 2 )]
|
||||
margin_top = 28.0
|
||||
margin_right = 230.0
|
||||
|
||||
[node name="DocsPageViewer" parent="HSplit" instance=ExtResource( 1 )]
|
||||
margin_left = 242.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[connection signal="text_changed" from="HSplit/VBoxContainer/FilterEntry" to="." method="_on_FilterEntry_text_changed"]
|
||||
[connection signal="open_non_html_link" from="HSplit/DocsPageViewer" to="." method="_on_DocsPageViewer_open_non_html_link"]
|
7
addons/dialogic/Documentation/Theme/DocumentationH1.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 30
|
||||
font_data = ExtResource( 1 )
|
7
addons/dialogic/Documentation/Theme/DocumentationH2.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 24
|
||||
font_data = ExtResource( 1 )
|
7
addons/dialogic/Documentation/Theme/DocumentationH3.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 20
|
||||
font_data = ExtResource( 1 )
|
7
addons/dialogic/Documentation/Theme/DocumentationH4.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-BoldItalic.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 20
|
||||
font_data = ExtResource( 1 )
|
7
addons/dialogic/Documentation/Theme/DocumentationH5.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Documentation/Theme/Font/NotoSans-Italic.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 18
|
||||
font_data = ExtResource( 1 )
|
202
addons/dialogic/Documentation/Theme/Font/LICENSE.txt
Normal file
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|