From 56d067de2206c8d24dc87d4c043356e4edb2ce7a Mon Sep 17 00:00:00 2001 From: relt-1 Date: Sun, 24 Sep 2023 11:48:48 +0200 Subject: [PATCH] More documentation --- __main__.py | 13 +- dst/QScript/Introduction.html | 9 +- dst/QScript/Lua/Classes.html | 12 +- dst/QScript/Lua/Exports.html | 9 +- dst/QScript/Lua/Imports.html | 12 +- dst/QScript/Lua/Intro.html | 9 +- dst/QScript/Lua/Objects.html | 9 +- dst/QScript/Squirrel/Exports_And_Imports.html | 184 ++++++++++++++++++ dst/QScript/Squirrel/Intro.html | 156 +++++++++++++++ dst/QScript/Tutorial/Chapter1.html | 29 ++- dst/QScript/Tutorial/Chapter2.html | 161 +++++++++++++++ dst/index.html | 9 +- src/QScript/Lua/Classes.md | 1 + src/QScript/Lua/Imports.md | 3 +- src/QScript/Squirrel/Exports_And_Imports.md | 32 +++ src/QScript/Squirrel/Intro.md | 9 + src/QScript/Tutorial/Chapter1.md | 22 ++- src/QScript/Tutorial/Chapter2.md | 12 ++ 18 files changed, 650 insertions(+), 41 deletions(-) create mode 100644 dst/QScript/Squirrel/Exports_And_Imports.html create mode 100644 dst/QScript/Squirrel/Intro.html create mode 100644 dst/QScript/Tutorial/Chapter2.html create mode 100644 src/QScript/Squirrel/Exports_And_Imports.md create mode 100644 src/QScript/Squirrel/Intro.md create mode 100644 src/QScript/Tutorial/Chapter2.md 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 @@ SourceBox Wiki + +
+ + +
+
+

+

Squirrel Exports and Imports

+ +

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
+
+ +
+ +

<- Prev | +Go back to the QScript Tutorial

+ +
\ No newline at end of file diff --git a/dst/QScript/Squirrel/Intro.html b/dst/QScript/Squirrel/Intro.html new file mode 100644 index 0000000..bcba2ab --- /dev/null +++ b/dst/QScript/Squirrel/Intro.html @@ -0,0 +1,156 @@ + +SourceBox Wiki + + +
+ + +
+
+

+

Squirrel Intro

+ +

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.

+ +
+ +

Next ->

+ +
\ No newline at end of file diff --git a/dst/QScript/Tutorial/Chapter1.html b/dst/QScript/Tutorial/Chapter1.html index a8cff6d..d762916 100644 --- a/dst/QScript/Tutorial/Chapter1.html +++ b/dst/QScript/Tutorial/Chapter1.html @@ -1,8 +1,8 @@ SourceBox Wiki + +
+ + +
+
+

+

QScript Tutorial Page 2: Getting to work

+ +

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:

+ + + +
+ +

<- Prev

+ +
\ No newline at end of file diff --git a/dst/index.html b/dst/index.html index 74ed953..c13b78e 100644 --- a/dst/index.html +++ b/dst/index.html @@ -1,8 +1,8 @@ SourceBox Wiki