Link meta key value
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-07-01 17:36:36 +02:00
parent 594f7ab96c
commit 4f6c87c14e
5 changed files with 19 additions and 2 deletions

View File

@ -4,8 +4,10 @@ import (
"encoding/json"
"fmt"
"html/template"
"log"
"os"
"path/filepath"
"regexp"
"strings"
)
@ -111,6 +113,13 @@ func getBackrefs(fp *FilePages, p string) (map[string][]Backref, error) {
if line[0] == '*' && line[1] == ' ' {
line = line[2:]
}
metaKV, err := regexp.Compile(`(\w+)::\s+(.*)`)
if err != nil {
log.Fatal(err)
}
line = metaKV.ReplaceAllString(line, "**[[$1]]**: $2")
links := renderLinks(line)
pageText := renderMarkdown2(links)

View File

@ -211,7 +211,7 @@ if (holder) {
converted = MD.render(converted)
} else {
if (text.match(/^(\w+):: (.+)$/)) {
converted = converted.replace(/^(\w+):: (.*)$/, '**$1**: $2')
converted = converted.replace(/^(\w+):: (.*)$/, '**[[$1]]**: $2')
} else if (text.match(/#\[\[TODO]]/)) {
converted = converted.replace('#[[TODO]]', '<input class="checkbox" type="checkbox" />')
} else if (text.match(/#\[\[DONE]]/)) {

View File

@ -683,6 +683,12 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
if format == "html" {
metaKV, err := regexp.Compile(`(\w+)::\s+(.*)`)
if err != nil {
log.Fatal(err)
}
pageText = metaKV.ReplaceAllString(pageText, "**[[$1]]**: $2")
pageText = renderLinks(pageText)
pageText = renderMarkdown2(pageText)

View File

@ -27,6 +27,7 @@ func renderMarkdown2(pageText string) string {
html.WithUnsafe(),
),
)
var buf bytes.Buffer
if err := md.Convert([]byte(pageText), &buf); err != nil {
panic(err)

View File

@ -17,7 +17,8 @@
}
#autocomplete {
z-index: 1;
width: 217px;
right: 0;
width: 400px;
overflow-x: hidden;
overflow-y: auto;
height: 300px;