mirror of
https://github.com/go-shiori/shiori.git
synced 2025-12-17 14:19:12 +08:00
Convert template.HTML to string
This commit is contained in:
parent
8b31568eaf
commit
b16c5cc363
3 changed files with 14 additions and 18 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
|
||||||
nurl "net/url"
|
nurl "net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -81,7 +80,7 @@ func addBookmark(base model.Bookmark, offline bool) (book model.Bookmark, err er
|
||||||
book.MinReadTime = article.Meta.MinReadTime
|
book.MinReadTime = article.Meta.MinReadTime
|
||||||
book.MaxReadTime = article.Meta.MaxReadTime
|
book.MaxReadTime = article.Meta.MaxReadTime
|
||||||
book.Content = article.Content
|
book.Content = article.Content
|
||||||
book.HTML = template.HTML(article.RawContent)
|
book.HTML = article.RawContent
|
||||||
|
|
||||||
if book.Title == "" {
|
if book.Title == "" {
|
||||||
book.Title = article.Meta.Title
|
book.Title = article.Meta.Title
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -121,7 +120,7 @@ func updateBookmarks(indices []string, url, title, excerpt string, tags []string
|
||||||
book.MinReadTime = article.Meta.MinReadTime
|
book.MinReadTime = article.Meta.MinReadTime
|
||||||
book.MaxReadTime = article.Meta.MaxReadTime
|
book.MaxReadTime = article.Meta.MaxReadTime
|
||||||
book.Content = article.Content
|
book.Content = article.Content
|
||||||
book.HTML = template.HTML(article.RawContent)
|
book.HTML = article.RawContent
|
||||||
|
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
bookmarks[pos] = book
|
bookmarks[pos] = book
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import "html/template"
|
|
||||||
|
|
||||||
// Tag is tag for the bookmark
|
// Tag is tag for the bookmark
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
ID int64 `db:"id" json:"id"`
|
ID int64 `db:"id" json:"id"`
|
||||||
|
|
@ -11,18 +9,18 @@ type Tag struct {
|
||||||
|
|
||||||
// Bookmark is record of a specified URL
|
// Bookmark is record of a specified URL
|
||||||
type Bookmark struct {
|
type Bookmark struct {
|
||||||
ID int64 `db:"id" json:"id"`
|
ID int64 `db:"id" json:"id"`
|
||||||
URL string `db:"url" json:"url"`
|
URL string `db:"url" json:"url"`
|
||||||
Title string `db:"title" json:"title"`
|
Title string `db:"title" json:"title"`
|
||||||
ImageURL string `db:"image_url" json:"imageURL"`
|
ImageURL string `db:"image_url" json:"imageURL"`
|
||||||
Excerpt string `db:"excerpt" json:"excerpt"`
|
Excerpt string `db:"excerpt" json:"excerpt"`
|
||||||
Author string `db:"author" json:"author"`
|
Author string `db:"author" json:"author"`
|
||||||
MinReadTime int `db:"min_read_time" json:"minReadTime"`
|
MinReadTime int `db:"min_read_time" json:"minReadTime"`
|
||||||
MaxReadTime int `db:"max_read_time" json:"maxReadTime"`
|
MaxReadTime int `db:"max_read_time" json:"maxReadTime"`
|
||||||
Modified string `db:"modified" json:"modified"`
|
Modified string `db:"modified" json:"modified"`
|
||||||
Content string `db:"content" json:"-"`
|
Content string `db:"content" json:"-"`
|
||||||
HTML template.HTML `db:"html" json:"-"`
|
HTML string `db:"html" json:"-"`
|
||||||
Tags []Tag `json:"tags"`
|
Tags []Tag `json:"tags"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account is account for accessing bookmarks from web interface
|
// Account is account for accessing bookmarks from web interface
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue