diff --git a/client/client b/client/client deleted file mode 100755 index 3b6cb21..0000000 Binary files a/client/client and /dev/null differ diff --git a/db/tasks.go b/db/tasks.go index b2d8396..09bd506 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -9,6 +9,7 @@ DeleteAll() import ( "database/sql" + "html/template" "log" "strconv" "strings" @@ -135,7 +136,7 @@ func GetTasks(username, status, category string) (types.Context, error) { task.CompletedMsg = strconv.Itoa(taskCompleted) + " complete out of " + strconv.Itoa(totalTasks) } - task.Content = string(md.Markdown([]byte(task.Content))) + task.ContentHTML = template.HTML(md.Markdown([]byte(task.Content))) // TaskContent = strings.Replace(TaskContent, "\n", "
", -1) if err != nil { log.Println(err) diff --git a/templates/home.html b/templates/home.html index 94e9590..70df0bb 100644 --- a/templates/home.html +++ b/templates/home.html @@ -59,7 +59,7 @@

- {{$value.Content}} + {{$value.ContentHTML}} {{$value.CompletedMsg}}
{{range $value.Comments}} diff --git a/types/types.go b/types/types.go index f9c6a7b..9fb1e29 100644 --- a/types/types.go +++ b/types/types.go @@ -1,22 +1,25 @@ package types +import "html/template" + /* Package types is used to store the context struct which is passed while templates are executed. */ //Task is the struct used to identify tasks type Task struct { - Id int `json:"id"` - Title string `json:"title"` - Content string `json:"content"` - Created string `json:"created"` - Priority string `json:"priority"` - Category string `json:"category"` - Referer string `json:"referer,omitempty"` - Comments []Comment `json:"comments,omitempty"` - IsOverdue bool `json:"isoverdue, omitempty"` - IsHidden int `json:"ishidden, omitempty` - CompletedMsg string `json:"ishidden, omitempty"` + Id int `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + ContentHTML template.HTML `json:"content_html"` + Created string `json:"created"` + Priority string `json:"priority"` + Category string `json:"category"` + Referer string `json:"referer,omitempty"` + Comments []Comment `json:"comments,omitempty"` + IsOverdue bool `json:"isoverdue, omitempty"` + IsHidden int `json:"ishidden, omitempty` + CompletedMsg string `json:"ishidden, omitempty"` } type Tasks []Task diff --git a/views/otherViews.go b/views/otherViews.go index ce0b6b9..b39b172 100644 --- a/views/otherViews.go +++ b/views/otherViews.go @@ -5,13 +5,13 @@ Holds the non insert/update/delete related view handlers */ import ( + "html/template" "io/ioutil" "log" "net/http" "os" "strconv" "strings" - "text/template" "github.com/thewhitetulip/Tasks/db" "github.com/thewhitetulip/Tasks/sessions" diff --git a/views/views.go b/views/views.go index 151b32e..52b773d 100644 --- a/views/views.go +++ b/views/views.go @@ -3,8 +3,8 @@ package views /*Holds the fetch related view handlers*/ import ( + "html/template" "net/http" - "text/template" "time" "github.com/thewhitetulip/Tasks/db"