From a58bcecab6c36f2f1228ebc7e14c67947f7dc77f Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Fri, 2 Apr 2021 18:03:28 +0300 Subject: [PATCH] [Static][Docs]: Formatting --- node/api.go | 8 +++ node/ssr.go | 12 +++++ templates/common/header.html | 7 +++ templates/common/style.html | 12 +++++ templates/views/docs.html | 12 +++++ templates/views/docs_formatting.html | 80 ++++++++++++++++++++++++++++ templates/views/root.html | 2 +- 7 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 templates/views/docs.html create mode 100644 templates/views/docs_formatting.html diff --git a/node/api.go b/node/api.go index d4157ca..dd9707f 100644 --- a/node/api.go +++ b/node/api.go @@ -240,11 +240,19 @@ func Serve(opts *ServeOpts) { // Simple and clean SSR UI ssr := newSSR(opts.TemplatesDir, opts.ES) r.HandleFunc("/", ssr.ssrRootHandler) + // Forum r.HandleFunc("/forum/page/{page:[0-9]+}", ssr.ssrForumHandler) + // Echo r.HandleFunc("/echo/{echo:[a-z0-9-_.]+}/page/{page:[0-9]+}", ssr.echoViewHandler) + // Thread r.HandleFunc("/thread/{topicid:[a-z0-9-]+}", ssr.threadViewHandler) + // Single message r.HandleFunc("/msg/{msgid:[a-zA-Z0-9]{20}}", ssr.singleMessageHandler) + // Search r.HandleFunc("/find", ssr.searchHandler).Methods(http.MethodGet) + // Docs + // formatting + r.HandleFunc("/docs/formatting", ssr.docsFormattingHandler) if opts.ServeStatic { r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(opts.StaticDir)))) diff --git a/node/ssr.go b/node/ssr.go index 9c9a896..3836521 100644 --- a/node/ssr.go +++ b/node/ssr.go @@ -173,6 +173,18 @@ func (s *ssr) echoViewHandler(w http.ResponseWriter, r *http.Request) { } } +func (s *ssr) docsFormattingHandler(w http.ResponseWriter, r *http.Request) { + tpl, err := s.getTemplate("docs_formatting") + if err != nil { + log.Error(err) + return + } + + if err := tpl.Execute(w, s.newPageData("docs: formatting", nil, 1, false)); err != nil { + log.Error(err) + } +} + func (s *ssr) singleMessageHandler(w http.ResponseWriter, r *http.Request) { tpl, err := s.getTemplate("message") if err != nil { diff --git a/templates/common/header.html b/templates/common/header.html index 26b83b6..190aa4a 100644 --- a/templates/common/header.html +++ b/templates/common/header.html @@ -36,6 +36,13 @@ new +
+
+

message formating convention

+ +
+ + +{{ template "footer" }} diff --git a/templates/views/docs_formatting.html b/templates/views/docs_formatting.html new file mode 100644 index 0000000..df7ce3b --- /dev/null +++ b/templates/views/docs_formatting.html @@ -0,0 +1,80 @@ +{{ template "header" . }} + +{{ template "style" }} + +
+
+

message formating convention

+ +
+

Code blocks

+

+ Put your code betwen ==== +

+
+====
+for i in $(seq 1 25); do
+  sleep 1
+done
+====
+          
+
+

+
+ +
+

Headers

+

+ Put your header after == from the beginning of line +

+
+== This is my header!
+
+Regular text
+          
+
+

+
+ +
+

Quotes

+

+ Simple quoting +

+>> Double quote
+> Quoted text
+
+Answer
+        
+

+

+ Quoting with an author name +

+Author> Quoted text
+
+Answer
+        
+

+
+ + + + +
+
+ +{{ template "footer" . }} diff --git a/templates/views/root.html b/templates/views/root.html index 52f1d37..d12139c 100644 --- a/templates/views/root.html +++ b/templates/views/root.html @@ -1,4 +1,4 @@ - {{ template "header" . }} +{{ template "header" . }} {{ template "style" }}