summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cnhttp.go25
-rw-r--r--static/style.css23
2 files changed, 34 insertions, 14 deletions
diff --git a/cnhttp.go b/cnhttp.go
index 205b515..f12074e 100644
--- a/cnhttp.go
+++ b/cnhttp.go
@@ -561,18 +561,18 @@ func (srv *server) handleTags(req *cnp.Request, buf *bytes.Buffer, tags *[]strin
}
close := map[string]bool{
- "b": old.Bold && !new.Bold,
- "i": old.Italic && !new.Italic,
- "u": old.Underline && !new.Underline,
- "code": old.Monospace && !new.Monospace,
+ "em": old.Emphasized && !new.Emphasized,
+ "i": old.Alternate && !new.Alternate,
+ "code": old.Code && !new.Code,
+ "q": old.Quote && !new.Quote,
"a": old.Link != "" && old.Link != new.Link,
}
open := map[string]bool{
- "b": !old.Bold && new.Bold,
- "i": !old.Italic && new.Italic,
- "u": !old.Underline && new.Underline,
- "code": !old.Monospace && new.Monospace,
+ "em": !old.Emphasized && new.Emphasized,
+ "i": !old.Alternate && new.Alternate,
+ "code": !old.Code && new.Code,
+ "q": !old.Quote && new.Quote,
"a": new.Link != "" && old.Link != new.Link,
}
@@ -592,10 +592,10 @@ func (srv *server) handleTags(req *cnp.Request, buf *bytes.Buffer, tags *[]strin
}
*tags = t[:pop]
- tagPush(buf, tags, open, "b", "<b>")
+ tagPush(buf, tags, open, "em", "<em>")
tagPush(buf, tags, open, "i", "<i>")
- tagPush(buf, tags, open, "u", "<u>")
tagPush(buf, tags, open, "code", "<code>")
+ tagPush(buf, tags, open, "q", "<q>")
link, extern := srv.linkToURL(req, new.Link)
tagPush(buf, tags, open, "a", "<a"+extern+" href=\""+escapeURL(link)+"\">")
@@ -615,7 +615,7 @@ func (srv *server) linkToURL(req *cnp.Request, link string) (urlStr, extern stri
if u.Host == srv.host {
lhost = ""
} else {
- extern = " class=\"cnp-external cnp-external-cnp\""
+ extern = " class=\"cnp-external cnp-external-cnp\" data-scheme=\"cnp\""
}
urlStr = path.Join("/", lhost, lpath)
if strings.HasSuffix(link, "/") {
@@ -625,7 +625,8 @@ func (srv *server) linkToURL(req *cnp.Request, link string) (urlStr, extern stri
urlStr += "#" + u.Fragment
}
} else if u.Scheme != "" {
- extern = " class=\"cnp-external cnp-external-" + template.HTMLEscapeString(u.Scheme) + "\""
+ hscheme := template.HTMLEscapeString(u.Scheme)
+ extern = " class=\"cnp-external cnp-external-" + hscheme + "\" data-scheme=\"" + hscheme + "\""
urlStr = u.String()
} else {
urlStr = u.Path
diff --git a/static/style.css b/static/style.css
index 62c4f30..08d6f63 100644
--- a/static/style.css
+++ b/static/style.css
@@ -28,6 +28,7 @@ section h4, section h5, section h6 {
:hover>*>.sec-link {
display: inline;
+ text-decoration: none;
}
a.cnp-external {
@@ -58,7 +59,11 @@ a.cnp-external:hover:after {
bottom: 0;
}
-a.cnp-external-http:hover:after {
+a.cnp-external:hover:after {
+ content: attr(data-scheme);
+}
+
+/*a.cnp-external-http:hover:after {
content: 'http';
}
@@ -68,7 +73,7 @@ a.cnp-external-https:hover:after {
a.cnp-external-cnp:hover:after {
content: 'cnp';
-}
+}*/
main {
border: 1px dashed #aaa;
@@ -101,6 +106,7 @@ code {
pre.cnm-raw {
display: block;
+ white-space: pre;
}
pre>code {
@@ -111,6 +117,7 @@ pre>code {
padding: 0.5em;
margin-top: 0.5em;
margin-bottom: 0.5em;
+ overflow-x: auto;
}
pre>code:hover {
@@ -172,6 +179,18 @@ img {
max-width: 100%;
}
+em {
+ font-style: normal;
+ font-weight: bold;
+}
+
+i {
+ font-style: italic;
+}
+
+q {
+}
+
#browser {
width: 100%;
border: 1px solid black;