diff --git a/markup/lexer.go b/markup/lexer.go index 24aaee5..4516eb0 100644 --- a/markup/lexer.go +++ b/markup/lexer.go @@ -165,8 +165,8 @@ numberState: launchpadState: switch { case startsWith("=>"): - href, text, class, icon := Rocketlink(line, state.name) - state.buf += fmt.Sprintf(`
  • %s%s
  • `, class, href, text, icon) + href, text, class := Rocketlink(line, state.name) + state.buf += fmt.Sprintf(`
  • %s
  • `, class, href, text) case startsWith("```"): state.where = "pre" addLine(state.buf + "") diff --git a/markup/link.go b/markup/link.go index 1c358be..af3e51c 100644 --- a/markup/link.go +++ b/markup/link.go @@ -10,13 +10,13 @@ import ( // // => addr display // [[addr|display]] -func LinkParts(addr, display, hyphaName string) (href, text, class, icon string) { +func LinkParts(addr, display, hyphaName string) (href, text, class string) { if display == "" { text = addr } else { text = strings.TrimSpace(display) } - class = "wikilink_internal" + class = "wikilink wikilink_internal" switch { case strings.ContainsRune(addr, ':'): @@ -28,9 +28,9 @@ func LinkParts(addr, display, hyphaName string) (href, text, class, icon string) text = text[2:] } } - return addr, text, "wikilink_external", fmt.Sprintf(``, destination) + return addr, text, fmt.Sprintf("wikilink wikilink_external wikilink_%s", destination) case strings.HasPrefix(addr, "/"): - return addr, text, class, "" + return addr, text, class case strings.HasPrefix(addr, "./"): hyphaName = canonicalName(path.Join(hyphaName, addr[2:])) case strings.HasPrefix(addr, "../"): @@ -41,12 +41,12 @@ func LinkParts(addr, display, hyphaName string) (href, text, class, icon string) if !HyphaExists(hyphaName) { class += " wikilink_new" } - return "/page/" + hyphaName, text, class, "" + return "/page/" + hyphaName, text, class } // Parse markup line starting with "=>" according to wikilink rules. // See http://localhost:1737/page/wikilink -func Rocketlink(src, hyphaName string) (href, text, class, icon string) { +func Rocketlink(src, hyphaName string) (href, text, class string) { src = strings.TrimSpace(src[2:]) // Drop => if src == "" { return diff --git a/markup/paragraph.go b/markup/paragraph.go index bcb1c84..f506bb6 100644 --- a/markup/paragraph.go +++ b/markup/paragraph.go @@ -61,8 +61,8 @@ func getLinkNode(input *bytes.Buffer, hyphaName string, isBracketedLink bool) st currBuf.WriteByte(b) } } - href, text, class, icon := LinkParts(addrBuf.String(), displayBuf.String(), hyphaName) - return fmt.Sprintf(`%s%s`, href, class, html.EscapeString(text), icon) + href, text, class := LinkParts(addrBuf.String(), displayBuf.String(), hyphaName) + return fmt.Sprintf(`%s`, href, class, html.EscapeString(text)) } // getTextNode splits the `input` into two parts `textNode` and `rest` by the first encountered rune that resembles a span tag. If there is none, `textNode = input`, `rest = ""`. It handles escaping with backslash. diff --git a/metarrhiza b/metarrhiza index b67144c..be5b922 160000 --- a/metarrhiza +++ b/metarrhiza @@ -1 +1 @@ -Subproject commit b67144cc770900104a652483c11cabfecc7325aa +Subproject commit be5b922e9b564551601d21ed45bf7d9ced65c6bb diff --git a/templates/asset.qtpl.go b/templates/asset.qtpl.go index c13cf38..95a984b 100644 --- a/templates/asset.qtpl.go +++ b/templates/asset.qtpl.go @@ -57,7 +57,14 @@ textarea {font-size:16px; font-family: 'PT Sans', 'Liberation Sans', sans-serif; main h1:not(.navi-title) {font-size:1.7rem;} blockquote { margin-left: 0; padding-left: 1rem; } -.wikilink__destination-type {display: inline; margin: 0 .25rem; vertical-align: sub; } +.wikilink_external::before { display: inline-block; width: 18px; height: 16px; vertical-align: sub; } +/* .wikilink_external { padding-left: 16px; } */ +.wikilink_gopher::before { content: url("/static/icon/gopher"); } +.wikilink_http::before { content: url("/static/icon/http"); } +.wikilink_https::before { content: url("/static/icon/http"); } +/* .wikilink_https { background: transparent url("/static/icon/http") center left no-repeat; } */ +.wikilink_gemini::before { content: url("/static/icon/gemini"); } +.wikilink_mailto::before { content: url("/static/icon/mailto"); } article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; } article h1, article h2, article h3, article h4, article h5, article h6 { margin: 1.5rem 0 0 0; } @@ -72,7 +79,7 @@ article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25 .transclusion__link::before {content: "⇐ ";} /* Derived from https://commons.wikimedia.org/wiki/File:U%2B21D2.svg */ -.launchpad__entry { list-style-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.0' width='25' height='12'%3E%3Cg transform='scale(0.7,0.8) translate(-613.21429,-421)'%3E%3Cpath d='M 638.06773,429.49751 L 631.01022,436.87675 L 630.1898,436.02774 L 632.416,433.30375 L 613.46876,433.30375 L 613.46876,431.66382 L 633.82089,431.66382 L 635.57789,429.5261 L 633.79229,427.35979 L 613.46876,427.35979 L 613.46876,425.71985 L 632.416,425.71985 L 630.1898,422.99587 L 631.01022,422.08788 L 638.06773,429.49751 z '/%3E%3C/g%3E%3C/svg%3E"); } +.launchpad__entry { list-style-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.0' width='25' height='12'%3E%3Cg transform='scale(0.7,0.8) translate(-613.21429,-421)'%3E%3Cpath fill='%23999' d='M 638.06773,429.49751 L 631.01022,436.87675 L 630.1898,436.02774 L 632.416,433.30375 L 613.46876,433.30375 L 613.46876,431.66382 L 633.82089,431.66382 L 635.57789,429.5261 L 633.79229,427.35979 L 613.46876,427.35979 L 613.46876,425.71985 L 632.416,425.71985 L 630.1898,422.99587 L 631.01022,422.08788 L 638.06773,429.49751 z '/%3E%3C/g%3E%3C/svg%3E"); } .binary-container_with-img img, .binary-container_with-video video, @@ -126,7 +133,6 @@ td { padding: .25rem; } caption { caption-side: top; font-size: small; } /* Color stuff */ -svg path { fill: currentColor !important; } /* Lighter stuff #eee */ article code, article .codeblock, @@ -241,7 +247,7 @@ func StreamIconHTTP(qw422016 *qt422016.Writer) { qw422016.N().S(` `) //line templates/asset.qtpl:7 - qw422016.N().S(` + qw422016.N().S(` `) //line templates/asset.qtpl:7 qw422016.N().S(` @@ -281,7 +287,7 @@ func StreamIconGemini(qw422016 *qt422016.Writer) { qw422016.N().S(` `) //line templates/asset.qtpl:11 - qw422016.N().S(` + qw422016.N().S(` `) //line templates/asset.qtpl:11 qw422016.N().S(` @@ -321,7 +327,7 @@ func StreamIconMailto(qw422016 *qt422016.Writer) { qw422016.N().S(` `) //line templates/asset.qtpl:15 - qw422016.N().S(` + qw422016.N().S(` `) //line templates/asset.qtpl:15 qw422016.N().S(` @@ -363,8 +369,8 @@ func StreamIconGopher(qw422016 *qt422016.Writer) { qw422016.N().S(` `) //line templates/asset.qtpl:20 - qw422016.N().S(` - + - + `) //line templates/asset.qtpl:20 diff --git a/templates/default.css b/templates/default.css index a669a87..0d1ccda 100644 --- a/templates/default.css +++ b/templates/default.css @@ -32,7 +32,14 @@ textarea {font-size:16px; font-family: 'PT Sans', 'Liberation Sans', sans-serif; main h1:not(.navi-title) {font-size:1.7rem;} blockquote { margin-left: 0; padding-left: 1rem; } -.wikilink__destination-type {display: inline; margin: 0 .25rem; vertical-align: sub; } +.wikilink_external::before { display: inline-block; width: 18px; height: 16px; vertical-align: sub; } +/* .wikilink_external { padding-left: 16px; } */ +.wikilink_gopher::before { content: url("/static/icon/gopher"); } +.wikilink_http::before { content: url("/static/icon/http"); } +.wikilink_https::before { content: url("/static/icon/http"); } +/* .wikilink_https { background: transparent url("/static/icon/http") center left no-repeat; } */ +.wikilink_gemini::before { content: url("/static/icon/gemini"); } +.wikilink_mailto::before { content: url("/static/icon/mailto"); } article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; } article h1, article h2, article h3, article h4, article h5, article h6 { margin: 1.5rem 0 0 0; } @@ -47,7 +54,7 @@ article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25 .transclusion__link::before {content: "⇐ ";} /* Derived from https://commons.wikimedia.org/wiki/File:U%2B21D2.svg */ -.launchpad__entry { list-style-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.0' width='25' height='12'%3E%3Cg transform='scale(0.7,0.8) translate(-613.21429,-421)'%3E%3Cpath d='M 638.06773,429.49751 L 631.01022,436.87675 L 630.1898,436.02774 L 632.416,433.30375 L 613.46876,433.30375 L 613.46876,431.66382 L 633.82089,431.66382 L 635.57789,429.5261 L 633.79229,427.35979 L 613.46876,427.35979 L 613.46876,425.71985 L 632.416,425.71985 L 630.1898,422.99587 L 631.01022,422.08788 L 638.06773,429.49751 z '/%3E%3C/g%3E%3C/svg%3E"); } +.launchpad__entry { list-style-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.0' width='25' height='12'%3E%3Cg transform='scale(0.7,0.8) translate(-613.21429,-421)'%3E%3Cpath fill='%23999' d='M 638.06773,429.49751 L 631.01022,436.87675 L 630.1898,436.02774 L 632.416,433.30375 L 613.46876,433.30375 L 613.46876,431.66382 L 633.82089,431.66382 L 635.57789,429.5261 L 633.79229,427.35979 L 613.46876,427.35979 L 613.46876,425.71985 L 632.416,425.71985 L 630.1898,422.99587 L 631.01022,422.08788 L 638.06773,429.49751 z '/%3E%3C/g%3E%3C/svg%3E"); } .binary-container_with-img img, .binary-container_with-video video, @@ -101,7 +108,6 @@ td { padding: .25rem; } caption { caption-side: top; font-size: small; } /* Color stuff */ -svg path { fill: currentColor !important; } /* Lighter stuff #eee */ article code, article .codeblock, diff --git a/templates/icon/gemini-protocol-icon.svg b/templates/icon/gemini-protocol-icon.svg index 70beccb..f2a6414 100644 --- a/templates/icon/gemini-protocol-icon.svg +++ b/templates/icon/gemini-protocol-icon.svg @@ -1 +1 @@ - + diff --git a/templates/icon/gopher-protocol-icon.svg b/templates/icon/gopher-protocol-icon.svg index bce1a36..3ee0c59 100644 --- a/templates/icon/gopher-protocol-icon.svg +++ b/templates/icon/gopher-protocol-icon.svg @@ -1,5 +1,5 @@ - - + - + diff --git a/templates/icon/http-protocol-icon.svg b/templates/icon/http-protocol-icon.svg index c375ec4..5bb72f9 100644 --- a/templates/icon/http-protocol-icon.svg +++ b/templates/icon/http-protocol-icon.svg @@ -1 +1 @@ - + diff --git a/templates/icon/mailto-protocol-icon.svg b/templates/icon/mailto-protocol-icon.svg index 424021c..863ccc1 100644 --- a/templates/icon/mailto-protocol-icon.svg +++ b/templates/icon/mailto-protocol-icon.svg @@ -1 +1 @@ - + diff --git a/util/header_links.go b/util/header_links.go index 9c78565..c574768 100644 --- a/util/header_links.go +++ b/util/header_links.go @@ -14,11 +14,11 @@ func SetDefaultHeaderLinks() { } // rocketlinkλ is markup.Rocketlink. You have to pass it like that to avoid cyclical dependency. -func ParseHeaderLinks(text string, rocketlinkλ func(string, string) (string, string, string, string)) { +func ParseHeaderLinks(text string, rocketlinkλ func(string, string) (string, string, string)) { HeaderLinks = []HeaderLink{} for _, line := range strings.Split(text, "\n") { if strings.HasPrefix(line, "=>") { - href, text, _, _ := rocketlinkλ(line, HeaderLinksHypha) + href, text, _ := rocketlinkλ(line, HeaderLinksHypha) HeaderLinks = append(HeaderLinks, HeaderLink{ Href: href, Display: text,