WIP: Node. New generation #1
@ -235,11 +235,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))))
|
||||
|
12
node/ssr.go
12
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 {
|
||||
|
@ -36,6 +36,13 @@
|
||||
new
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a class="nav-link"
|
||||
href="/docs/formatting"
|
||||
role="button">
|
||||
doc
|
||||
</a>
|
||||
</div>
|
||||
</ul>
|
||||
<form method="get" action="/find" class="d-flex">
|
||||
<input
|
||||
|
@ -16,6 +16,10 @@
|
||||
color: #eee8d5;
|
||||
}
|
||||
|
||||
pre {
|
||||
color: #2aa198;
|
||||
}
|
||||
|
||||
.base2 {
|
||||
background-color: #073642;
|
||||
color: #eee8d5;
|
||||
@ -57,6 +61,14 @@
|
||||
box-shadow: 0px 0px 15px #002b36;
|
||||
}
|
||||
|
||||
.docs a {
|
||||
color: #268bd2;
|
||||
}
|
||||
|
||||
.docs-subheader a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1000px) {
|
||||
.dynamic-post {
|
||||
margin-bottom: 0.5em;
|
||||
|
12
templates/views/docs.html
Normal file
12
templates/views/docs.html
Normal file
@ -0,0 +1,12 @@
|
||||
{{ template "header" . }}
|
||||
|
||||
{{ template "style" }}
|
||||
|
||||
<div class="container-fluid mt-5 docs">
|
||||
<div class="container dynamic-bg dynamic-post">
|
||||
<h2>message formating convention</h2>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ template "footer" }}
|
80
templates/views/docs_formatting.html
Normal file
80
templates/views/docs_formatting.html
Normal file
@ -0,0 +1,80 @@
|
||||
{{ template "header" . }}
|
||||
|
||||
{{ template "style" }}
|
||||
|
||||
<div class="container-fluid mt-5 docs">
|
||||
<div class="container dynamic-bg dynamic-post">
|
||||
<h2>message formating convention</h2>
|
||||
|
||||
<div class="docs-subheader" id="code_blocks">
|
||||
<h3><a href="#code_blocks">Code blocks</a></h3>
|
||||
<p>
|
||||
Put your code betwen <i>====</i>
|
||||
<div id="code_example1">
|
||||
<pre>
|
||||
====
|
||||
for i in $(seq 1 25); do
|
||||
sleep 1
|
||||
done
|
||||
====
|
||||
</pre>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="docs-subheader" id="headers">
|
||||
<h3><a href="#headers">Headers</a></h3>
|
||||
<p>
|
||||
Put your header after <i>==</i> from the beginning of line
|
||||
<div id="code_example2">
|
||||
<pre>
|
||||
== This is my header!
|
||||
|
||||
Regular text
|
||||
</pre>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="docs-subheader" id="quotes">
|
||||
<h3><a href="#quotes">Quotes</a></h3>
|
||||
<p>
|
||||
Simple quoting
|
||||
<pre>
|
||||
>> Double quote
|
||||
> Quoted text
|
||||
|
||||
Answer
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
Quoting with an author name
|
||||
<pre>
|
||||
Author> Quoted text
|
||||
|
||||
Answer
|
||||
</pre>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="docs-subheader" id="links">
|
||||
<h3><a href="#links">Links</a></h3>
|
||||
<p>
|
||||
Links to the message
|
||||
<pre>
|
||||
ii://LzGnRCl9R0pwz6JHdShE
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
Links to the echo
|
||||
<pre>
|
||||
ii://pipe.2032
|
||||
</pre>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ template "footer" . }}
|
@ -1,4 +1,4 @@
|
||||
{{ template "header" . }}
|
||||
{{ template "header" . }}
|
||||
|
||||
{{ template "style" }}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user