Skip to content
Permalink
Browse files

Render paragraphs in feeds, closes #15

  • Loading branch information
simonw committed Dec 18, 2019
1 parent 510c018 commit 4477306ce8f4913d0912d53ef10b4fd803d2eb89
Showing with 9 additions and 1 deletion.
  1. +1 −1 metadata.json
  2. +8 −0 plugins/sql_functions.py
@@ -4,7 +4,7 @@
"browse": {
"queries": {
"nearby": "select *, haversine(latitude, longitude, cast(:latitude as real), cast(:longitude as real), 'mi') as distance_mi\nfrom museums order by distance_mi",
"feed": "select\n 'tag:niche-museums.com,' || substr(created, 0, 11) || ':' || id as atom_id,\n name as atom_title,\n created as atom_updated,\n 'https://www.niche-museums.com/browse/museums/' || id as atom_link,\n coalesce(\n '<img src=\"' || photo_url || '?w=800&amp;h=400&amp;fit=crop&amp;auto=compress\">',\n ''\n ) || '<p>' || description || '</p>' as atom_content_html\nfrom\n museums\norder by\n created desc\nlimit\n 15",
"feed": "select\n 'tag:niche-museums.com,' || substr(created, 0, 11) || ':' || id as atom_id,\n name as atom_title,\n created as atom_updated,\n 'https://www.niche-museums.com/browse/museums/' || id as atom_link,\n coalesce(\n '<img src=\"' || photo_url || '?w=800&amp;h=400&amp;fit=crop&amp;auto=compress\">',\n ''\n ) || render_markdown(description) as atom_content_html\nfrom\n museums\norder by\n created desc\nlimit\n 15",
"search": "select\n museums_fts.rank,\n museums.*\nfrom\n museums\n join museums_fts on museums.id = museums_fts.rowid\nwhere\n museums_fts match case\n :q\n when '' then '*'\n else :q\n end\norder by\n museums_fts.rank"
}
}
@@ -0,0 +1,8 @@
from datasette import hookimpl
from datasette_render_markdown import render_markdown
import json


@hookimpl
def prepare_connection(conn):
conn.create_function("render_markdown", 1, render_markdown)

0 comments on commit 4477306

Please sign in to comment.
You can’t perform that action at this time.