markdown on note
This commit is contained in:
parent
c24f2cb9db
commit
93184589bf
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"owl-blogs/test"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestMediaWithSpace(t *testing.T) {
|
||||
db := test.NewMockDb()
|
||||
owlApp := App(db)
|
||||
app := owlApp.FiberApp
|
||||
|
||||
_, err := owlApp.BinaryService.Create("name with space.jpg", []byte("111"))
|
||||
require.NoError(t, err)
|
||||
|
||||
req := httptest.NewRequest("GET", "/media/name%20with%20space.jpg", nil)
|
||||
resp, err := app.Test(req)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 200, resp.StatusCode)
|
||||
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
package entrytypes
|
||||
|
||||
import "owl-blogs/domain/model"
|
||||
import (
|
||||
"fmt"
|
||||
"owl-blogs/domain/model"
|
||||
"owl-blogs/render"
|
||||
)
|
||||
|
||||
type Note struct {
|
||||
model.EntryBase
|
||||
|
@ -16,7 +20,11 @@ func (e *Note) Title() string {
|
|||
}
|
||||
|
||||
func (e *Note) Content() model.EntryContent {
|
||||
return model.EntryContent(e.meta.Content)
|
||||
str, err := render.RenderTemplateToString("entry/Note", e)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
return model.EntryContent(str)
|
||||
}
|
||||
|
||||
func (e *Note) MetaData() interface{} {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{{.MetaData.Content | markdown }}
|
|
@ -1 +1 @@
|
|||
{{.MetaData.Content}}
|
||||
{{.MetaData.Content | markdown }}
|
||||
|
|
Loading…
Reference in New Issue