Browse Source

editor: Move content pre/suffix to template string

main
J. Sims 8 months ago
parent
commit
39c81c6c98
  1. 6
      editor.hy

6
editor.hy

@ -20,7 +20,7 @@ This application will serve as a platform to edit and deploy posts.
;; all existing posts before being changed here.
(setv post-template
(Template ;"${title}\n${date}\n${summary}\n${content}"))
"{% if type == \"rss\" %}\n\t{% extends \"rss-item.xml\" %}\n{% else %}\n\t{% extends \"blog-post.html\" %}\n{% endif %}\n\n{% block title %}${title}{% endblock title %}\n{% block date %}${date}{% endblock date %}\n{% block summary %}\n\t${summary}{% endblock summary %}\n{% block content %}\n\t${content}\n{% endblock content %}"))
"{% if type == \"rss\" %}\n\t{% extends \"rss-item.xml\" %}\n{% else %}\n\t{% extends \"blog-post.html\" %}\n{% endif %}\n\n{% block title %}${title}{% endblock title %}\n{% block date %}${date}{% endblock date %}\n{% block summary %}\n\t${summary}{% endblock summary %}\n{% block content %}\n\t<p>\n\t\t${content}\t</p>\n{% endblock content %}"))
;; Setup top-level and main Frame
@ -73,9 +73,7 @@ This application will serve as a platform to edit and deploy posts.
;; split the string into paragraphs, delimited by `\n\n`,
;; and wrap them in HTML paragraph tags `<p></p>`
(defn process-content [raw-input]
(return (+ "<p>\n\t\t"
(.replace raw-input "\n\n" "\n\t</p>\n\t<p>\n\t\t")
"\t</p>")))
(return (.replace raw-input "\n\n" "\n\t</p>\n\t<p>\n\t\t")))
;; thunk
;; save the current contents of the editor then