Initial commit
This commit is contained in:
commit
f20c84a1c3
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# ---> VisualStudioCode
|
||||
.settings
|
||||
|
||||
|
||||
# ---> Go
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
.vscode/*
|
||||
.history
|
||||
Fotos/*
|
||||
|
||||
debug
|
||||
|
||||
/backup/
|
||||
/data/
|
||||
/build/*.arm
|
||||
/build/*.bin
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# GoWiki
|
||||
|
||||
Ein kleines, in Go gebasteltes Wiki.
|
||||
Jede Seite kann über den `Edit` Button oben rechts in der Ecke bearbeitet werden.
|
||||
Der Obere Teil der Sidebar kommt aus der Datei `sidebar.md` (kann auch über den Link: [/sidebar](/sidebar) aufgerufen werden).
|
||||
Der untere Teil der Sidebar wird dynmaisch zur Laufzeit generiert und spiegelt den Inhalt des `data`-Ordners wieder.
|
||||
|
||||
Eine Hilfe der Markdown-Syntax kann man unter [/hilfe](/hilfe) einsehen.
|
||||
Unter [/playground](/playground) gibt es eine Test-Seite zum Testen.
|
||||
|
||||
Standardmäßig wird das Wiki unter der `http://127.0.0.1` und dem Port `8000` gesartet und verwendet die `*.md` Files, welche sich im Unterverzeichnis `./data` befinden.
|
||||
Diese Einstellungen können durch eine `config.json` im Start-Verzeichnis geändert werden:
|
||||
|
||||
Eine `config.json` könnte z.B. wie folgt aussehen:
|
||||
```
|
||||
{
|
||||
"Host":"http://127.0.0.1",
|
||||
"Port":"8000",
|
||||
"DataPath":"./data"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Zum Kompilieren folgende Go-Abhängigkeiten installieren:
|
||||
- `go get github.com/gorilla/mux`
|
||||
|
||||
Die Buildscripte liegen im Unterordner `build`
|
447
bindata.go
Normal file
447
bindata.go
Normal file
@ -0,0 +1,447 @@
|
||||
// Code generated by go-bindata. DO NOT EDIT.
|
||||
// sources:
|
||||
// web\index.html
|
||||
// web\misc\bootstrap.min.css
|
||||
// web\misc\bootstrap.min.js
|
||||
// web\misc\codemirror.css
|
||||
// web\misc\codemirror.js
|
||||
// web\misc\jquery.min.js
|
||||
// web\misc\markdown.js
|
||||
// web\misc\showdown.min.js
|
||||
// web\pages\hilfe.md
|
||||
// web\pages\playground.md
|
||||
// web\pages\sidebar.md
|
||||
// web\pages\start.md
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// bindataRead reads the given file from disk. It returns an error on failure.
|
||||
func bindataRead(path, name string) ([]byte, error) {
|
||||
buf, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset %s at %s: %v", name, path, err)
|
||||
}
|
||||
return buf, err
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
// bindataWebindexhtml reads file data from disk. It returns an error on failure.
|
||||
func bindataWebindexhtml() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\index.html"
|
||||
name := "web/index.html"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmiscbootstrapmincss reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmiscbootstrapmincss() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\bootstrap.min.css"
|
||||
name := "web/misc/bootstrap.min.css"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmiscbootstrapminjs reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmiscbootstrapminjs() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\bootstrap.min.js"
|
||||
name := "web/misc/bootstrap.min.js"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmisccodemirrorcss reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmisccodemirrorcss() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\codemirror.css"
|
||||
name := "web/misc/codemirror.css"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmisccodemirrorjs reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmisccodemirrorjs() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\codemirror.js"
|
||||
name := "web/misc/codemirror.js"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmiscjqueryminjs reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmiscjqueryminjs() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\jquery.min.js"
|
||||
name := "web/misc/jquery.min.js"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmiscmarkdownjs reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmiscmarkdownjs() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\markdown.js"
|
||||
name := "web/misc/markdown.js"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebmiscshowdownminjs reads file data from disk. It returns an error on failure.
|
||||
func bindataWebmiscshowdownminjs() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\misc\\showdown.min.js"
|
||||
name := "web/misc/showdown.min.js"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebpageshilfemd reads file data from disk. It returns an error on failure.
|
||||
func bindataWebpageshilfemd() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\pages\\hilfe.md"
|
||||
name := "web/pages/hilfe.md"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebpagesplaygroundmd reads file data from disk. It returns an error on failure.
|
||||
func bindataWebpagesplaygroundmd() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\pages\\playground.md"
|
||||
name := "web/pages/playground.md"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebpagessidebarmd reads file data from disk. It returns an error on failure.
|
||||
func bindataWebpagessidebarmd() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\pages\\sidebar.md"
|
||||
name := "web/pages/sidebar.md"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// bindataWebpagesstartmd reads file data from disk. It returns an error on failure.
|
||||
func bindataWebpagesstartmd() (*asset, error) {
|
||||
path := "P:\\Go\\gowiki\\web\\pages\\start.md"
|
||||
name := "web/pages/start.md"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
//
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
|
||||
}
|
||||
|
||||
//
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
// nolint: deadcode
|
||||
//
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
//
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or could not be loaded.
|
||||
//
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
|
||||
}
|
||||
|
||||
//
|
||||
// AssetNames returns the names of the assets.
|
||||
// nolint: deadcode
|
||||
//
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
//
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
//
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"web/index.html": bindataWebindexhtml,
|
||||
"web/misc/bootstrap.min.css": bindataWebmiscbootstrapmincss,
|
||||
"web/misc/bootstrap.min.js": bindataWebmiscbootstrapminjs,
|
||||
"web/misc/codemirror.css": bindataWebmisccodemirrorcss,
|
||||
"web/misc/codemirror.js": bindataWebmisccodemirrorjs,
|
||||
"web/misc/jquery.min.js": bindataWebmiscjqueryminjs,
|
||||
"web/misc/markdown.js": bindataWebmiscmarkdownjs,
|
||||
"web/misc/showdown.min.js": bindataWebmiscshowdownminjs,
|
||||
"web/pages/hilfe.md": bindataWebpageshilfemd,
|
||||
"web/pages/playground.md": bindataWebpagesplaygroundmd,
|
||||
"web/pages/sidebar.md": bindataWebpagessidebarmd,
|
||||
"web/pages/start.md": bindataWebpagesstartmd,
|
||||
}
|
||||
|
||||
//
|
||||
// AssetDir returns the file names below a certain
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
//
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, &os.PathError{
|
||||
Op: "open",
|
||||
Path: name,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, &os.PathError{
|
||||
Op: "open",
|
||||
Path: name,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
rv = append(rv, childName)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
var _bintree = &bintree{Func: nil, Children: map[string]*bintree{
|
||||
"web": {Func: nil, Children: map[string]*bintree{
|
||||
"index.html": {Func: bindataWebindexhtml, Children: map[string]*bintree{}},
|
||||
"misc": {Func: nil, Children: map[string]*bintree{
|
||||
"bootstrap.min.css": {Func: bindataWebmiscbootstrapmincss, Children: map[string]*bintree{}},
|
||||
"bootstrap.min.js": {Func: bindataWebmiscbootstrapminjs, Children: map[string]*bintree{}},
|
||||
"codemirror.css": {Func: bindataWebmisccodemirrorcss, Children: map[string]*bintree{}},
|
||||
"codemirror.js": {Func: bindataWebmisccodemirrorjs, Children: map[string]*bintree{}},
|
||||
"jquery.min.js": {Func: bindataWebmiscjqueryminjs, Children: map[string]*bintree{}},
|
||||
"markdown.js": {Func: bindataWebmiscmarkdownjs, Children: map[string]*bintree{}},
|
||||
"showdown.min.js": {Func: bindataWebmiscshowdownminjs, Children: map[string]*bintree{}},
|
||||
}},
|
||||
"pages": {Func: nil, Children: map[string]*bintree{
|
||||
"hilfe.md": {Func: bindataWebpageshilfemd, Children: map[string]*bintree{}},
|
||||
"playground.md": {Func: bindataWebpagesplaygroundmd, Children: map[string]*bintree{}},
|
||||
"sidebar.md": {Func: bindataWebpagessidebarmd, Children: map[string]*bintree{}},
|
||||
"start.md": {Func: bindataWebpagesstartmd, Children: map[string]*bintree{}},
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
4
build/BUILD.bat
Normal file
4
build/BUILD.bat
Normal file
@ -0,0 +1,4 @@
|
||||
cd /d %~dp0
|
||||
cd ..
|
||||
go build -o gowiki.exe
|
||||
pause
|
29
build/BUILDAll.ps1
Normal file
29
build/BUILDAll.ps1
Normal file
@ -0,0 +1,29 @@
|
||||
cd ..
|
||||
echo "========================"
|
||||
echo " GOWiki BuildScript"
|
||||
echo "========================"
|
||||
|
||||
echo "Create Static Ressources (Release)"
|
||||
go-bindata -verbose -o bindata.go ./web/...
|
||||
|
||||
echo "Build Windows/amd64..."
|
||||
$env:GOOS="windows"; $env:GOARCH="amd64"; go build -ldflags="-s -w -X main.version=0.0.1" -o ./build/gowiki_amd64.exe
|
||||
echo "Build Windows/x86..."
|
||||
$env:GOOS="windows"; $env:GOARCH="386"; go build -ldflags="-s -w -X main.version=0.0.1" -o ./build/gowiki_x86.exe
|
||||
echo "Build Linux/amd64..."
|
||||
$env:GOOS="linux"; $env:GOARCH="amd64"; go build -ldflags="-s -w -X main.version=0.0.1" -o ./build/gowiki_amd64.bin
|
||||
echo "Build Linux/x86..."
|
||||
$env:GOOS="linux"; $env:GOARCH="386"; go build -ldflags="-s -w -X main.version=0.0.1" -o ./build/gowiki_x86.bin
|
||||
echo "Build Linux/arm..."
|
||||
$env:GOOS="linux"; $env:GOARCH="arm"; go build -ldflags="-s -w -X main.version=0.0.1" -o ./build/gowiki.arm
|
||||
|
||||
echo "UPX - Compress Static Binaries"
|
||||
..\upx-3.95-win64\upx.exe -9 ./build/gowiki_amd64.exe
|
||||
..\upx-3.95-win64\upx.exe -9 ./build/gowiki_x86.exe
|
||||
..\upx-3.95-win64\upx.exe -9 ./build/gowiki_amd64.bin
|
||||
..\upx-3.95-win64\upx.exe -9 ./build/gowiki_x86.bin
|
||||
..\upx-3.95-win64\upx.exe -9 ./build/gowiki.arm
|
||||
|
||||
echo "Create Static Ressources (Debug)"
|
||||
go-bindata -verbose -debug -o bindata.go ./web/...
|
||||
pause
|
4
build/BUILD_ASSETS-DEBUG.bat
Normal file
4
build/BUILD_ASSETS-DEBUG.bat
Normal file
@ -0,0 +1,4 @@
|
||||
cd /d %~dp0
|
||||
cd ..
|
||||
go-bindata -debug -verbose -o bindata.go ./web/...
|
||||
pause
|
4
build/BUILD_ASSETS-RELEASE.bat
Normal file
4
build/BUILD_ASSETS-RELEASE.bat
Normal file
@ -0,0 +1,4 @@
|
||||
cd /d %~dp0
|
||||
cd ..
|
||||
go-bindata -verbose -o bindata.go ./web/...
|
||||
pause
|
5
config.json
Normal file
5
config.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"Host":"http://127.0.0.1",
|
||||
"Port":"8000",
|
||||
"DataPath":"./data"
|
||||
}
|
217
main.go
Normal file
217
main.go
Normal file
@ -0,0 +1,217 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
var config = readConfig("")
|
||||
|
||||
type Configuration struct {
|
||||
Host string
|
||||
Port string
|
||||
DataPath string
|
||||
}
|
||||
|
||||
// our main function
|
||||
func main() {
|
||||
|
||||
// Ausgeben der Config-Optionen
|
||||
fmt.Println("Host: " + config.Host)
|
||||
fmt.Println("Post: " + config.Port)
|
||||
fmt.Println("DataPath: " + config.DataPath)
|
||||
|
||||
// DataPath-Verzeichnis anlegen, wenn es noch nicht existiert
|
||||
if !directoryExists(config.DataPath) {
|
||||
os.MkdirAll(config.DataPath, os.ModePerm)
|
||||
|
||||
// Default Seiten anlegen
|
||||
bStartmd, _ := Asset("web/pages/start.md")
|
||||
bHilfemd, _ := Asset("web/pages/hilfe.md")
|
||||
bPlaygroundmd, _ := Asset("web/pages/playground.md")
|
||||
bSidebarmd, _ := Asset("web/pages/sidebar.md")
|
||||
|
||||
err := ioutil.WriteFile(path.Join(config.DataPath, "start.md"), bStartmd, 0644)
|
||||
check(err)
|
||||
err = ioutil.WriteFile(path.Join(config.DataPath, "sidebar.md"), bSidebarmd, 0644)
|
||||
check(err)
|
||||
err = ioutil.WriteFile(path.Join(config.DataPath, "hilfe.md"), bHilfemd, 0644)
|
||||
check(err)
|
||||
err = ioutil.WriteFile(path.Join(config.DataPath, "playground.md"), bPlaygroundmd, 0644)
|
||||
check(err)
|
||||
}
|
||||
|
||||
router := mux.NewRouter()
|
||||
router.HandleFunc("/p/{pagename:.*}", getRawPage).Methods("GET")
|
||||
router.HandleFunc("/{pagename:.*}", getHTMLPage).Methods("GET")
|
||||
router.HandleFunc("/{pagename:.*}", postHTMLPage).Methods("POST")
|
||||
|
||||
log.Fatal(http.ListenAndServe(":"+config.Port, router))
|
||||
|
||||
}
|
||||
|
||||
func getHTMLPage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
params := mux.Vars(r)
|
||||
|
||||
if strings.HasSuffix(params["pagename"], ".css") {
|
||||
//fmt.Println("CSS: " + params["pagename"])
|
||||
b, _ := Asset("web/" + params["pagename"])
|
||||
w.Header().Set("Content-Type", "text/css")
|
||||
w.Write(b)
|
||||
} else if strings.HasSuffix(params["pagename"], ".js") {
|
||||
//fmt.Println("JS: " + params["pagename"])
|
||||
b, _ := Asset("web/" + params["pagename"])
|
||||
w.Header().Set("Content-Type", "application/javascript")
|
||||
w.Write(b)
|
||||
} else {
|
||||
// Directory Listing für die Sidebar
|
||||
sidebarAusgabe := " \r\n \r\n**Inhaltsverzeichnis** \r\n\r\n"
|
||||
filepath.Walk(config.DataPath, func(path string, info os.FileInfo, err error) error {
|
||||
|
||||
tmpPath := strings.Replace(path, "\\", "/", -1)
|
||||
tmpPath = strings.Replace(tmpPath, "data", "", -1)
|
||||
tmpPathSplit := strings.Split(tmpPath, "/")
|
||||
|
||||
sidebarTABs := ""
|
||||
for i, _ := range tmpPathSplit {
|
||||
//fmt.Println(i, " => ", string(c))
|
||||
if i > 1 {
|
||||
sidebarTABs = sidebarTABs + " "
|
||||
}
|
||||
}
|
||||
|
||||
if info.Name() != "data" && info.Name() != "start.md" && info.Name() != "sidebar.md" && info.Name() != "hilfe.md" {
|
||||
if !strings.HasSuffix(info.Name(), ".md") {
|
||||
sidebarAusgabe = sidebarAusgabe + sidebarTABs + "* [" + strings.TrimSuffix(info.Name(), ".md") + "](" + strings.TrimSuffix(tmpPath, ".md") + "/start) \r\n"
|
||||
} else {
|
||||
sidebarAusgabe = sidebarAusgabe + sidebarTABs + "* [" + strings.TrimSuffix(info.Name(), ".md") + "](" + strings.TrimSuffix(tmpPath, ".md") + ") \r\n"
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
//tmpl := template.Must(template.ParseFiles("./web/index.html"))
|
||||
bTmpl, _ := Asset("web/index.html")
|
||||
tmpl := template.Must(template.New("tml").Parse(string(bTmpl)))
|
||||
data := MarkDownData{
|
||||
PageTitle: " ",
|
||||
MDText: "",
|
||||
SideBar: sidebarAusgabe,
|
||||
}
|
||||
tmpl.Execute(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
func getRawPage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
params := mux.Vars(r)
|
||||
pPageName := params["pagename"] + ".md"
|
||||
// Hack für anzeige der start.md wenn / aufgerufen wird
|
||||
if pPageName == ".md" {
|
||||
pPageName = "start.md"
|
||||
}
|
||||
pageContent := "Empty"
|
||||
|
||||
//fmt.Println(path.Join(config.DataPath, pPageName))
|
||||
b, err := ioutil.ReadFile(path.Join(config.DataPath, pPageName))
|
||||
check(err)
|
||||
|
||||
pageContent = string(b)
|
||||
|
||||
json.NewEncoder(w).Encode(pageContent)
|
||||
}
|
||||
|
||||
func postHTMLPage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
params := mux.Vars(r)
|
||||
pPageName := params["pagename"] + ".md"
|
||||
|
||||
// Verzeichnis erstellen
|
||||
dir := path.Dir(pPageName)
|
||||
if !directoryExists(path.Join(config.DataPath, dir)) {
|
||||
os.MkdirAll(path.Join(config.DataPath, dir), os.ModePerm)
|
||||
}
|
||||
|
||||
//{ "MDText":"**test3**" }
|
||||
var oBody TPostBody
|
||||
json.NewDecoder(r.Body).Decode(&oBody)
|
||||
//fmt.Println(oBody)
|
||||
|
||||
f, err := os.Create(path.Join(config.DataPath, pPageName))
|
||||
check(err)
|
||||
defer f.Close()
|
||||
fw := bufio.NewWriter(f)
|
||||
_, err = fw.WriteString(oBody.MDText)
|
||||
check(err)
|
||||
fw.Flush()
|
||||
|
||||
json.NewEncoder(w).Encode("OK")
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Typen
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
type MarkDownData struct {
|
||||
PageTitle string
|
||||
MDText string
|
||||
SideBar string
|
||||
}
|
||||
|
||||
type TPostBody struct {
|
||||
MDText string
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Hilfsfunktionen
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
func check(e error) {
|
||||
if e != nil {
|
||||
fmt.Println(e)
|
||||
}
|
||||
}
|
||||
|
||||
func fileExists(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return !info.IsDir()
|
||||
}
|
||||
|
||||
func directoryExists(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
func readConfig(filename string) *Configuration {
|
||||
// initialize conf with default values.
|
||||
conf := &Configuration{Host: "http://127.0.0.1", Port: "8000", DataPath: "./data"}
|
||||
|
||||
b, err := ioutil.ReadFile("./config.json")
|
||||
if err != nil {
|
||||
return conf
|
||||
}
|
||||
if err = json.Unmarshal(b, conf); err != nil {
|
||||
return conf
|
||||
}
|
||||
return conf
|
||||
}
|
304
web/index.html
Normal file
304
web/index.html
Normal file
@ -0,0 +1,304 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel=stylesheet href="/misc/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/misc/codemirror.css">
|
||||
<style>
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
body {
|
||||
margin-top: 60px;
|
||||
}
|
||||
/*
|
||||
* Global add-ons
|
||||
*/
|
||||
|
||||
.sub-header {
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/*
|
||||
* Top navigation
|
||||
* Hide default border to remove 1px line.
|
||||
*/
|
||||
.navbar-fixed-top {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sidebar
|
||||
*/
|
||||
|
||||
/* Hide for mobile, show later */
|
||||
.sidebar {
|
||||
display: none;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 51px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: block;
|
||||
padding: 20px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
|
||||
background-color: #f5f5f5;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
/* Sidebar navigation */
|
||||
.nav-sidebar {
|
||||
margin-right: -21px; /* 20px padding + 1px border */
|
||||
margin-bottom: 20px;
|
||||
margin-left: -20px;
|
||||
}
|
||||
.nav-sidebar > li > a {
|
||||
padding-right: 20px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.nav-sidebar > .active > a,
|
||||
.nav-sidebar > .active > a:hover,
|
||||
.nav-sidebar > .active > a:focus {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
}
|
||||
|
||||
/* Main Content */
|
||||
.main {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
.sidebar ul, li {
|
||||
margin-left: 2px;
|
||||
padding-left: 1px;
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Fixed navbar -->
|
||||
<nav class="navbar navbar-fixed-top navbar-default">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/start">GoWiki</a>
|
||||
<div id="breadcrumb" class="navbar-brand"></div>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li id="btnEditpage"><a href="#" onclick="EditPage()">Edit</a></li>
|
||||
<li id="btnPreviewpage"><a href="#" onclick="PreviewPage()">Preview</a></li>
|
||||
<li id="btnSavepage"><a href="#" onclick="SavePage()">Save</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 col-md-1 sidebar">
|
||||
<div id="outputsidebar" style="display: none;">{{.SideBar}}</div>
|
||||
</div>
|
||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-1 main">
|
||||
<div id="markdowndiv" style="display: none;">{{.MDText}}</div>
|
||||
<div id="outputdiv" style="display: none;">{{.MDText}}</div>
|
||||
<div id="editdiv" style="display: none;">
|
||||
<form><textarea id="code" name="code"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script language=javascript src="/misc/jquery.min.js"></script>
|
||||
<script language=javascript src="/misc/bootstrap.min.js"></script>
|
||||
<script language=javascript src="/misc/showdown.min.js"></script>
|
||||
<script language=javascript src="/misc/codemirror.js"></script>
|
||||
<script language=javascript src="/misc/markdown.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var html = "EMPTY";
|
||||
var MD2HTMLConverter = new showdown.Converter({
|
||||
tables: true,
|
||||
strikethrough: true,
|
||||
simplifiedAutoLink: true,
|
||||
excludeTrailingPunctuationFromURLs: true,
|
||||
tasklists: true,
|
||||
emoji: true
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$(btnEditpage).show();
|
||||
$(btnSavepage).hide();
|
||||
$(btnPreviewpage).hide();
|
||||
|
||||
|
||||
//html = converter.makeHtml($("#outputdiv").html());
|
||||
//$("#outputdiv").html(html);
|
||||
|
||||
var breadcrumbHTML = "";
|
||||
var sPageURL = window.location.pathname.split('/');
|
||||
|
||||
for (i = 1; i < sPageURL.length; i++) {
|
||||
if(i==sPageURL.length-1) {
|
||||
breadcrumbHTML = breadcrumbHTML + '/'+sPageURL[i]+'';
|
||||
}
|
||||
else {
|
||||
breadcrumbHTML = breadcrumbHTML + '<a href="/'+sPageURL[i]+'/start">/'+sPageURL[i]+'</a> ';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#breadcrumb").html(breadcrumbHTML);
|
||||
|
||||
|
||||
window.myCodeMirror = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: 'markdown',
|
||||
lineNumbers: true,
|
||||
theme: "default",
|
||||
extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
|
||||
});
|
||||
window.myCodeMirror.setSize("auto", "auto");
|
||||
|
||||
$(window.myCodeMirror.getWrapperElement()).slideDown('normal', function(){
|
||||
window.myCodeMirror.refresh();
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
contentType:'application/json; charset=utf-8',
|
||||
url: '/p/'+window.location.pathname,
|
||||
dataType: "json",
|
||||
data: "",
|
||||
success: function(content){
|
||||
$("#outputdiv").html(MD2HTMLConverter.makeHtml(content));
|
||||
$("#outputdiv").show();
|
||||
|
||||
$('#outputdiv table').addClass('table table-sm table-bordered table-striped');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
contentType:'application/json; charset=utf-8',
|
||||
url: '/p/sidebar',
|
||||
dataType: "json",
|
||||
data: "",
|
||||
success: function(content){
|
||||
html = MD2HTMLConverter.makeHtml(content+$("#outputsidebar").html());
|
||||
$("#outputsidebar").html(html);
|
||||
$("#outputsidebar").show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function EditPage() {
|
||||
|
||||
$(btnEditpage).hide();
|
||||
$(btnSavepage).show();
|
||||
$(btnPreviewpage).show();
|
||||
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
contentType:'application/json; charset=utf-8',
|
||||
url: '/p/'+window.location.pathname,
|
||||
dataType: "json",
|
||||
data: "",
|
||||
success: function(content){
|
||||
|
||||
$("#outputdiv").hide();
|
||||
//$("#code").html(content);
|
||||
$("#editdiv").show();
|
||||
|
||||
window.myCodeMirror.setValue(content);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function PreviewPage() {
|
||||
var content = "###Vorschau\n ----- \n"+window.myCodeMirror.getValue()+"\n ----- \n";
|
||||
$("#outputdiv").html(MD2HTMLConverter.makeHtml(content));
|
||||
$("#outputdiv").show();
|
||||
}
|
||||
|
||||
function SavePage() {
|
||||
var obj = {
|
||||
MDText : window.myCodeMirror.getValue()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
contentType:'application/json; charset=utf-8',
|
||||
url: window.location.pathname,
|
||||
dataType: "json",
|
||||
data: JSON.stringify(obj),
|
||||
success: function(data){
|
||||
$("#outputdiv").html(MD2HTMLConverter.makeHtml(obj.MDText));
|
||||
$("#outputdiv").show();
|
||||
$("#editdiv").hide();
|
||||
|
||||
$(btnEditpage).show();
|
||||
$(btnSavepage).hide();
|
||||
$(btnPreviewpage).hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
//--------------------------------------------------------------------------
|
||||
// Hilfsfunktionen
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function getUrlParameter(sParam) {
|
||||
var sPageURL = window.location.search.substring(1),
|
||||
sURLVariables = sPageURL.split('&'),
|
||||
sParameterName,
|
||||
i;
|
||||
|
||||
for (i = 0; i < sURLVariables.length; i++) {
|
||||
sParameterName = sURLVariables[i].split('=');
|
||||
|
||||
if (sParameterName[0] === sParam) {
|
||||
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body></html>
|
5
web/misc/bootstrap.min.css
vendored
Normal file
5
web/misc/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
web/misc/bootstrap.min.js
vendored
Normal file
7
web/misc/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
351
web/misc/codemirror.css
Normal file
351
web/misc/codemirror.css
Normal file
@ -0,0 +1,351 @@
|
||||
/* BASICS */
|
||||
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier;
|
||||
font-size: 0.9em;
|
||||
/*height: auto;*/
|
||||
/*width: auto;*/
|
||||
color: black;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 4px 0; /* Vertical padding around content */
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-line,
|
||||
.CodeMirror pre.CodeMirror-line-like {
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
/* GUTTER */
|
||||
|
||||
.CodeMirror-gutters {
|
||||
border-right: 1px solid #ddd;
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.CodeMirror-guttermarker { color: black; }
|
||||
.CodeMirror-guttermarker-subtle { color: #999; }
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
.CodeMirror-cursor {
|
||||
border-left: 1px solid black;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
/* Shown when moving in bi-directional text */
|
||||
.CodeMirror div.CodeMirror-secondarycursor {
|
||||
border-left: 1px solid silver;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0 !important;
|
||||
background: #7e7;
|
||||
}
|
||||
.cm-fat-cursor div.CodeMirror-cursors {
|
||||
z-index: 1;
|
||||
}
|
||||
.cm-fat-cursor-mark {
|
||||
background-color: rgba(20, 255, 20, 0.5);
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
}
|
||||
.cm-animate-fat-cursor {
|
||||
width: auto;
|
||||
border: 0;
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
background-color: #7e7;
|
||||
}
|
||||
@-moz-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@-webkit-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {}
|
||||
|
||||
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: -50px; bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0; bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
.cm-s-default .cm-def {color: #00f;}
|
||||
.cm-s-default .cm-variable,
|
||||
.cm-s-default .cm-punctuation,
|
||||
.cm-s-default .cm-property,
|
||||
.cm-s-default .cm-operator {}
|
||||
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
|
||||
.cm-s-default .cm-comment {color: #a50;}
|
||||
.cm-s-default .cm-string {color: #a11;}
|
||||
.cm-s-default .cm-string-2 {color: #f50;}
|
||||
.cm-s-default .cm-meta {color: #555;}
|
||||
.cm-s-default .cm-qualifier {color: #555;}
|
||||
.cm-s-default .cm-builtin {color: #30a;}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
.CodeMirror-composing { border-bottom: 2px solid; }
|
||||
|
||||
/* Default styles for common addons */
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
|
||||
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||
|
||||
/* STOP */
|
||||
|
||||
/* The rest of this file contains styles related to the mechanics of
|
||||
the editor. You probably shouldn't touch them. */
|
||||
|
||||
.CodeMirror {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
overflow: scroll !important; /* Things will break if this is overridden */
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -30px; margin-right: -30px;
|
||||
padding-bottom: 30px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
}
|
||||
.CodeMirror-sizer {
|
||||
position: relative;
|
||||
border-right: 30px solid transparent;
|
||||
}
|
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actual scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0; left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0; bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0; bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-bottom: -30px;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
.CodeMirror-gutter-background {
|
||||
position: absolute;
|
||||
top: 0; bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
min-height: 1px; /* prevents collapsing before first draw */
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-line,
|
||||
.CodeMirror pre.CodeMirror-line-like {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-variant-ligatures: contextual;
|
||||
font-variant-ligatures: contextual;
|
||||
}
|
||||
.CodeMirror-wrap pre.CodeMirror-line,
|
||||
.CodeMirror-wrap pre.CodeMirror-line-like {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-linewidget {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
||||
}
|
||||
|
||||
.CodeMirror-widget {}
|
||||
|
||||
.CodeMirror-rtl pre { direction: rtl; }
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Force content-box sizing for the elements where we expect it */
|
||||
.CodeMirror-scroll,
|
||||
.CodeMirror-sizer,
|
||||
.CodeMirror-gutter,
|
||||
.CodeMirror-gutters,
|
||||
.CodeMirror-linenumber {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.CodeMirror-measure {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
div.CodeMirror-dragcursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-focused div.CodeMirror-cursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||
.CodeMirror-crosshair { cursor: crosshair; }
|
||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
||||
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
||||
|
||||
.cm-searching {
|
||||
background-color: #ffa;
|
||||
background-color: rgba(255, 255, 0, .4);
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border { padding-right: .1px; }
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/* See issue #2901 */
|
||||
.cm-tab-wrap-hack:after { content: ''; }
|
||||
|
||||
/* Help users use markselection to safely style text background */
|
||||
span.CodeMirror-selectedtext { background: none; }
|
9783
web/misc/codemirror.js
Normal file
9783
web/misc/codemirror.js
Normal file
File diff suppressed because it is too large
Load Diff
6
web/misc/jquery.min.js
vendored
Normal file
6
web/misc/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
883
web/misc/markdown.js
Normal file
883
web/misc/markdown.js
Normal file
@ -0,0 +1,883 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
|
||||
var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
|
||||
var htmlModeMissing = htmlMode.name == "null"
|
||||
|
||||
function getMode(name) {
|
||||
if (CodeMirror.findModeByName) {
|
||||
var found = CodeMirror.findModeByName(name);
|
||||
if (found) name = found.mime || found.mimes[0];
|
||||
}
|
||||
var mode = CodeMirror.getMode(cmCfg, name);
|
||||
return mode.name == "null" ? null : mode;
|
||||
}
|
||||
|
||||
// Should characters that affect highlighting be highlighted separate?
|
||||
// Does not include characters that will be output (such as `1.` and `-` for lists)
|
||||
if (modeCfg.highlightFormatting === undefined)
|
||||
modeCfg.highlightFormatting = false;
|
||||
|
||||
// Maximum number of nested blockquotes. Set to 0 for infinite nesting.
|
||||
// Excess `>` will emit `error` token.
|
||||
if (modeCfg.maxBlockquoteDepth === undefined)
|
||||
modeCfg.maxBlockquoteDepth = 0;
|
||||
|
||||
// Turn on task lists? ("- [ ] " and "- [x] ")
|
||||
if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
|
||||
|
||||
// Turn on strikethrough syntax
|
||||
if (modeCfg.strikethrough === undefined)
|
||||
modeCfg.strikethrough = false;
|
||||
|
||||
if (modeCfg.emoji === undefined)
|
||||
modeCfg.emoji = false;
|
||||
|
||||
if (modeCfg.fencedCodeBlockHighlighting === undefined)
|
||||
modeCfg.fencedCodeBlockHighlighting = true;
|
||||
|
||||
if (modeCfg.xml === undefined)
|
||||
modeCfg.xml = true;
|
||||
|
||||
// Allow token types to be overridden by user-provided token types.
|
||||
if (modeCfg.tokenTypeOverrides === undefined)
|
||||
modeCfg.tokenTypeOverrides = {};
|
||||
|
||||
var tokenTypes = {
|
||||
header: "header",
|
||||
code: "comment",
|
||||
quote: "quote",
|
||||
list1: "variable-2",
|
||||
list2: "variable-3",
|
||||
list3: "keyword",
|
||||
hr: "hr",
|
||||
image: "image",
|
||||
imageAltText: "image-alt-text",
|
||||
imageMarker: "image-marker",
|
||||
formatting: "formatting",
|
||||
linkInline: "link",
|
||||
linkEmail: "link",
|
||||
linkText: "link",
|
||||
linkHref: "string",
|
||||
em: "em",
|
||||
strong: "strong",
|
||||
strikethrough: "strikethrough",
|
||||
emoji: "builtin"
|
||||
};
|
||||
|
||||
for (var tokenType in tokenTypes) {
|
||||
if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
|
||||
tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
|
||||
}
|
||||
}
|
||||
|
||||
var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
|
||||
, listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
|
||||
, taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
|
||||
, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
|
||||
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
||||
, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
|
||||
, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/
|
||||
, linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
|
||||
, punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
|
||||
, expandedTab = " " // CommonMark specifies tab as 4 spaces
|
||||
|
||||
function switchInline(stream, state, f) {
|
||||
state.f = state.inline = f;
|
||||
return f(stream, state);
|
||||
}
|
||||
|
||||
function switchBlock(stream, state, f) {
|
||||
state.f = state.block = f;
|
||||
return f(stream, state);
|
||||
}
|
||||
|
||||
function lineIsEmpty(line) {
|
||||
return !line || !/\S/.test(line.string)
|
||||
}
|
||||
|
||||
// Blocks
|
||||
|
||||
function blankLine(state) {
|
||||
// Reset linkTitle state
|
||||
state.linkTitle = false;
|
||||
state.linkHref = false;
|
||||
state.linkText = false;
|
||||
// Reset EM state
|
||||
state.em = false;
|
||||
// Reset STRONG state
|
||||
state.strong = false;
|
||||
// Reset strikethrough state
|
||||
state.strikethrough = false;
|
||||
// Reset state.quote
|
||||
state.quote = 0;
|
||||
// Reset state.indentedCode
|
||||
state.indentedCode = false;
|
||||
if (state.f == htmlBlock) {
|
||||
var exit = htmlModeMissing
|
||||
if (!exit) {
|
||||
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
|
||||
exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
|
||||
(!inner.state.context && inner.state.tokenize.isInText)
|
||||
}
|
||||
if (exit) {
|
||||
state.f = inlineNormal;
|
||||
state.block = blockNormal;
|
||||
state.htmlState = null;
|
||||
}
|
||||
}
|
||||
// Reset state.trailingSpace
|
||||
state.trailingSpace = 0;
|
||||
state.trailingSpaceNewLine = false;
|
||||
// Mark this line as blank
|
||||
state.prevLine = state.thisLine
|
||||
state.thisLine = {stream: null}
|
||||
return null;
|
||||
}
|
||||
|
||||
function blockNormal(stream, state) {
|
||||
var firstTokenOnLine = stream.column() === state.indentation;
|
||||
var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
|
||||
var prevLineIsIndentedCode = state.indentedCode;
|
||||
var prevLineIsHr = state.prevLine.hr;
|
||||
var prevLineIsList = state.list !== false;
|
||||
var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
|
||||
|
||||
state.indentedCode = false;
|
||||
|
||||
var lineIndentation = state.indentation;
|
||||
// compute once per line (on first token)
|
||||
if (state.indentationDiff === null) {
|
||||
state.indentationDiff = state.indentation;
|
||||
if (prevLineIsList) {
|
||||
state.list = null;
|
||||
// While this list item's marker's indentation is less than the deepest
|
||||
// list item's content's indentation,pop the deepest list item
|
||||
// indentation off the stack, and update block indentation state
|
||||
while (lineIndentation < state.listStack[state.listStack.length - 1]) {
|
||||
state.listStack.pop();
|
||||
if (state.listStack.length) {
|
||||
state.indentation = state.listStack[state.listStack.length - 1];
|
||||
// less than the first list's indent -> the line is no longer a list
|
||||
} else {
|
||||
state.list = false;
|
||||
}
|
||||
}
|
||||
if (state.list !== false) {
|
||||
state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not comprehensive (currently only for setext detection purposes)
|
||||
var allowsInlineContinuation = (
|
||||
!prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
|
||||
(!prevLineIsList || !prevLineIsIndentedCode) &&
|
||||
!state.prevLine.fencedCodeEnd
|
||||
);
|
||||
|
||||
var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
|
||||
state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
|
||||
|
||||
var match = null;
|
||||
if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
|
||||
state.prevLine.header || prevLineLineIsEmpty)) {
|
||||
stream.skipToEnd();
|
||||
state.indentedCode = true;
|
||||
return tokenTypes.code;
|
||||
} else if (stream.eatSpace()) {
|
||||
return null;
|
||||
} else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
|
||||
state.quote = 0;
|
||||
state.header = match[1].length;
|
||||
state.thisLine.header = true;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
state.f = state.inline;
|
||||
return getType(state);
|
||||
} else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
|
||||
state.quote = firstTokenOnLine ? 1 : state.quote + 1;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "quote";
|
||||
stream.eatSpace();
|
||||
return getType(state);
|
||||
} else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
|
||||
var listType = match[1] ? "ol" : "ul";
|
||||
|
||||
state.indentation = lineIndentation + stream.current().length;
|
||||
state.list = true;
|
||||
state.quote = 0;
|
||||
|
||||
// Add this list item's content's indentation to the stack
|
||||
state.listStack.push(state.indentation);
|
||||
// Reset inline styles which shouldn't propagate aross list items
|
||||
state.em = false;
|
||||
state.strong = false;
|
||||
state.code = false;
|
||||
state.strikethrough = false;
|
||||
|
||||
if (modeCfg.taskLists && stream.match(taskListRE, false)) {
|
||||
state.taskList = true;
|
||||
}
|
||||
state.f = state.inline;
|
||||
if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
|
||||
return getType(state);
|
||||
} else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
|
||||
state.quote = 0;
|
||||
state.fencedEndRE = new RegExp(match[1] + "+ *$");
|
||||
// try switching mode
|
||||
state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2]);
|
||||
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
|
||||
state.f = state.block = local;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
||||
state.code = -1
|
||||
return getType(state);
|
||||
// SETEXT has lowest block-scope precedence after HR, so check it after
|
||||
// the others (code, blockquote, list...)
|
||||
} else if (
|
||||
// if setext set, indicates line after ---/===
|
||||
state.setext || (
|
||||
// line before ---/===
|
||||
(!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
|
||||
!state.code && !isHr && !linkDefRE.test(stream.string) &&
|
||||
(match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
|
||||
)
|
||||
) {
|
||||
if ( !state.setext ) {
|
||||
state.header = match[0].charAt(0) == '=' ? 1 : 2;
|
||||
state.setext = state.header;
|
||||
} else {
|
||||
state.header = state.setext;
|
||||
// has no effect on type so we can reset it now
|
||||
state.setext = 0;
|
||||
stream.skipToEnd();
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
}
|
||||
state.thisLine.header = true;
|
||||
state.f = state.inline;
|
||||
return getType(state);
|
||||
} else if (isHr) {
|
||||
stream.skipToEnd();
|
||||
state.hr = true;
|
||||
state.thisLine.hr = true;
|
||||
return tokenTypes.hr;
|
||||
} else if (stream.peek() === '[') {
|
||||
return switchInline(stream, state, footnoteLink);
|
||||
}
|
||||
|
||||
return switchInline(stream, state, state.inline);
|
||||
}
|
||||
|
||||
function htmlBlock(stream, state) {
|
||||
var style = htmlMode.token(stream, state.htmlState);
|
||||
if (!htmlModeMissing) {
|
||||
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
|
||||
if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
|
||||
(!inner.state.context && inner.state.tokenize.isInText)) ||
|
||||
(state.md_inside && stream.current().indexOf(">") > -1)) {
|
||||
state.f = inlineNormal;
|
||||
state.block = blockNormal;
|
||||
state.htmlState = null;
|
||||
}
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
function local(stream, state) {
|
||||
var currListInd = state.listStack[state.listStack.length - 1] || 0;
|
||||
var hasExitedList = state.indentation < currListInd;
|
||||
var maxFencedEndInd = currListInd + 3;
|
||||
if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
|
||||
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
||||
var returnType;
|
||||
if (!hasExitedList) returnType = getType(state)
|
||||
state.localMode = state.localState = null;
|
||||
state.block = blockNormal;
|
||||
state.f = inlineNormal;
|
||||
state.fencedEndRE = null;
|
||||
state.code = 0
|
||||
state.thisLine.fencedCodeEnd = true;
|
||||
if (hasExitedList) return switchBlock(stream, state, state.block);
|
||||
return returnType;
|
||||
} else if (state.localMode) {
|
||||
return state.localMode.token(stream, state.localState);
|
||||
} else {
|
||||
stream.skipToEnd();
|
||||
return tokenTypes.code;
|
||||
}
|
||||
}
|
||||
|
||||
// Inline
|
||||
function getType(state) {
|
||||
var styles = [];
|
||||
|
||||
if (state.formatting) {
|
||||
styles.push(tokenTypes.formatting);
|
||||
|
||||
if (typeof state.formatting === "string") state.formatting = [state.formatting];
|
||||
|
||||
for (var i = 0; i < state.formatting.length; i++) {
|
||||
styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
|
||||
|
||||
if (state.formatting[i] === "header") {
|
||||
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
|
||||
}
|
||||
|
||||
// Add `formatting-quote` and `formatting-quote-#` for blockquotes
|
||||
// Add `error` instead if the maximum blockquote nesting depth is passed
|
||||
if (state.formatting[i] === "quote") {
|
||||
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
|
||||
styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
|
||||
} else {
|
||||
styles.push("error");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.taskOpen) {
|
||||
styles.push("meta");
|
||||
return styles.length ? styles.join(' ') : null;
|
||||
}
|
||||
if (state.taskClosed) {
|
||||
styles.push("property");
|
||||
return styles.length ? styles.join(' ') : null;
|
||||
}
|
||||
|
||||
if (state.linkHref) {
|
||||
styles.push(tokenTypes.linkHref, "url");
|
||||
} else { // Only apply inline styles to non-url text
|
||||
if (state.strong) { styles.push(tokenTypes.strong); }
|
||||
if (state.em) { styles.push(tokenTypes.em); }
|
||||
if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
|
||||
if (state.emoji) { styles.push(tokenTypes.emoji); }
|
||||
if (state.linkText) { styles.push(tokenTypes.linkText); }
|
||||
if (state.code) { styles.push(tokenTypes.code); }
|
||||
if (state.image) { styles.push(tokenTypes.image); }
|
||||
if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
|
||||
if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
|
||||
}
|
||||
|
||||
if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
|
||||
|
||||
if (state.quote) {
|
||||
styles.push(tokenTypes.quote);
|
||||
|
||||
// Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
|
||||
if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
|
||||
styles.push(tokenTypes.quote + "-" + state.quote);
|
||||
} else {
|
||||
styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.list !== false) {
|
||||
var listMod = (state.listStack.length - 1) % 3;
|
||||
if (!listMod) {
|
||||
styles.push(tokenTypes.list1);
|
||||
} else if (listMod === 1) {
|
||||
styles.push(tokenTypes.list2);
|
||||
} else {
|
||||
styles.push(tokenTypes.list3);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.trailingSpaceNewLine) {
|
||||
styles.push("trailing-space-new-line");
|
||||
} else if (state.trailingSpace) {
|
||||
styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
|
||||
}
|
||||
|
||||
return styles.length ? styles.join(' ') : null;
|
||||
}
|
||||
|
||||
function handleText(stream, state) {
|
||||
if (stream.match(textRE, true)) {
|
||||
return getType(state);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function inlineNormal(stream, state) {
|
||||
var style = state.text(stream, state);
|
||||
if (typeof style !== 'undefined')
|
||||
return style;
|
||||
|
||||
if (state.list) { // List marker (*, +, -, 1., etc)
|
||||
state.list = null;
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
if (state.taskList) {
|
||||
var taskOpen = stream.match(taskListRE, true)[1] === " ";
|
||||
if (taskOpen) state.taskOpen = true;
|
||||
else state.taskClosed = true;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "task";
|
||||
state.taskList = false;
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
state.taskOpen = false;
|
||||
state.taskClosed = false;
|
||||
|
||||
if (state.header && stream.match(/^#+$/, true)) {
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
var ch = stream.next();
|
||||
|
||||
// Matches link titles present on next line
|
||||
if (state.linkTitle) {
|
||||
state.linkTitle = false;
|
||||
var matchCh = ch;
|
||||
if (ch === '(') {
|
||||
matchCh = ')';
|
||||
}
|
||||
matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
|
||||
var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
|
||||
if (stream.match(new RegExp(regex), true)) {
|
||||
return tokenTypes.linkHref;
|
||||
}
|
||||
}
|
||||
|
||||
// If this block is changed, it may need to be updated in GFM mode
|
||||
if (ch === '`') {
|
||||
var previousFormatting = state.formatting;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "code";
|
||||
stream.eatWhile('`');
|
||||
var count = stream.current().length
|
||||
if (state.code == 0 && (!state.quote || count == 1)) {
|
||||
state.code = count
|
||||
return getType(state)
|
||||
} else if (count == state.code) { // Must be exact
|
||||
var t = getType(state)
|
||||
state.code = 0
|
||||
return t
|
||||
} else {
|
||||
state.formatting = previousFormatting
|
||||
return getType(state)
|
||||
}
|
||||
} else if (state.code) {
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
if (ch === '\\') {
|
||||
stream.next();
|
||||
if (modeCfg.highlightFormatting) {
|
||||
var type = getType(state);
|
||||
var formattingEscape = tokenTypes.formatting + "-escape";
|
||||
return type ? type + " " + formattingEscape : formattingEscape;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
|
||||
state.imageMarker = true;
|
||||
state.image = true;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "image";
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
|
||||
state.imageMarker = false;
|
||||
state.imageAltText = true
|
||||
if (modeCfg.highlightFormatting) state.formatting = "image";
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
if (ch === ']' && state.imageAltText) {
|
||||
if (modeCfg.highlightFormatting) state.formatting = "image";
|
||||
var type = getType(state);
|
||||
state.imageAltText = false;
|
||||
state.image = false;
|
||||
state.inline = state.f = linkHref;
|
||||
return type;
|
||||
}
|
||||
|
||||
if (ch === '[' && !state.image) {
|
||||
if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
|
||||
state.linkText = true;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
if (ch === ']' && state.linkText) {
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
var type = getType(state);
|
||||
state.linkText = false;
|
||||
state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
|
||||
return type;
|
||||
}
|
||||
|
||||
if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
|
||||
state.f = state.inline = linkInline;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
var type = getType(state);
|
||||
if (type){
|
||||
type += " ";
|
||||
} else {
|
||||
type = "";
|
||||
}
|
||||
return type + tokenTypes.linkInline;
|
||||
}
|
||||
|
||||
if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
|
||||
state.f = state.inline = linkInline;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
var type = getType(state);
|
||||
if (type){
|
||||
type += " ";
|
||||
} else {
|
||||
type = "";
|
||||
}
|
||||
return type + tokenTypes.linkEmail;
|
||||
}
|
||||
|
||||
if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
|
||||
var end = stream.string.indexOf(">", stream.pos);
|
||||
if (end != -1) {
|
||||
var atts = stream.string.substring(stream.start, end);
|
||||
if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
|
||||
}
|
||||
stream.backUp(1);
|
||||
state.htmlState = CodeMirror.startState(htmlMode);
|
||||
return switchBlock(stream, state, htmlBlock);
|
||||
}
|
||||
|
||||
if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
|
||||
state.md_inside = false;
|
||||
return "tag";
|
||||
} else if (ch === "*" || ch === "_") {
|
||||
var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
|
||||
while (len < 3 && stream.eat(ch)) len++
|
||||
var after = stream.peek() || " "
|
||||
// See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
|
||||
var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
|
||||
var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
|
||||
var setEm = null, setStrong = null
|
||||
if (len % 2) { // Em
|
||||
if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
|
||||
setEm = true
|
||||
else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
|
||||
setEm = false
|
||||
}
|
||||
if (len > 1) { // Strong
|
||||
if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
|
||||
setStrong = true
|
||||
else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
|
||||
setStrong = false
|
||||
}
|
||||
if (setStrong != null || setEm != null) {
|
||||
if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
|
||||
if (setEm === true) state.em = ch
|
||||
if (setStrong === true) state.strong = ch
|
||||
var t = getType(state)
|
||||
if (setEm === false) state.em = false
|
||||
if (setStrong === false) state.strong = false
|
||||
return t
|
||||
}
|
||||
} else if (ch === ' ') {
|
||||
if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
|
||||
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
|
||||
return getType(state);
|
||||
} else { // Not surrounded by spaces, back up pointer
|
||||
stream.backUp(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (modeCfg.strikethrough) {
|
||||
if (ch === '~' && stream.eatWhile(ch)) {
|
||||
if (state.strikethrough) {// Remove strikethrough
|
||||
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
|
||||
var t = getType(state);
|
||||
state.strikethrough = false;
|
||||
return t;
|
||||
} else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
|
||||
state.strikethrough = true;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
|
||||
return getType(state);
|
||||
}
|
||||
} else if (ch === ' ') {
|
||||
if (stream.match(/^~~/, true)) { // Probably surrounded by space
|
||||
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
|
||||
return getType(state);
|
||||
} else { // Not surrounded by spaces, back up pointer
|
||||
stream.backUp(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
|
||||
state.emoji = true;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "emoji";
|
||||
var retType = getType(state);
|
||||
state.emoji = false;
|
||||
return retType;
|
||||
}
|
||||
|
||||
if (ch === ' ') {
|
||||
if (stream.match(/^ +$/, false)) {
|
||||
state.trailingSpace++;
|
||||
} else if (state.trailingSpace) {
|
||||
state.trailingSpaceNewLine = true;
|
||||
}
|
||||
}
|
||||
|
||||
return getType(state);
|
||||
}
|
||||
|
||||
function linkInline(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
||||
if (ch === ">") {
|
||||
state.f = state.inline = inlineNormal;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
var type = getType(state);
|
||||
if (type){
|
||||
type += " ";
|
||||
} else {
|
||||
type = "";
|
||||
}
|
||||
return type + tokenTypes.linkInline;
|
||||
}
|
||||
|
||||
stream.match(/^[^>]+/, true);
|
||||
|
||||
return tokenTypes.linkInline;
|
||||
}
|
||||
|
||||
function linkHref(stream, state) {
|
||||
// Check if space, and return NULL if so (to avoid marking the space)
|
||||
if(stream.eatSpace()){
|
||||
return null;
|
||||
}
|
||||
var ch = stream.next();
|
||||
if (ch === '(' || ch === '[') {
|
||||
state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link-string";
|
||||
state.linkHref = true;
|
||||
return getType(state);
|
||||
}
|
||||
return 'error';
|
||||
}
|
||||
|
||||
var linkRE = {
|
||||
")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
|
||||
"]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
|
||||
}
|
||||
|
||||
function getLinkHrefInside(endChar) {
|
||||
return function(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
||||
if (ch === endChar) {
|
||||
state.f = state.inline = inlineNormal;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link-string";
|
||||
var returnState = getType(state);
|
||||
state.linkHref = false;
|
||||
return returnState;
|
||||
}
|
||||
|
||||
stream.match(linkRE[endChar])
|
||||
state.linkHref = true;
|
||||
return getType(state);
|
||||
};
|
||||
}
|
||||
|
||||
function footnoteLink(stream, state) {
|
||||
if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
|
||||
state.f = footnoteLinkInside;
|
||||
stream.next(); // Consume [
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
state.linkText = true;
|
||||
return getType(state);
|
||||
}
|
||||
return switchInline(stream, state, inlineNormal);
|
||||
}
|
||||
|
||||
function footnoteLinkInside(stream, state) {
|
||||
if (stream.match(/^\]:/, true)) {
|
||||
state.f = state.inline = footnoteUrl;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "link";
|
||||
var returnType = getType(state);
|
||||
state.linkText = false;
|
||||
return returnType;
|
||||
}
|
||||
|
||||
stream.match(/^([^\]\\]|\\.)+/, true);
|
||||
|
||||
return tokenTypes.linkText;
|
||||
}
|
||||
|
||||
function footnoteUrl(stream, state) {
|
||||
// Check if space, and return NULL if so (to avoid marking the space)
|
||||
if(stream.eatSpace()){
|
||||
return null;
|
||||
}
|
||||
// Match URL
|
||||
stream.match(/^[^\s]+/, true);
|
||||
// Check for link title
|
||||
if (stream.peek() === undefined) { // End of line, set flag to check next line
|
||||
state.linkTitle = true;
|
||||
} else { // More content on line, check if link title
|
||||
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
|
||||
}
|
||||
state.f = state.inline = inlineNormal;
|
||||
return tokenTypes.linkHref + " url";
|
||||
}
|
||||
|
||||
var mode = {
|
||||
startState: function() {
|
||||
return {
|
||||
f: blockNormal,
|
||||
|
||||
prevLine: {stream: null},
|
||||
thisLine: {stream: null},
|
||||
|
||||
block: blockNormal,
|
||||
htmlState: null,
|
||||
indentation: 0,
|
||||
|
||||
inline: inlineNormal,
|
||||
text: handleText,
|
||||
|
||||
formatting: false,
|
||||
linkText: false,
|
||||
linkHref: false,
|
||||
linkTitle: false,
|
||||
code: 0,
|
||||
em: false,
|
||||
strong: false,
|
||||
header: 0,
|
||||
setext: 0,
|
||||
hr: false,
|
||||
taskList: false,
|
||||
list: false,
|
||||
listStack: [],
|
||||
quote: 0,
|
||||
trailingSpace: 0,
|
||||
trailingSpaceNewLine: false,
|
||||
strikethrough: false,
|
||||
emoji: false,
|
||||
fencedEndRE: null
|
||||
};
|
||||
},
|
||||
|
||||
copyState: function(s) {
|
||||
return {
|
||||
f: s.f,
|
||||
|
||||
prevLine: s.prevLine,
|
||||
thisLine: s.thisLine,
|
||||
|
||||
block: s.block,
|
||||
htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
|
||||
indentation: s.indentation,
|
||||
|
||||
localMode: s.localMode,
|
||||
localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
|
||||
|
||||
inline: s.inline,
|
||||
text: s.text,
|
||||
formatting: false,
|
||||
linkText: s.linkText,
|
||||
linkTitle: s.linkTitle,
|
||||
linkHref: s.linkHref,
|
||||
code: s.code,
|
||||
em: s.em,
|
||||
strong: s.strong,
|
||||
strikethrough: s.strikethrough,
|
||||
emoji: s.emoji,
|
||||
header: s.header,
|
||||
setext: s.setext,
|
||||
hr: s.hr,
|
||||
taskList: s.taskList,
|
||||
list: s.list,
|
||||
listStack: s.listStack.slice(0),
|
||||
quote: s.quote,
|
||||
indentedCode: s.indentedCode,
|
||||
trailingSpace: s.trailingSpace,
|
||||
trailingSpaceNewLine: s.trailingSpaceNewLine,
|
||||
md_inside: s.md_inside,
|
||||
fencedEndRE: s.fencedEndRE
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
|
||||
// Reset state.formatting
|
||||
state.formatting = false;
|
||||
|
||||
if (stream != state.thisLine.stream) {
|
||||
state.header = 0;
|
||||
state.hr = false;
|
||||
|
||||
if (stream.match(/^\s*$/, true)) {
|
||||
blankLine(state);
|
||||
return null;
|
||||
}
|
||||
|
||||
state.prevLine = state.thisLine
|
||||
state.thisLine = {stream: stream}
|
||||
|
||||
// Reset state.taskList
|
||||
state.taskList = false;
|
||||
|
||||
// Reset state.trailingSpace
|
||||
state.trailingSpace = 0;
|
||||
state.trailingSpaceNewLine = false;
|
||||
|
||||
if (!state.localState) {
|
||||
state.f = state.block;
|
||||
if (state.f != htmlBlock) {
|
||||
var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
|
||||
state.indentation = indentation;
|
||||
state.indentationDiff = null;
|
||||
if (indentation > 0) return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return state.f(stream, state);
|
||||
},
|
||||
|
||||
innerMode: function(state) {
|
||||
if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
|
||||
if (state.localState) return {state: state.localState, mode: state.localMode};
|
||||
return {state: state, mode: mode};
|
||||
},
|
||||
|
||||
indent: function(state, textAfter, line) {
|
||||
if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
|
||||
if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
|
||||
return CodeMirror.Pass
|
||||
},
|
||||
|
||||
blankLine: blankLine,
|
||||
|
||||
getType: getType,
|
||||
|
||||
blockCommentStart: "<!--",
|
||||
blockCommentEnd: "-->",
|
||||
closeBrackets: "()[]{}''\"\"``",
|
||||
fold: "markdown"
|
||||
};
|
||||
return mode;
|
||||
}, "xml");
|
||||
|
||||
CodeMirror.defineMIME("text/markdown", "markdown");
|
||||
|
||||
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
||||
|
||||
});
|
3
web/misc/showdown.min.js
vendored
Normal file
3
web/misc/showdown.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
983
web/pages/hilfe.md
Normal file
983
web/pages/hilfe.md
Normal file
@ -0,0 +1,983 @@
|
||||
# GoWiki Markdown Syntax Hilfe
|
||||
|
||||
----
|
||||
### Überschriften
|
||||
|
||||
|
||||
```
|
||||
# Header 1
|
||||
```
|
||||
|
||||
# Header 1
|
||||
|
||||
```
|
||||
## Header 2
|
||||
```
|
||||
## Header 2
|
||||
|
||||
```
|
||||
### Header 3
|
||||
```
|
||||
### Header 3
|
||||
|
||||
```
|
||||
#### Header 4
|
||||
```
|
||||
#### Header 4
|
||||
|
||||
```
|
||||
##### Header 5
|
||||
```
|
||||
##### Header 5
|
||||
|
||||
----
|
||||
### Text-Formatierung
|
||||
```**Bold**```
|
||||
**Bold**
|
||||
|
||||
```*Italic*```
|
||||
*Italic*
|
||||
|
||||
```~~Strikethrough~~```
|
||||
~~Strikethrough~~
|
||||
|
||||
-----
|
||||
### Listen
|
||||
```
|
||||
- Listenpunkt1
|
||||
- Listenpunkt2
|
||||
- Listenpunkt3
|
||||
```
|
||||
- Listenpunkt1
|
||||
- Listenpunkt2
|
||||
- Listenpunkt3
|
||||
|
||||
```
|
||||
1. James Madison
|
||||
2. James Monroe
|
||||
3. John Quincy Adams
|
||||
```
|
||||
1. James Madison
|
||||
2. James Monroe
|
||||
3. John Quincy Adams
|
||||
|
||||
```
|
||||
1. Make my changes
|
||||
1. Fix bug
|
||||
2. Improve formatting
|
||||
* Make the headings bigger
|
||||
2. Push my commits to GitHub
|
||||
3. Open a pull request
|
||||
* Describe my changes
|
||||
* Mention all the members of my team
|
||||
* Ask for feedback
|
||||
```
|
||||
|
||||
1. Make my changes
|
||||
1. Fix bug
|
||||
2. Improve formatting
|
||||
* Make the headings bigger
|
||||
2. Push my commits to GitHub
|
||||
3. Open a pull request
|
||||
* Describe my changes
|
||||
* Mention all the members of my team
|
||||
* Ask for feedback
|
||||
|
||||
-----
|
||||
### Zitate
|
||||
|
||||
```
|
||||
In the words of Abraham Lincoln:
|
||||
> Pardon my French
|
||||
```
|
||||
|
||||
In the words of Abraham Lincoln:
|
||||
> Pardon my French
|
||||
|
||||
-----
|
||||
### Links
|
||||
|
||||
Syntax:
|
||||
`[Link Text](http://www.link.de)`
|
||||
|
||||
**Beispiel Externer Link:**
|
||||
```
|
||||
Dies ist ein Beispiel [Link Text](http://www.link.de).
|
||||
```
|
||||
|
||||
Ausgabe:
|
||||
Dies ist ein Beispiel [Link Text](http://www.link.de).
|
||||
|
||||
**Beispiel Interner Wiki Link:**
|
||||
```
|
||||
Hier geht es zur [Startseite](/start).
|
||||
```
|
||||
|
||||
Ausgabe:
|
||||
Hier geht es zur [Startseite](/start).
|
||||
|
||||
-----
|
||||
### Bilder
|
||||
|
||||
Syntax:
|
||||
`[![Tooltip Text](http://www.URLzumBild.de/Bild.jpg)]`
|
||||
|
||||
Beispiel:
|
||||
```
|
||||
[![Bild](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGYAAABmCAMAAAAOARRQAAAAY1BMVEX///8AAAAwMDCGhoZhYWH09PSlpaX19fXOzs78/PwYGBhMTEzq6uooKChlZWXj4+OsrKwfHx/X19c+Pj45OTm5ubl8fHyenp7d3d0QEBC/v7+Li4txcXGUlJRJSUlWVlZ4eHhwNMP8AAACLElEQVRoge2Z65KiMBCFuxUExAsCKuCFff+nXMARkk4yZmo7qdmqnF/qCXwk3XQuAgQFBQUFBQX9XnWHeuVIddR9QZoenSpvRkpZuaUgViVA4rgvo/oEzu4piGfw0JkhPLD1gdmCDwpiwPwnmFasRie18Vb0pRSV6tgnzEGsp2VN255S0b+JViYY2SdMJNVtpT5sJHstWrFgxD/DwEVuSlw2TJaLZrVzhIFGCM8+JSYfBs5LOl2px4hZwhNl1OLEwPPlnBQKL+a4nyg0MNyY19tzVTvDjMmG2x0SjcGLgSSqYt3vzBgoNYFxgDEoYAKGB9M19Ma7gmD6HW0it+8tMNcDrTCXC+3NRVOEZmV/bHqzwYd8WYFrisECzNpYDdoG2078nq40mNY8bMfWEoN1KVw1LAxUDOa6qjoqftqlwNjnaH7Y7I5aDD704cmkZdwHDM5Bf6ABo5vxBnXbn2DeMe7QhMFaN2zxXqJ8xOD0sOXKjJGXxF+SVng2mOdxeM8i/AYzbGCpxFy2w+A9me9owIgJOSklQ2aDwWvx/mTA4F2exXfq7twCs8iEIUvStXolDwbFrNYdaDBhqiWrj0pg+DCLNZULZ5i5Vj90FD5M9ZoFU83OmGKk97lQG99E/0bM6eLEcDjHtGEfNWa1NjAU848qdSPAj+k743kmJ6bVh58b8418YTwdQtJ5zolyXwfEno67PR3eAzSOw5O/txZd5OGPlaCgoKCgoKDfqL+n/yIR0u2vJwAAAABJRU5ErkJggg==)]
|
||||
```
|
||||
|
||||
Ausgabe:
|
||||
[![Bild](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGYAAABmCAMAAAAOARRQAAAAY1BMVEX///8AAAAwMDCGhoZhYWH09PSlpaX19fXOzs78/PwYGBhMTEzq6uooKChlZWXj4+OsrKwfHx/X19c+Pj45OTm5ubl8fHyenp7d3d0QEBC/v7+Li4txcXGUlJRJSUlWVlZ4eHhwNMP8AAACLElEQVRoge2Z65KiMBCFuxUExAsCKuCFff+nXMARkk4yZmo7qdmqnF/qCXwk3XQuAgQFBQUFBQX9XnWHeuVIddR9QZoenSpvRkpZuaUgViVA4rgvo/oEzu4piGfw0JkhPLD1gdmCDwpiwPwnmFasRie18Vb0pRSV6tgnzEGsp2VN255S0b+JViYY2SdMJNVtpT5sJHstWrFgxD/DwEVuSlw2TJaLZrVzhIFGCM8+JSYfBs5LOl2px4hZwhNl1OLEwPPlnBQKL+a4nyg0MNyY19tzVTvDjMmG2x0SjcGLgSSqYt3vzBgoNYFxgDEoYAKGB9M19Ma7gmD6HW0it+8tMNcDrTCXC+3NRVOEZmV/bHqzwYd8WYFrisECzNpYDdoG2078nq40mNY8bMfWEoN1KVw1LAxUDOa6qjoqftqlwNjnaH7Y7I5aDD704cmkZdwHDM5Bf6ABo5vxBnXbn2DeMe7QhMFaN2zxXqJ8xOD0sOXKjJGXxF+SVng2mOdxeM8i/AYzbGCpxFy2w+A9me9owIgJOSklQ2aDwWvx/mTA4F2exXfq7twCs8iEIUvStXolDwbFrNYdaDBhqiWrj0pg+DCLNZULZ5i5Vj90FD5M9ZoFU83OmGKk97lQG99E/0bM6eLEcDjHtGEfNWa1NjAU848qdSPAj+k743kmJ6bVh58b8418YTwdQtJ5zolyXwfEno67PR3eAzSOw5O/txZd5OGPlaCgoKCgoKDfqL+n/yIR0u2vJwAAAABJRU5ErkJggg==)](http://www.frickelblog.de)
|
||||
|
||||
Alternativ: Bild mit Link:
|
||||
`[![Tooltip Text](http://www.URLzumBild.de/Bild.jpg)](http://www.frickelblog.de)`
|
||||
|
||||
-----
|
||||
### Emojis
|
||||
|
||||
|
||||
**People:**
|
||||
|
||||
:smile:
|
||||
:laughing:
|
||||
:blush:
|
||||
:smiley:
|
||||
:relaxed:
|
||||
:smirk:
|
||||
:heart_eyes:
|
||||
:kissing_heart:
|
||||
:kissing_closed_eyes:
|
||||
:flushed:
|
||||
:relieved:
|
||||
:grin:
|
||||
:wink:
|
||||
:stuck_out_tongue_winking_eye:
|
||||
:stuck_out_tongue_closed_eyes:
|
||||
:grinning:
|
||||
:kissing:
|
||||
:kissing_smiling_eyes:
|
||||
:stuck_out_tongue:
|
||||
:sleeping:
|
||||
:worried:
|
||||
:frowning:
|
||||
:anguished:
|
||||
:open_mouth:
|
||||
:grimacing:
|
||||
:confused:
|
||||
:hushed:
|
||||
:expressionless:
|
||||
:unamused:
|
||||
:sweat_smile:
|
||||
:sweat:
|
||||
:disappointed_relieved:
|
||||
:weary:
|
||||
:pensive:
|
||||
:disappointed:
|
||||
:confounded:
|
||||
:fearful:
|
||||
:cold_sweat:
|
||||
:persevere:
|
||||
:cry:
|
||||
:sob:
|
||||
:joy:
|
||||
:astonished:
|
||||
:scream:
|
||||
:tired_face:
|
||||
:angry:
|
||||
:rage:
|
||||
:triumph:
|
||||
:sleepy:
|
||||
:yum:
|
||||
:mask:
|
||||
:sunglasses:
|
||||
:dizzy_face:
|
||||
:imp:
|
||||
:smiling_imp:
|
||||
:neutral_face:
|
||||
:no_mouth:
|
||||
:innocent:
|
||||
:alien:
|
||||
:yellow_heart:
|
||||
:blue_heart:
|
||||
:purple_heart:
|
||||
:heart:
|
||||
:green_heart:
|
||||
:broken_heart:
|
||||
:heartbeat:
|
||||
:heartpulse:
|
||||
:two_hearts:
|
||||
:revolving_hearts:
|
||||
:cupid:
|
||||
:sparkling_heart:
|
||||
:sparkles:
|
||||
:star:
|
||||
:star2:
|
||||
:dizzy:
|
||||
:boom:
|
||||
:anger:
|
||||
:exclamation:
|
||||
:question:
|
||||
:grey_exclamation:
|
||||
:grey_question:
|
||||
:zzz:
|
||||
:dash:
|
||||
:sweat_drops:
|
||||
:notes:
|
||||
:musical_note:
|
||||
:fire:
|
||||
:hankey:
|
||||
:+1:
|
||||
:-1:
|
||||
:ok_hand:
|
||||
:v:
|
||||
:wave:
|
||||
:hand:
|
||||
:open_hands:
|
||||
:point_up:
|
||||
:point_down:
|
||||
:point_left:
|
||||
:point_right:
|
||||
:raised_hands:
|
||||
:pray:
|
||||
:point_up_2:
|
||||
:clap:
|
||||
:muscle:
|
||||
:metal:
|
||||
:couple:
|
||||
:two_men_holding_hands:
|
||||
:two_women_holding_hands:
|
||||
:dancer:
|
||||
:ok_woman:
|
||||
:bride_with_veil:
|
||||
:nail_care:
|
||||
:boy:
|
||||
:girl:
|
||||
:woman:
|
||||
:man:
|
||||
:baby:
|
||||
:older_woman:
|
||||
:older_man:
|
||||
:man_with_gua_pi_mao:
|
||||
:man_with_turban:
|
||||
:angel:
|
||||
:princess:
|
||||
:smiley_cat:
|
||||
:smile_cat:
|
||||
:heart_eyes_cat:
|
||||
:kissing_cat:
|
||||
:smirk_cat:
|
||||
:scream_cat:
|
||||
:crying_cat_face:
|
||||
:joy_cat:
|
||||
:pouting_cat:
|
||||
:japanese_ogre:
|
||||
:japanese_goblin:
|
||||
:see_no_evil:
|
||||
:hear_no_evil:
|
||||
:speak_no_evil:
|
||||
:guardsman:
|
||||
:skull:
|
||||
:feet:
|
||||
:lips:
|
||||
:kiss:
|
||||
:droplet:
|
||||
:ear:
|
||||
:eyes:
|
||||
:nose:
|
||||
:tongue:
|
||||
:love_letter:
|
||||
:bust_in_silhouette:
|
||||
:busts_in_silhouette:
|
||||
:speech_balloon:
|
||||
:thought_balloon:
|
||||
|
||||
|
||||
**Nature:**
|
||||
|
||||
:sunny:
|
||||
:umbrella:
|
||||
:cloud:
|
||||
:snowflake:
|
||||
:snowman:
|
||||
:zap:
|
||||
:cyclone:
|
||||
:foggy:
|
||||
:ocean:
|
||||
:cat:
|
||||
:dog:
|
||||
:mouse:
|
||||
:hamster:
|
||||
:rabbit:
|
||||
:wolf:
|
||||
:frog:
|
||||
:tiger:
|
||||
:koala:
|
||||
:bear:
|
||||
:pig:
|
||||
:pig_nose:
|
||||
:cow:
|
||||
:boar:
|
||||
:monkey_face:
|
||||
:monkey:
|
||||
:horse:
|
||||
:racehorse:
|
||||
:camel:
|
||||
:sheep:
|
||||
:elephant:
|
||||
:panda_face:
|
||||
:snake:
|
||||
:bird:
|
||||
:baby_chick:
|
||||
:hatched_chick:
|
||||
:hatching_chick:
|
||||
:chicken:
|
||||
:penguin:
|
||||
:turtle:
|
||||
:bug:
|
||||
:ant:
|
||||
:beetle:
|
||||
:snail:
|
||||
:octopus:
|
||||
:tropical_fish:
|
||||
:fish:
|
||||
:whale:
|
||||
:whale2:
|
||||
:dolphin:
|
||||
:cow2:
|
||||
:ram:
|
||||
:rat:
|
||||
:water_buffalo:
|
||||
:tiger2:
|
||||
:rabbit2:
|
||||
:dragon:
|
||||
:goat:
|
||||
:rooster:
|
||||
:dog2:
|
||||
:pig2:
|
||||
:mouse2:
|
||||
:ox:
|
||||
:dragon_face:
|
||||
:blowfish:
|
||||
:crocodile:
|
||||
:dromedary_camel:
|
||||
:leopard:
|
||||
:cat2:
|
||||
:poodle:
|
||||
:bouquet:
|
||||
:cherry_blossom:
|
||||
:tulip:
|
||||
:four_leaf_clover:
|
||||
:rose:
|
||||
:sunflower:
|
||||
:hibiscus:
|
||||
:maple_leaf:
|
||||
:leaves:
|
||||
:fallen_leaf:
|
||||
:herb:
|
||||
:mushroom:
|
||||
:cactus:
|
||||
:palm_tree:
|
||||
:evergreen_tree:
|
||||
:deciduous_tree:
|
||||
:chestnut:
|
||||
:seedling:
|
||||
:blossom:
|
||||
:ear_of_rice:
|
||||
:shell:
|
||||
:globe_with_meridians:
|
||||
:sun_with_face:
|
||||
:full_moon_with_face:
|
||||
:new_moon_with_face:
|
||||
:new_moon:
|
||||
:waxing_crescent_moon:
|
||||
:first_quarter_moon:
|
||||
:full_moon:
|
||||
:last_quarter_moon:
|
||||
:waning_crescent_moon:
|
||||
:last_quarter_moon_with_face:
|
||||
:first_quarter_moon_with_face:
|
||||
:moon:
|
||||
:earth_africa:
|
||||
:earth_americas:
|
||||
:earth_asia:
|
||||
:volcano:
|
||||
:milky_way:
|
||||
:partly_sunny:
|
||||
|
||||
|
||||
**Objects:**
|
||||
|
||||
:bamboo:
|
||||
:gift_heart:
|
||||
:dolls:
|
||||
:school_satchel:
|
||||
:mortar_board:
|
||||
:flags:
|
||||
:fireworks:
|
||||
:sparkler:
|
||||
:wind_chime:
|
||||
:rice_scene:
|
||||
:jack_o_lantern:
|
||||
:ghost:
|
||||
:santa:
|
||||
:christmas_tree:
|
||||
:gift:
|
||||
:bell:
|
||||
:no_bell:
|
||||
:tanabata_tree:
|
||||
:tada:
|
||||
:confetti_ball:
|
||||
:balloon:
|
||||
:crystal_ball:
|
||||
:cd:
|
||||
:dvd:
|
||||
:floppy_disk:
|
||||
:camera:
|
||||
:video_camera:
|
||||
:movie_camera:
|
||||
:computer:
|
||||
:tv:
|
||||
:iphone:
|
||||
:phone:
|
||||
:telephone_receiver:
|
||||
:pager:
|
||||
:fax:
|
||||
:minidisc:
|
||||
:vhs:
|
||||
:sound:
|
||||
:speaker:
|
||||
:mute:
|
||||
:loudspeaker:
|
||||
:mega:
|
||||
:hourglass:
|
||||
:hourglass_flowing_sand:
|
||||
:alarm_clock:
|
||||
:watch:
|
||||
:radio:
|
||||
:satellite:
|
||||
:loop:
|
||||
:mag:
|
||||
:mag_right:
|
||||
:unlock:
|
||||
:lock:
|
||||
:lock_with_ink_pen:
|
||||
:closed_lock_with_key:
|
||||
:key:
|
||||
:bulb:
|
||||
:flashlight:
|
||||
:high_brightness:
|
||||
:low_brightness:
|
||||
:electric_plug:
|
||||
:battery:
|
||||
:calling:
|
||||
:email:
|
||||
:mailbox:
|
||||
:postbox:
|
||||
:bath:
|
||||
:bathtub:
|
||||
:shower:
|
||||
:toilet:
|
||||
:wrench:
|
||||
:nut_and_bolt:
|
||||
:hammer:
|
||||
:seat:
|
||||
:moneybag:
|
||||
:yen:
|
||||
:dollar:
|
||||
:pound:
|
||||
:euro:
|
||||
:credit_card:
|
||||
:money_with_wings:
|
||||
:e-mail:
|
||||
:inbox_tray:
|
||||
:outbox_tray:
|
||||
:incoming_envelope:
|
||||
:postal_horn:
|
||||
:mailbox_closed:
|
||||
:mailbox_with_mail:
|
||||
:mailbox_with_no_mail:
|
||||
:package:
|
||||
:door:
|
||||
:smoking:
|
||||
:bomb:
|
||||
:gun:
|
||||
:hocho:
|
||||
:pill:
|
||||
:syringe:
|
||||
:page_facing_up:
|
||||
:page_with_curl:
|
||||
:bookmark_tabs:
|
||||
:bar_chart:
|
||||
:chart_with_upwards_trend:
|
||||
:chart_with_downwards_trend:
|
||||
:scroll:
|
||||
:clipboard:
|
||||
:calendar:
|
||||
:date:
|
||||
:card_index:
|
||||
:file_folder:
|
||||
:open_file_folder:
|
||||
:scissors:
|
||||
:pushpin:
|
||||
:paperclip:
|
||||
:black_nib:
|
||||
:pencil2:
|
||||
:straight_ruler:
|
||||
:triangular_ruler:
|
||||
:closed_book:
|
||||
:green_book:
|
||||
:blue_book:
|
||||
:orange_book:
|
||||
:notebook:
|
||||
:notebook_with_decorative_cover:
|
||||
:ledger:
|
||||
:books:
|
||||
:bookmark:
|
||||
:name_badge:
|
||||
:microscope:
|
||||
:telescope:
|
||||
:newspaper:
|
||||
:football:
|
||||
:basketball:
|
||||
:soccer:
|
||||
:baseball:
|
||||
:tennis:
|
||||
:8ball:
|
||||
:rugby_football:
|
||||
:bowling:
|
||||
:golf:
|
||||
:horse_racing:
|
||||
:snowboarder:
|
||||
:ski:
|
||||
:spades:
|
||||
:hearts:
|
||||
:clubs:
|
||||
:diamonds:
|
||||
:gem:
|
||||
:ring:
|
||||
:trophy:
|
||||
:musical_score:
|
||||
:musical_keyboard:
|
||||
:violin:
|
||||
:space_invader:
|
||||
:video_game:
|
||||
:black_joker:
|
||||
:flower_playing_cards:
|
||||
:game_die:
|
||||
:dart:
|
||||
:mahjong:
|
||||
:clapper:
|
||||
:memo:
|
||||
:book:
|
||||
:art:
|
||||
:microphone:
|
||||
:headphones:
|
||||
:trumpet:
|
||||
:saxophone:
|
||||
:guitar:
|
||||
:sandal:
|
||||
:high_heel:
|
||||
:lipstick:
|
||||
:boot:
|
||||
:shirt:
|
||||
:necktie:
|
||||
:womans_clothes:
|
||||
:dress:
|
||||
:running_shirt_with_sash:
|
||||
:jeans:
|
||||
:kimono:
|
||||
:bikini:
|
||||
:ribbon:
|
||||
:tophat:
|
||||
:crown:
|
||||
:womans_hat:
|
||||
:mans_shoe:
|
||||
:closed_umbrella:
|
||||
:briefcase:
|
||||
:handbag:
|
||||
:pouch:
|
||||
:purse:
|
||||
:eyeglasses:
|
||||
:fishing_pole_and_fish:
|
||||
:coffee:
|
||||
:tea:
|
||||
:sake:
|
||||
:baby_bottle:
|
||||
:beer:
|
||||
:beers:
|
||||
:cocktail:
|
||||
:tropical_drink:
|
||||
:wine_glass:
|
||||
:fork_and_knife:
|
||||
:pizza:
|
||||
:hamburger:
|
||||
:fries:
|
||||
:poultry_leg:
|
||||
:meat_on_bone:
|
||||
:spaghetti:
|
||||
:curry:
|
||||
:fried_shrimp:
|
||||
:bento:
|
||||
:sushi:
|
||||
:fish_cake:
|
||||
:rice_ball:
|
||||
:rice_cracker:
|
||||
:rice:
|
||||
:ramen:
|
||||
:stew:
|
||||
:oden:
|
||||
:dango:
|
||||
:egg:
|
||||
:bread:
|
||||
:doughnut:
|
||||
:custard:
|
||||
:icecream:
|
||||
:ice_cream:
|
||||
:shaved_ice:
|
||||
:birthday:
|
||||
:cake:
|
||||
:cookie:
|
||||
:chocolate_bar:
|
||||
:candy:
|
||||
:lollipop:
|
||||
:honey_pot:
|
||||
:apple:
|
||||
:green_apple:
|
||||
:tangerine:
|
||||
:lemon:
|
||||
:cherries:
|
||||
:grapes:
|
||||
:watermelon:
|
||||
:strawberry:
|
||||
:peach:
|
||||
:melon:
|
||||
:banana:
|
||||
:pear:
|
||||
:pineapple:
|
||||
:sweet_potato:
|
||||
:eggplant:
|
||||
:tomato:
|
||||
:corn:
|
||||
|
||||
|
||||
**Places:**
|
||||
|
||||
:house:
|
||||
:house_with_garden:
|
||||
:school:
|
||||
:office:
|
||||
:post_office:
|
||||
:hospital:
|
||||
:bank:
|
||||
:convenience_store:
|
||||
:love_hotel:
|
||||
:hotel:
|
||||
:wedding:
|
||||
:church:
|
||||
:department_store:
|
||||
:european_post_office:
|
||||
:city_sunrise:
|
||||
:city_sunset:
|
||||
:japanese_castle:
|
||||
:european_castle:
|
||||
:tent:
|
||||
:factory:
|
||||
:tokyo_tower:
|
||||
:japan:
|
||||
:mount_fuji:
|
||||
:sunrise_over_mountains:
|
||||
:sunrise:
|
||||
:stars:
|
||||
:statue_of_liberty:
|
||||
:bridge_at_night:
|
||||
:carousel_horse:
|
||||
:rainbow:
|
||||
:ferris_wheel:
|
||||
:fountain:
|
||||
:roller_coaster:
|
||||
:ship:
|
||||
:speedboat:
|
||||
:boat:
|
||||
:anchor:
|
||||
:rocket:
|
||||
:airplane:
|
||||
:helicopter:
|
||||
:steam_locomotive:
|
||||
:tram:
|
||||
:mountain_railway:
|
||||
:bike:
|
||||
:aerial_tramway:
|
||||
:suspension_railway:
|
||||
:mountain_cableway:
|
||||
:tractor:
|
||||
:blue_car:
|
||||
:oncoming_automobile:
|
||||
:car:
|
||||
:taxi:
|
||||
:oncoming_taxi:
|
||||
:articulated_lorry:
|
||||
:bus:
|
||||
:oncoming_bus:
|
||||
:rotating_light:
|
||||
:police_car:
|
||||
:oncoming_police_car:
|
||||
:fire_engine:
|
||||
:ambulance:
|
||||
:minibus:
|
||||
:truck:
|
||||
:train:
|
||||
:station:
|
||||
:train2:
|
||||
:bullettrain_front:
|
||||
:bullettrain_side:
|
||||
:light_rail:
|
||||
:monorail:
|
||||
:railway_car:
|
||||
:trolleybus:
|
||||
:ticket:
|
||||
:fuelpump:
|
||||
:vertical_traffic_light:
|
||||
:traffic_light:
|
||||
:warning:
|
||||
:construction:
|
||||
:beginner:
|
||||
:atm:
|
||||
:slot_machine:
|
||||
:busstop:
|
||||
:barber:
|
||||
:hotsprings:
|
||||
:checkered_flag:
|
||||
:crossed_flags:
|
||||
:izakaya_lantern:
|
||||
:moyai:
|
||||
:circus_tent:
|
||||
:performing_arts:
|
||||
:round_pushpin:
|
||||
:triangular_flag_on_post:
|
||||
|
||||
|
||||
**Symbols:**
|
||||
|
||||
:keycap_ten:
|
||||
:1234:
|
||||
:symbols:
|
||||
:arrow_backward:
|
||||
:arrow_down:
|
||||
:arrow_forward:
|
||||
:arrow_left:
|
||||
:capital_abcd:
|
||||
:abcd:
|
||||
:abc:
|
||||
:arrow_lower_left:
|
||||
:arrow_lower_right:
|
||||
:arrow_right:
|
||||
:arrow_up:
|
||||
:arrow_upper_left:
|
||||
:arrow_upper_right:
|
||||
:arrow_double_down:
|
||||
:arrow_double_up:
|
||||
:arrow_down_small:
|
||||
:arrow_heading_down:
|
||||
:arrow_heading_up:
|
||||
:leftwards_arrow_with_hook:
|
||||
:arrow_right_hook:
|
||||
:left_right_arrow:
|
||||
:arrow_up_down:
|
||||
:arrow_up_small:
|
||||
:arrows_clockwise:
|
||||
:arrows_counterclockwise:
|
||||
:rewind:
|
||||
:fast_forward:
|
||||
:information_source:
|
||||
:ok:
|
||||
:twisted_rightwards_arrows:
|
||||
:repeat:
|
||||
:repeat_one:
|
||||
:new:
|
||||
:top:
|
||||
:up:
|
||||
:cool:
|
||||
:free:
|
||||
:ng:
|
||||
:cinema:
|
||||
:koko:
|
||||
:signal_strength:
|
||||
:u5272:
|
||||
:u5408:
|
||||
:u55b6:
|
||||
:u6307:
|
||||
:u6708:
|
||||
:u6709:
|
||||
:u6e80:
|
||||
:u7121:
|
||||
:u7533:
|
||||
:u7a7a:
|
||||
:u7981:
|
||||
:sa:
|
||||
:restroom:
|
||||
:mens:
|
||||
:womens:
|
||||
:baby_symbol:
|
||||
:no_smoking:
|
||||
:parking:
|
||||
:wheelchair:
|
||||
:metro:
|
||||
:baggage_claim:
|
||||
:accept:
|
||||
:wc:
|
||||
:potable_water:
|
||||
:put_litter_in_its_place:
|
||||
:secret:
|
||||
:congratulations:
|
||||
:m:
|
||||
:passport_control:
|
||||
:left_luggage:
|
||||
:customs:
|
||||
:ideograph_advantage:
|
||||
:cl:
|
||||
:sos:
|
||||
:id:
|
||||
:no_entry_sign:
|
||||
:underage:
|
||||
:no_mobile_phones:
|
||||
:do_not_litter:
|
||||
:non-potable_water:
|
||||
:no_bicycles:
|
||||
:no_pedestrians:
|
||||
:children_crossing:
|
||||
:no_entry:
|
||||
:eight_spoked_asterisk:
|
||||
:sparkle:
|
||||
:eight_pointed_black_star:
|
||||
:heart_decoration:
|
||||
:vs:
|
||||
:vibration_mode:
|
||||
:mobile_phone_off:
|
||||
:chart:
|
||||
:currency_exchange:
|
||||
:aries:
|
||||
:taurus:
|
||||
:gemini:
|
||||
:cancer:
|
||||
:leo:
|
||||
:virgo:
|
||||
:libra:
|
||||
:scorpius:
|
||||
:sagittarius:
|
||||
:capricorn:
|
||||
:aquarius:
|
||||
:pisces:
|
||||
:ophiuchus:
|
||||
:six_pointed_star:
|
||||
:negative_squared_cross_mark:
|
||||
:a:
|
||||
:b:
|
||||
:ab:
|
||||
:o2:
|
||||
:diamond_shape_with_a_dot_inside:
|
||||
:recycle:
|
||||
:end:
|
||||
:back:
|
||||
:on:
|
||||
:soon:
|
||||
:clock1:
|
||||
:clock130:
|
||||
:clock10:
|
||||
:clock1030:
|
||||
:clock11:
|
||||
:clock1130:
|
||||
:clock12:
|
||||
:clock1230:
|
||||
:clock2:
|
||||
:clock230:
|
||||
:clock3:
|
||||
:clock330:
|
||||
:clock4:
|
||||
:clock430:
|
||||
:clock5:
|
||||
:clock530:
|
||||
:clock6:
|
||||
:clock630:
|
||||
:clock7:
|
||||
:clock730:
|
||||
:clock8:
|
||||
:clock830:
|
||||
:clock9:
|
||||
:clock930:
|
||||
:heavy_dollar_sign:
|
||||
:copyright:
|
||||
:registered:
|
||||
:tm:
|
||||
:x:
|
||||
:bangbang:
|
||||
:interrobang:
|
||||
:o:
|
||||
:heavy_multiplication_x:
|
||||
:heavy_plus_sign:
|
||||
:heavy_minus_sign:
|
||||
:heavy_division_sign:
|
||||
:white_flower:
|
||||
:100:
|
||||
:heavy_check_mark:
|
||||
:ballot_box_with_check:
|
||||
:radio_button:
|
||||
:link:
|
||||
:curly_loop:
|
||||
:wavy_dash:
|
||||
:part_alternation_mark:
|
||||
:trident:
|
||||
:black_small_square:
|
||||
:white_small_square:
|
||||
:black_medium_small_square:
|
||||
:white_medium_small_square:
|
||||
:black_medium_square:
|
||||
:white_medium_square:
|
||||
:black_large_square:
|
||||
:white_large_square:
|
||||
:white_check_mark:
|
||||
:black_square_button:
|
||||
:white_square_button:
|
||||
:black_circle:
|
||||
:white_circle:
|
||||
:red_circle:
|
||||
:large_blue_circle:
|
||||
:large_blue_diamond:
|
||||
:large_orange_diamond:
|
||||
:small_blue_diamond:
|
||||
:small_orange_diamond:
|
||||
:small_red_triangle:
|
||||
:small_red_triangle_down:
|
||||
|
||||
-----
|
||||
### ToDo-Listen
|
||||
|
||||
```
|
||||
- [x] ToDo 1
|
||||
- [ ] ToDo 2
|
||||
- [ ] ToDo 3
|
||||
```
|
||||
- [x] ToDo 1
|
||||
- [ ] ToDo 2
|
||||
- [ ] ToDo 3
|
||||
|
||||
-----
|
||||
### Tabellen (Pipe-Style)
|
||||
|
||||
```
|
||||
|Right | Left | Default | Center |
|
||||
|-----:|:-----|---------|:------:|
|
||||
| 12 | 12 | 12 | 12 |
|
||||
| 123 | 123 | 123 | 123 |
|
||||
| 1 | 1 | 1 | 1 |
|
||||
```
|
||||
|
||||
|Right | Left | Default | Center |
|
||||
|-----:|:-----|---------|:------:|
|
||||
| 12 | 12 | 12 | 12 |
|
||||
| 123 | 123 | 123 | 123 |
|
||||
| 1 | 1 | 1 | 1 |
|
||||
|
||||
|
||||
-----
|
||||
|
42
web/pages/playground.md
Normal file
42
web/pages/playground.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Testseite
|
||||
|
||||
-----
|
||||
|
||||
Eine Liste:
|
||||
* Ein Listenpunkt
|
||||
* Ein zweiter Listenpunkt
|
||||
* Der dritte Listenpunkt
|
||||
* Noch ein vierter Listenpunkt
|
||||
|
||||
-----
|
||||
|
||||
Code im Tag: `code code code`
|
||||
|
||||
-----
|
||||
|
||||
**FETT**
|
||||
_kursiv_
|
||||
~~durchgestrichen~~
|
||||
|
||||
-----
|
||||
|
||||
* listenpunkt `1`
|
||||
* listenpunkt `1.1`
|
||||
* listenpunkt `2`
|
||||
* listenpunkt `2.1`
|
||||
* listenpunkt `3`
|
||||
* listenpunkt `3.1`
|
||||
|
||||
-----
|
||||
|
||||
**Mehrzeiliger Code**
|
||||
Code kann auch Mehrzeilig erfolgen, z.B:
|
||||
```
|
||||
{
|
||||
"Host":"http://127.0.0.1",
|
||||
"Port":"8000",
|
||||
"IMGPath":"./data"
|
||||
}
|
||||
```
|
||||
|
||||
-----
|
4
web/pages/sidebar.md
Normal file
4
web/pages/sidebar.md
Normal file
@ -0,0 +1,4 @@
|
||||
**Sidebar**
|
||||
|
||||
[Start](/start)
|
||||
[Hilfe](/hilfe)
|
23
web/pages/start.md
Normal file
23
web/pages/start.md
Normal file
@ -0,0 +1,23 @@
|
||||
# GoWiki
|
||||
|
||||
## Startseite
|
||||
|
||||
Ein kleines, in Go gebasteltes Wiki.
|
||||
Jede Seite kann über den `Edit` Button oben rechts in der Ecke bearbeitet werden.
|
||||
Der Obere Teil der Sidebar kommt aus der Datei `sidebar.md` (kann auch über den Link: [/sidebar](/sidebar) aufgerufen werden).
|
||||
Der untere Teil der Sidebar wird dynmaisch zur Laufzeit generiert und spiegelt den Inhalt des `data`-Ordners wieder.
|
||||
|
||||
Eine Hilfe der Markdown-Syntax kann man unter [/hilfe](/hilfe) einsehen.
|
||||
Unter [/playground](/playground) gibt es eine Test-Seite zum Testen.
|
||||
|
||||
Standardmäßig wird das Wiki unter der `http://127.0.0.1` und dem Port `8000` gesartet und verwendet die `*.md` Files, welche sich im Unterverzeichnis `./data` befinden.
|
||||
Diese Einstellungen können durch eine `config.json` im Start-Verzeichnis geändert werden:
|
||||
|
||||
Eine `config.json` könnte z.B. wie folgt aussehen:
|
||||
```
|
||||
{
|
||||
"Host":"http://127.0.0.1",
|
||||
"Port":"8000",
|
||||
"DataPath":"./data"
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user