diff --git a/__main__.py b/__main__.py index e8fd198..811a4ed 100644 --- a/__main__.py +++ b/__main__.py @@ -66,13 +66,16 @@ for root, subdirs, files in os.walk(src): smallstring = small.strip() whitespace = small[len(smallstring):] rawmarkdown = rawmarkdown.replace(small, ""+smallstring+"\n"+whitespace) - converted = mark.convert(rawmarkdown) - links = re.findall(r'\[\[.+\]\]', converted) + links = re.findall(r'\[\[.+\]\]', rawmarkdown) for link in links: - converted = converted.replace(link, ""+link[2:-2].split("/")[-1]+"") - links = re.findall(r'\[.+\]\[.+\]',converted) + rawmarkdown = rawmarkdown.replace(link, ""+link[2:-2].split("/")[-1]+"") + links = re.findall(r'\[.+\]\[.+\]',rawmarkdown) for link in links: name = link[1:].split("]",1)[0] href = link[1:].split("[",1)[1].split("]",1)[0] - converted = converted.replace(link, ""+name+"") + if(href.startswith("http://") or href.startswith("https://")): + rawmarkdown = rawmarkdown.replace(link, ""+name+"") + else: + rawmarkdown = rawmarkdown.replace(link, ""+name+"") + converted = mark.convert(rawmarkdown) r.write(template.replace("@CONTENT",converted).replace("@FILETREE",filetree)) \ No newline at end of file diff --git a/dst/QScript/Introduction.html b/dst/QScript/Introduction.html index 35debe6..6fd2ce6 100644 --- a/dst/QScript/Introduction.html +++ b/dst/QScript/Introduction.html @@ -1,8 +1,8 @@
The main big feature of QScript is the export system. It lets you export classes, objects and functions which other files can import from your script.
+ +Let's say that you have a library called "MyLib.nut" inside a mod called "MyMod". This is what it contains:
+ +MyMod/MyLib.nut
+ +class AdditionClass
+{
+ function Add(a,b)
+ {
+ return a + b;
+ }
+}
+
+Addition <- AdditionClass() -- Exports can only use global variables!
+
+
+Now to export the Addition object, pass them to the export() function at the end of the file.
MyMod/MyLib.nut
+ +export(Addition);
+
+
+To import the exported elements in another file, simply use the import() function with the file path of the script you want to import from.
MyLib <- import("MyMod/MyLib.nut");
+
+MyLib.Addition.Add(2,5); -- will return 7
+
+
+The following pages will assume that you know the basics of Squirrel. If you need a refresher, go to the official documentation linked here
+ +If you know what you need, continue to the next page.
+ +In your freshly created folder, make a new file called autorun_client with the extension of your favorite programming language that QScript supports.
Currently, QScript is in the "DO NOT USE" stage, which means that the only implemented bindings are:
+ +sourcebox_client.Msg() takes a string and prints it to the console.sourcebox_client.RegisterCmd() takes a string and a function (in said order) and registers that as a console command.