mirror of
https://github.com/celisej567/wiki.git
synced 2026-09-15 20:09:39 +03:00
Beginnings
This commit is contained in:
10
__main__.py
10
__main__.py
@@ -2,11 +2,14 @@ import markdown2
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
mark = markdown2.Markdown()
|
||||
|
||||
src = os.path.dirname(os.path.realpath(__file__))+"/src/"
|
||||
dst = os.path.dirname(os.path.realpath(__file__))+"/dst/"
|
||||
shutil.rmtree(dst)
|
||||
os.mkdir(dst)
|
||||
with open("template.html","r") as f:
|
||||
template = f.read()
|
||||
|
||||
@@ -33,5 +36,10 @@ for root, subdirs, files in os.walk(src):
|
||||
converted = mark.convert(f.read())
|
||||
links = re.findall(r'\[\[.+\]\]', converted)
|
||||
for link in links:
|
||||
converted = converted.replace(link, "<a href=\""+link[2:-2]+".html\">"+link[2:-2].split("/")[-1]+"</a>")
|
||||
converted = converted.replace(link, "<a href=\"/wiki/"+link[2:-2]+".html\">"+link[2:-2].split("/")[-1]+"</a>")
|
||||
links = re.findall(r'\[.+\]\[.+\]',converted)
|
||||
for link in links:
|
||||
name = link[1:].split("]",1)[0]
|
||||
href = link[1:].split("[",1)[1].split("]",1)[0]
|
||||
converted = converted.replace(link, "<a href=\"/wiki/"+href+".html\">"+name+"</a>")
|
||||
r.write(template.replace("@CONTENT",converted))
|
||||
41
dst/QScript/Introduction.html
Normal file
41
dst/QScript/Introduction.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<script>
|
||||
const documentlist = ['/wiki/index.html', '/wiki/QScript/Introduction.html', '/wiki/QScript/Tutorial/Chapter1.html']
|
||||
const namelist = ['Wiki Intro', 'QScript Intro', 'QScript Tutorial Chapter 1']
|
||||
|
||||
function updateSearch() {
|
||||
searchtext = document.getElementById("searchbox").value.toLowerCase();
|
||||
var res = [];
|
||||
var searchresults = document.getElementById("searchresults")
|
||||
searchresults.innerHTML = ""
|
||||
if(searchtext === "")
|
||||
return;
|
||||
for (var i = 0; i < namelist.length; i++)
|
||||
{
|
||||
if(!namelist[i].toLowerCase().includes(searchtext)) continue;
|
||||
var searchelement = document.createElement("li");
|
||||
var link = document.createElement("a");
|
||||
searchelement.appendChild(link);
|
||||
link.setAttribute("href", documentlist[i]);
|
||||
link.innerHTML = namelist[i];
|
||||
searchresults.appendChild(searchelement);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
<div style="position:fixed; display:block; top: 0px; left: 0px; height:100%; width:200px;border-color: black; border-width: 1px; border-style:solid;">
|
||||
<input type="text" placeholder="search..." autocomplete="off" id="searchbox" oninput="updateSearch();" style="width:192px;">
|
||||
<nav>
|
||||
<ul id="searchresults">
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div style="margin-left:200px;">
|
||||
<h1>QScript Intro</h1>
|
||||
|
||||
<p>QScript is a multi-language scripting system designed with security and stability in mind.
|
||||
If it is your first rodeo programming QScript mods, go <a href="/wiki/QScript/Tutorial/Chapter1.html">here</a></p>
|
||||
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<script>
|
||||
const documentlist = ['/wiki/index.html', '/wiki/folder/other.html']
|
||||
const namelist = ['test', 'Other']
|
||||
const documentlist = ['/wiki/index.html', '/wiki/QScript/Introduction.html', '/wiki/QScript/Tutorial/Chapter1.html']
|
||||
const namelist = ['Wiki Intro', 'QScript Intro', 'QScript Tutorial Chapter 1']
|
||||
|
||||
function updateSearch() {
|
||||
searchtext = document.getElementById("searchbox").value.toLowerCase();
|
||||
@@ -33,8 +33,6 @@
|
||||
</nav>
|
||||
</div>
|
||||
<div style="margin-left:200px;">
|
||||
<h1>Other</h1>
|
||||
|
||||
<h2>hi</h2>
|
||||
<h1>QScript Tutorial Chapter 1</h1>
|
||||
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<script>
|
||||
const documentlist = ['/wiki/index.html', '/wiki/folder/other.html']
|
||||
const namelist = ['test', 'Other']
|
||||
const documentlist = ['/wiki/index.html', '/wiki/QScript/Introduction.html', '/wiki/QScript/Tutorial/Chapter1.html']
|
||||
const namelist = ['Wiki Intro', 'QScript Intro', 'QScript Tutorial Chapter 1']
|
||||
|
||||
function updateSearch() {
|
||||
searchtext = document.getElementById("searchbox").value.toLowerCase();
|
||||
@@ -33,8 +33,11 @@
|
||||
</nav>
|
||||
</div>
|
||||
<div style="margin-left:200px;">
|
||||
<h1>test</h1>
|
||||
<h1>Wiki Intro</h1>
|
||||
|
||||
<p>this is the <a href="folder/other.html">other</a> link</p>
|
||||
<p>Welcome to the SourceBox wiki!</p>
|
||||
|
||||
<p>Important links:
|
||||
<a href="/wiki/QScript/Introduction.html">QScript</a></p>
|
||||
|
||||
</div>
|
||||
4
src/QScript/Introduction.md
Normal file
4
src/QScript/Introduction.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# QScript Intro
|
||||
|
||||
QScript is a multi-language scripting system designed with security and stability in mind.
|
||||
If it is your first rodeo programming QScript mods, go [here][QScript/Tutorial/Chapter1]
|
||||
2
src/QScript/Tutorial/Chapter1.md
Normal file
2
src/QScript/Tutorial/Chapter1.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# QScript Tutorial Chapter 1
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Other
|
||||
|
||||
## hi
|
||||
@@ -1,3 +1,6 @@
|
||||
# test
|
||||
# Wiki Intro
|
||||
|
||||
this is the [[folder/other]] link
|
||||
Welcome to the SourceBox wiki!
|
||||
|
||||
Important links:
|
||||
[QScript][QScript/Introduction]
|
||||
Reference in New Issue
Block a user