Merge pull request #506 from writefreely/minor-fixes
Miscellaneous fixes
This commit is contained in:
commit
1530bf37ef
8 changed files with 17 additions and 17 deletions
|
@ -661,7 +661,7 @@ func (db *datastore) CreatePost(userID, collID int64, post *SubmittedPost) (*Pos
|
||||||
// SQLite stores datetimes in UTC, so convert time.Now() to it here
|
// SQLite stores datetimes in UTC, so convert time.Now() to it here
|
||||||
created = created.UTC()
|
created = created.UTC()
|
||||||
}
|
}
|
||||||
if post.Created != nil {
|
if post.Created != nil && *post.Created != "" {
|
||||||
created, err = time.Parse("2006-01-02T15:04:05Z", *post.Created)
|
created, err = time.Parse("2006-01-02T15:04:05Z", *post.Created)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to parse Created time '%s': %v", *post.Created, err)
|
log.Error("Unable to parse Created time '%s': %v", *post.Created, err)
|
||||||
|
|
16
feed.go
16
feed.go
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2018-2020 A Bunch Tell LLC.
|
* Copyright © 2018-2021 A Bunch Tell LLC.
|
||||||
*
|
*
|
||||||
* This file is part of WriteFreely.
|
* This file is part of WriteFreely.
|
||||||
*
|
*
|
||||||
|
@ -15,7 +15,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "github.com/gorilla/feeds"
|
"github.com/gorilla/feeds"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
stripmd "github.com/writeas/go-strip-markdown/v2"
|
stripmd "github.com/writeas/go-strip-markdown/v2"
|
||||||
"github.com/writeas/web-core/log"
|
"github.com/writeas/web-core/log"
|
||||||
|
@ -87,11 +87,11 @@ func ViewFeed(app *App, w http.ResponseWriter, req *http.Request) error {
|
||||||
siteURL += "tag:" + tag
|
siteURL += "tag:" + tag
|
||||||
}
|
}
|
||||||
|
|
||||||
feed := &Feed{
|
feed := &feeds.Feed{
|
||||||
Title: collectionTitle,
|
Title: collectionTitle,
|
||||||
Link: &Link{Href: siteURL},
|
Link: &feeds.Link{Href: siteURL},
|
||||||
Description: coll.Description,
|
Description: coll.Description,
|
||||||
Author: &Author{author, ""},
|
Author: &feeds.Author{author, ""},
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,13 +103,13 @@ func ViewFeed(app *App, w http.ResponseWriter, req *http.Request) error {
|
||||||
// Create the item for the feed
|
// Create the item for the feed
|
||||||
title = p.PlainDisplayTitle()
|
title = p.PlainDisplayTitle()
|
||||||
permalink = fmt.Sprintf("%s%s", baseUrl, p.Slug.String)
|
permalink = fmt.Sprintf("%s%s", baseUrl, p.Slug.String)
|
||||||
feed.Items = append(feed.Items, &Item{
|
feed.Items = append(feed.Items, &feeds.Item{
|
||||||
Id: fmt.Sprintf("%s%s", basePermalinkUrl, p.Slug.String),
|
Id: fmt.Sprintf("%s%s", basePermalinkUrl, p.Slug.String),
|
||||||
Title: title,
|
Title: title,
|
||||||
Link: &Link{Href: permalink},
|
Link: &feeds.Link{Href: permalink},
|
||||||
Description: "<![CDATA[" + stripmd.Strip(p.Content) + "]]>",
|
Description: "<![CDATA[" + stripmd.Strip(p.Content) + "]]>",
|
||||||
Content: string(p.HTMLContent),
|
Content: string(p.HTMLContent),
|
||||||
Author: &Author{author, ""},
|
Author: &feeds.Author{author, ""},
|
||||||
Created: p.Created,
|
Created: p.Created,
|
||||||
Updated: p.Updated,
|
Updated: p.Updated,
|
||||||
})
|
})
|
||||||
|
|
|
@ -695,6 +695,7 @@ table.downloads {
|
||||||
|
|
||||||
select.inputform, textarea.inputform {
|
select.inputform, textarea.inputform {
|
||||||
border: 1px solid #999;
|
border: 1px solid #999;
|
||||||
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, button, select.inputform, textarea.inputform, a.btn {
|
input, button, select.inputform, textarea.inputform, a.btn {
|
||||||
|
|
|
@ -201,6 +201,9 @@ func applyBasicMarkdown(data []byte) string {
|
||||||
md := blackfriday.Markdown(append([]byte("# "), data...), blackfriday.HtmlRenderer(htmlFlags, "", ""), mdExtensions)
|
md := blackfriday.Markdown(append([]byte("# "), data...), blackfriday.HtmlRenderer(htmlFlags, "", ""), mdExtensions)
|
||||||
// Remove H1 markup
|
// Remove H1 markup
|
||||||
md = bytes.TrimSpace(md) // blackfriday.Markdown adds a newline at the end of the <h1>
|
md = bytes.TrimSpace(md) // blackfriday.Markdown adds a newline at the end of the <h1>
|
||||||
|
if len(md) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
md = md[len("<h1>") : len(md)-len("</h1>")]
|
md = md[len("<h1>") : len(md)-len("</h1>")]
|
||||||
// Strip out bad HTML
|
// Strip out bad HTML
|
||||||
policy := bluemonday.UGCPolicy()
|
policy := bluemonday.UGCPolicy()
|
||||||
|
|
|
@ -92,8 +92,8 @@ export const writeFreelyMarkdownSerializer = new MarkdownSerializer(
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
em: {
|
em: {
|
||||||
open: "*",
|
open: "_",
|
||||||
close: "*",
|
close: "_",
|
||||||
mixable: true,
|
mixable: true,
|
||||||
expelEnclosingWhitespace: true,
|
expelEnclosingWhitespace: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
<dt><label for="lang">Language</label></dt>
|
<dt><label for="lang">Language</label></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<select name="lang" id="lang" dir="auto">
|
<select name="lang" id="lang" dir="auto" class="inputform">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="ab"{{if eq "ab" .Post.Language.String}} selected="selected"{{end}}>аҧсуа бызшәа, аҧсшәа</option>
|
<option value="ab"{{if eq "ab" .Post.Language.String}} selected="selected"{{end}}>аҧсуа бызшәа, аҧсшәа</option>
|
||||||
<option value="aa"{{if eq "aa" .Post.Language.String}} selected="selected"{{end}}>Afaraf</option>
|
<option value="aa"{{if eq "aa" .Post.Language.String}} selected="selected"{{end}}>Afaraf</option>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{{if not .SingleUser}}<h1><a href="/me/c/" title="View blogs"><img class="ic-24dp" src="/img/ic_blogs_dark@2x.png" /></a></h1>{{end}}
|
{{if not .SingleUser}}<h1><a href="/me/c/" title="View blogs"><img class="ic-24dp" src="/img/ic_blogs_dark@2x.png" /></a></h1>{{end}}
|
||||||
<nav id="target" {{if .SingleUser}}style="margin-left:0"{{end}}><ul>
|
<nav id="target" {{if .SingleUser}}style="margin-left:0"{{end}}><ul>
|
||||||
{{if .Editing}}<li>{{if .EditCollection}}<a href="{{.EditCollection.CanonicalURL}}">{{.EditCollection.Title}}</a>{{else}}<a>Draft</a>{{end}}</li>
|
{{if .Editing}}<li>{{if .EditCollection}}<a href="{{.EditCollection.CanonicalURL}}">{{.EditCollection.Title}}</a>{{else}}<a>Draft</a>{{end}}</li>
|
||||||
{{else}}<li class="has-submenu"><a id="publish-to"><span id="target-name">Draft</span> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /></a>
|
{{else}}<li class="has-submenu"><a href="#" id="publish-to" onclick="return false"><span id="target-name">Draft</span> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /></a>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="menu-heading">Publish to...</li>
|
<li class="menu-heading">Publish to...</li>
|
||||||
{{if .Blogs}}{{range $idx, $el := .Blogs}}
|
{{if .Blogs}}{{range $idx, $el := .Blogs}}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
{{define "upgrade"}}
|
|
||||||
<p><a href="/me/plan?to=/me/c/{{.Alias}}">Upgrade</a> for <span>$40 / year</span> to edit.</p>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "collection"}}
|
{{define "collection"}}
|
||||||
{{template "header" .}}
|
{{template "header" .}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue