ripgrep
datasette/docs/plugin_hooks.rst
79 You can now use this filter in your custom templates like so::
80
81 Table name: {{ table|uppercase }}
82
83
datasette/tests/test_plugins.py
531 async def test_hook_prepare_jinja2_environment(app_client):
532 template = app_client.ds.jinja_env.from_string(
533 "Hello there, {{ a|format_numeric }}", {"a": 3412341}
534 )
535 rendered = await app_client.ds.render_template(template)
datasette.io/templates/_directory.html
57 {% endif %}
58
59 {% if other_query_count %}<p style="font-size: 0.8em">See also <a href="/{{ other_table }}?q={{ args.q|urlencode }}">{{ other_query_count }} result{% if other_query_count != 1 %}s{% endif %}</a> in {{ other_table }}</p>{% endif %}
60
61 {% for row in sql(query, {"q": args["q"] or ""}, database="content") %}
datasette.io/templates/beta.html
84 {% for result in results %}
85 <div class="result" data-table-key="{{ result.type }}:{{ result.key }}">
86 {{ result.output|safe }}
87 </div>
88 {% endfor %}
datasette.io/templates/dogsheep-beta.yml
22 display: |-
23 <h3>Blog: <a href="{{ display.url }}">{{ title }}</a></h3>
24 <p>{{ display.snippet|safe }}</p>
25 <p><small>Published {{ timestamp }}</small></p>
26
56 display: |-
57 <h3>Docs: <a href="https://docs.datasette.io/en/latest/{{ display.page }}.html#{{ display.ref }}">{{ title }}</a></h3>
58 <p>{{ display.snippet.replace('b4de2a49c8', '<strong style="background-color: yellow">').replace('8c94a2ed4b', '</strong>')|safe }}</p>
59 content.db:
60 uses:
77 display: |-
78 <h3><a href="/{{ key.replace(".md", "") }}">{{ title }}</a></h3>
79 <p>{{ display.snippet|safe }}</p>
80 tools:
81 sql: |-
100 display: |-
101 <h3>Tool: <a href="/tools/{{ title }}">{{ title }}</a></h3>
102 <p>{{ display.snippet|safe }}</p>
103 {% if display.usesCustomOpenGraphImage %}
104 <p><img src="{{ display.openGraphImageUrl }}" alt="" style="max-width: 100%"></p>
127 display: |-
128 <h3>Plugin: <a href="/plugins/{{ title }}">{{ title }}</a></h3>
129 <p>{{ display.snippet|safe }}</p>
130 {% if display.usesCustomOpenGraphImage %}
131 <p><img src="{{ display.openGraphImageUrl }}" alt="" style="max-width: 100%"></p>
150 display: |-
151 <h3>Release: <a href="{{ display.html_url }}">{{ title }}</a></h3>
152 <p>{{ display.snippet|safe }}</p>
153 <p><small>Released {{ timestamp }}</small></p>
154 news:
176 display: |-
177 <h3><a href="/news/{{ key }}">{{ title }}</a></h3>
178 <p>{{ display.rendered_markdown|safe }}</p>
museums/templates/_museum_card.html
16 <h2>{{ museum.name }}</h2>
17 {% endif %}
18 {% if museum.distance_mi %}<p class="distance-away">{{ museum.distance_mi|round(2) }} miles away</p>{% endif %}
19 {{ render_markdown(museum.description) }}
20 {% if museum.url or museum.wikipedia_url %}
21 <p>{% if museum.url %}<a href="{{ museum.url }}">Website</a>{% endif %}{% if museum.url and museum.wikipedia_url %} | {% endif %}{% if museum.wikipedia_url %}<a href="{{ museum.wikipedia_url }}">Wikipedia</a>{% endif %}</p>
22 {% endif %}
23 {% if show_links and (press or photos) %}
24 <a><a href="/{{ museum.id }}{% if photos %}#photos{% else %}#press{% endif %}">{% if photos %}{{ photos|length }} photo{{ pluralize(photos|length) }}{% endif %}{% if photos and press %} and {% endif %}{% if press %}{{ press|length }} link{{ pluralize(press|length) }}{% endif %}</a></p>
25 {% endif %}
26 <address>{{ museum.address }} - <a href="https://www.google.com/maps/?q={{ museum.latitude }},{{ museum.longitude }}">Map</a></address>
til/django/extra-read-only-admin-information.md
33
34 ```html+jinja
35 <h2>{{ reporter }} has made {{ call_count }} call{{ call_count|pluralize }}</h2>
36
37 <p><strong>Recent calls</strong> (<a href="/admin/core/callreport/?reported_by__exact={{ reporter.id }}">view all</a>)</p>
til/templates/query-tils-search.html
59 {% for row in rows %}
60 <p><span class="topic">{{ row.topic }}</span> <a href="/{{ row.topic }}/{{ row.slug }}">{{ row.title }}</a> - {{ row.created[:10] }}</p>
61 <pre>{{ highlight(row.snippet)|safe }}</pre>
62 {% endfor %}
63
til/templates/row.html
24 <h1>{{ til.title }}</h1>
25
26 {{ til.html|safe }}
27
28 <p class="created">Created {{ til.created }}{% if til.created != til.updated %}, updated {{ til.updated }} · <a href="{{ til.url|replace("https://github.com/simonw/til/blob/", "https://github.com/simonw/til/commits/") }}">History</a>{% endif %} · <a href="{{ til.url }}">Edit</a></p>
29 {% endblock %}
datasette/datasette/templates/_description_source_license.html
2 <div class="metadata-description">
3 {% if metadata.description_html %}
4 {{ metadata.description_html|safe }}
5 {% else %}
6 {{ metadata.description }}
datasette/datasette/templates/_footer.html
1 Powered by <a href="https://datasette.io/" title="Datasette v{{ datasette_version }}">Datasette</a>
2 {% if query_ms %}· Query took {{ query_ms|round(3) }}ms{% endif %}
3 {% if metadata %}
4 {% if metadata.license or metadata.license_url %}· Data license:
datasette/datasette/templates/_table.html
5 <tr>
6 {% for column in display_columns %}
7 <th class="col-{{ column.name|to_css_class }}" scope="col" data-column="{{ column.name }}" data-column-type="{{ column.type }}" data-column-not-null="{{ column.notnull }}" data-is-pk="{% if column.is_pk %}1{% else %}0{% endif %}">
8 {% if not column.sortable %}
9 {{ column.name }}
23 <tr>
24 {% for cell in row %}
25 <td class="col-{{ cell.column|to_css_class }} type-{{ cell.value_type }}">{{ cell.value }}</td>
26 {% endfor %}
27 </tr>
datasette/datasette/templates/database.html
8 {% endblock %}
9
10 {% block body_class %}db db-{{ database|to_css_class }}{% endblock %}
11
12 {% block nav %}
49 <form class="sql" action="{{ urls.database(database) }}" method="get">
50 <h3>Custom SQL query</h3>
51 <p><textarea id="sql-editor" name="sql">{% if tables %}select * from {{ tables[0].name|escape_sqlite }}{% else %}select sqlite_version(){% endif %}</textarea></p>
52 <p>
53 <button id="sql-format" type="button" hidden>Format SQL</button>
86 <ul class="bullets">
87 {% for view in views %}
88 <li><a href="{{ urls.database(database) }}/{{ view.name|urlencode }}">{{ view.name }}</a>{% if view.private %} 🔒{% endif %}</li>
89 {% endfor %}
90 </ul>
datasette/datasette/templates/base.html
66 {% endfor %}
67
68 {% if select_templates %}<!-- Templates considered: {{ select_templates|join(", ") }} -->{% endif %}
69 </body>
70 </html>
datasette/datasette/templates/permissions_debug.html
46 {% endif %}
47 </h2>
48 <p><strong>Actor:</strong> {{ check.actor|tojson }}</p>
49 {% if check.resource %}
50 <p><strong>Resource:</strong> {{ check.resource }}</p>
datasette/datasette/templates/row.html
8 @media only screen and (max-width: 576px) {
9 {% for column in columns %}
10 .rows-and-columns td:nth-of-type({{ loop.index }}):before { content: "{{ column|escape_css_string }}"; }
11 {% endfor %}
12 }
14 {% endblock %}
15
16 {% block body_class %}row db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %}
17
18 {% block nav %}
datasette/datasette/templates/query.html
9 @media only screen and (max-width: 576px) {
10 {% for column in columns %}
11 .rows-and-columns td:nth-of-type({{ loop.index }}):before { content: "{{ column|escape_css_string }}"; }
12 {% endfor %}
13 }
17 {% endblock %}
18
19 {% block body_class %}query db-{{ database|to_css_class }}{% if canned_query %} query-{{ canned_query|to_css_class }}{% endif %}{% endblock %}
20
21 {% block nav %}
34
35 <form class="sql" action="{{ urls.database(database) }}{% if canned_query %}/{{ canned_query }}{% endif %}" method="{% if canned_write %}post{% else %}get{% endif %}">
36 <h3>Custom SQL query{% if display_rows %} returning {% if truncated %}more than {% endif %}{{ "{:,}".format(display_rows|length) }} row{% if display_rows|length == 1 %}{% else %}s{% endif %}{% endif %} <span class="show-hide-sql">{% if hide_sql %}(<a href="{{ path_with_removed_args(request, {'_hide_sql': '1'}) }}">show</a>){% else %}(<a href="{{ path_with_added_args(request, {'_hide_sql': '1'}) }}">hide</a>){% endif %}</span></h3>
37 {% if not hide_sql %}
38 {% if editable and allow_execute_sql %}
39 <p><textarea id="sql-editor" name="sql">{% if query and query.sql %}{{ query.sql }}{% else %}select * from {{ tables[0].name|escape_sqlite }}{% endif %}</textarea></p>
40 {% else %}
41 <pre id="sql-query">{% if query %}{{ query.sql }}{% endif %}</pre>
42 {% endif %}
43 {% else %}
44 <input type="hidden" name="sql" value="{% if query and query.sql %}{{ query.sql }}{% else %}select * from {{ tables[0].name|escape_sqlite }}{% endif %}">
45 <input type="hidden" name="_hide_sql" value="1">
46 {% endif %}
64 <thead>
65 <tr>
66 {% for column in columns %}<th class="col-{{ column|to_css_class }}" scope="col">{{ column }}</th>{% endfor %}
67 </tr>
68 </thead>
71 <tr>
72 {% for column, td in zip(columns, row) %}
73 <td class="col-{{ column|to_css_class }}">{{ td }}</td>
74 {% endfor %}
75 </tr>
datasette/datasette/templates/table.html
10 @media only screen and (max-width: 576px) {
11 {% for column in display_columns -%}
12 .rows-and-columns td:nth-of-type({{ loop.index }}):before { content: "{{ column.name|escape_css_string }}"; }
13 {% endfor %}}
14 </style>
15 {% endblock %}
16
17 {% block body_class %}table db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %}
18
19 {% block nav %}
119 {% if extra_wheres_for_ui %}
120 <div class="extra-wheres">
121 <h3>{{ extra_wheres_for_ui|length }} extra where clause{% if extra_wheres_for_ui|length != 1 %}s{% endif %}</h3>
122 <ul>
123 {% for extra_where in extra_wheres_for_ui %}
129
130 {% if query.sql and allow_execute_sql %}
131 <p><a class="not-underlined" title="{{ query.sql }}" href="{{ urls.database(database) }}?{{ {'sql': query.sql}|urlencode|safe }}{% if query.params %}&{{ query.params|urlencode|safe }}{% endif %}">✎ <span class="underlined">View and edit SQL</span></a></p>
132 {% endif %}
133
136 {% if suggested_facets %}
137 <p class="suggested-facets">
138 Suggested facets: {% for facet in suggested_facets %}<a href="{{ facet.toggle_url }}#facet-{{ facet.name|to_css_class }}">{{ facet.name }}</a>{% if facet.type %} ({{ facet.type }}){% endif %}{% if not loop.last %}, {% endif %}{% endfor %}
139 </p>
140 {% endif %}
147 <div class="facet-results">
148 {% for facet_info in sorted_facet_results %}
149 <div class="facet-info facet-{{ database|to_css_class }}-{{ table|to_css_class }}-{{ facet_info.name|to_css_class }}" id="facet-{{ facet_info.name|to_css_class }}">
150 <p class="facet-info-name">
151 <strong>{{ facet_info.name }}{% if facet_info.type != "column" %} ({{ facet_info.type }}){% endif %}</strong>
157 {% for facet_value in facet_info.results %}
158 {% if not facet_value.selected %}
159 <li><a href="{{ facet_value.toggle_url }}">{{ (facet_value.label | string()) or "-" }}</a> {{ "{:,}".format(facet_value.count) }}</li>
160 {% else %}
161 <li>{{ facet_value.label or "-" }} · {{ "{:,}".format(facet_value.count) }} <a href="{{ facet_value.toggle_url }}" class="cross">✖</a></li>
datasette/tests/test_templates/show_json.html
4 {{ super() }}
5 Test data for extra_template_vars:
6 <pre class="extra_template_vars">{{ extra_template_vars|safe }}</pre>
7 <pre class="extra_template_vars_from_awaitable">{{ extra_template_vars_from_awaitable|safe }}</pre>
8 <pre class="extra_from_awaitable_function">{{ query_database("select sqlite_version();") }}</pre>
9 {% endblock %}
datasette-column-inspect/datasette_column_inspect/templates/table.html
6 var sidepanel = null;
7 var table = "{{ table }}";
8 var base_path = "/{{ database|quote_plus }}";
9 var table_path = "/{{ database|quote_plus }}/{{ table|quote_plus }}";
10
11 var label_columns = [];
datasette-configure-fts/datasette_configure_fts/templates/configure_fts_database.html
24 <p>Configured for search across {{ ", ".join(table.searchable_columns) }}</p>
25 {% endif %}
26 <form action="/-/configure-fts/{{ database.name|quote_plus }}" method="POST">
27 {% for column in table.columns %}
28 <p><label><input
datasette-configure-fts/datasette_configure_fts/templates/configure_fts_index.html
22 <ul>
23 {% for database in databases %}
24 <li><a href="/-/configure-fts/{{ database.name|quote_plus }}">{{ database.name }}</a></li>
25 {% endfor %}
26 </ul>
datasette-copyable/datasette_copyable/templates/copyable.html
38 <a href="{{ base_url }}">home</a> /
39 <a href="{{ base_url }}{{ database }}">{{ database }}</a>{% if table %} /
40 <a href="{{ base_url }}{{ database }}/{{ table|quote_plus }}">{{ table }}</a>{% endif %}
41 </p>
42 {{ super() }}
datasette-edit-schema/datasette_edit_schema/templates/edit_schema_database.html
18
19 {% for table in tables %}
20 <h2><a href="/-/edit-schema/{{ database.name|quote_plus }}/{{ table.name|quote_plus }}">{{ table.name }}</a></h2>
21 <p>{% for column in table.columns %}{{ column.name }}{% if not loop.last %}, {% endif %}{% endfor %}</p>
22 {% endfor %}
datasette-edit-schema/datasette_edit_schema/templates/edit_schema_index.html
22 <ul>
23 {% for database in databases %}
24 <li><a href="/-/edit-schema/{{ database.name|quote_plus }}">{{ database.name }}</a></li>
25 {% endfor %}
26 </ul>
datasette-edit-schema/datasette_edit_schema/templates/edit_schema_table.html
80
81 {% block content %}
82 <h1>Edit table <a href="{{ base_url }}{{ database.name|quote_plus }}/{{ table|quote_plus }}">{{ database.name }}/{{ table }}</a></h1>
83
84 <form action="{{ base_url }}-/edit-schema/{{ database.name|quote_plus }}/{{ table|quote_plus }}" method="post">
85 <h2>Change existing columns</h2>
86 <ul class="sortable-columns">
112 <h2>Add a column</h2>
113
114 <form action="{{ base_url }}-/edit-schema/{{ database.name|quote_plus }}/{{ table|quote_plus }}" method="post">
115 <input type="hidden" name="csrftoken" value="{{ csrftoken() }}">
116 <input type="hidden" name="add_column" value="1">
127 <h2>Delete table</h2>
128
129 <form action="{{ base_url }}-/edit-schema/{{ database.name|quote_plus }}/{{ table|quote_plus }}" method="post">
130 <input type="hidden" name="csrftoken" value="{{ csrftoken() }}">
131 <input type="hidden" name="delete_table" value="1">
135 <h2>Rename table</h2>
136
137 <form action="{{ base_url }}-/edit-schema/{{ database.name|quote_plus }}/{{ table|quote_plus }}" method="post">
138 <input type="hidden" name="csrftoken" value="{{ csrftoken() }}">
139 <p><label>New name <input type="text" name="name"></label>
datasette-plugin-demos/datasette_plugin_demos/templates/show_json.html
8 <h1>Custom Template! {{ filename }}</h1>
9
10 <pre>{{ data|tojson(indent=4) }}</pre>
11
12 {% endblock %}
datasette-ripgrep/datasette_ripgrep/templates/ripgrep.html
68 {% endif %}
69 {% if result.type in ("match", "context") %}
70 <pre{% if result.type == "match" %} class="match"{% endif %}><a href="{{ urls.path("/-/ripgrep/view/" + url_quote(fix_path(result.data.path.text))) }}#L{{ result.data.line_number }}">{{ "%-4s" | format(result.data.line_number) }}</a> {{ result.data.lines.text }}</pre>
71 {% endif %}
72 {% if result.type == "end" %}{% set ns.ended = true %} </div>{% endif %}
datasette-ripgrep/datasette_ripgrep/templates/ripgrep_view_file.html
29
30 <pre>{% for i, line in lines -%}
31 <code id="L{{ i + 1 }}" data-line="{{ i + 1 }}">{{ line if line else " "|safe }}</code>
32 {% endfor %}</pre>
33
datasette-search-all/datasette_search_all/templates/index.html
5 <form action="{{ urls.path("/-/search") }}" method="get">
6 <p>
7 <input type="search" name="q" value="{{ q }}" placeholder="Search for records across {{ searchable_tables|length }} table{% if searchable_tables|length > 1 %}s{% endif %}" id="search-all-q">
8 <input type="submit" value="Search">
9 </p>
datasette-search-all/datasette_search_all/templates/search_all.html
53 <ul>
54 {% for searchable_table in searchable_tables %}
55 <li data-searchable-url="{{ searchable_table.url }}"><a href="{{ searchable_table.url }}?_search={{ q|urlencode }}">Search {{ searchable_table.database }}: {{ searchable_table.table }} for "{{ q }}"</a></li>
56 {% endfor %}
57 </ul>
62 <script>
63 var NUM_RESULTS = 5;
64 var searchable_tables = {{ searchable_tables_json|safe }};
65 var q = document.getElementById("search-all-q");
66 var search_results = document.getElementById("search-all-results");
datasette-tiles/datasette_tiles/templates/tiles_explorer.html
58 "minZoom": {{ min_zoom }},
59 "maxZoom": {{ max_zoom }}{% if attribution %},
60 "attribution": {{ attribution|safe }}{% endif %}
61 };
62 {% if not nojs %}
datasette-tiles/datasette_tiles/templates/tiles_stack_explorer.html
20 "minZoom": {{ min_zoom }},
21 "maxZoom": {{ max_zoom }}{% if attribution %},
22 "attribution": {{ attribution|safe }}{% endif %}
23 };
24 import('{{ datasette_leaflet_url }}')
datasette-upload-csvs/datasette_upload_csvs/templates/upload_csv_done.html
7
8 <p>Importing rows into
9 <a href="/{{ database|quote_plus }}/{{ table|quote_plus }}">{{ table }}</a>
10 </p>
11 {% endblock %}
dogsheep-beta/dogsheep_beta/templates/beta.html
84 {% for result in results %}
85 <div class="result" data-table-key="{{ result.type }}:{{ result.key }}">
86 {{ result.output|safe }}
87 </div>
88 {% endfor %}
register-of-members-interests-datasette/regmem-deploy/templates/_table.html
4 <tr>
5 {% for column in display_columns %}
6 <th class="col-{{ column.name|to_css_class }}" scope="col">
7 {% if not column.sortable %}
8 {{ column.name }}
23 {% for cell in row %}
24 {% if cell.column == "record_id" %}
25 <td class="col-{{ cell.column|to_css_class }} type-{{ cell.value_type }}"><a href="/regmem/items?_sort=sort_order&record_id__exact={{ cell.value }}">{{ cell.value }}</a></td>
26 {% else %}
27 <td class="col-{{ cell.column|to_css_class }} type-{{ cell.value_type }}">{{ cell.value }}</td>
28 {% endif %}
29 {% endfor %}
museums/templates/pages/{id}.html
86 {% endif %}
87 <h2><a href="/{{ museum.id }}">{{ museum.name }}</a></h2>
88 <p class="distance-away">{{ museum.distance_mi|round(2) }} miles away</p>
89 </div>
90 </div>
datasette.io/templates/pages/for/{slug}.html
27 <h1>{{ page.title }}</h1>
28
29 {{ page.html|safe }}
30
31 <h3>More uses for Datasette</h3>
datasette.io/templates/pages/plugins/{name}.html
92 <h2>README</h2>
93 <div class="plugin">
94 {{ plugin.readme_html|safe }}
95 </div>
96 {% endif %}
datasette.io/templates/pages/tools/{name}.html
92 <h2>README</h2>
93 <div class="plugin">
94 {{ tool.readme_html|safe }}
95 </div>
96 {% endif %}
til/templates/pages/{topic}/{slug}.html
33 <h1>{{ til.title }}</h1>
34
35 {{ til.html|safe }}
36
37 <p class="created">Created {{ til.created }}{% if til.created != til.updated %}, updated {{ til.updated }} · <a href="{{ til.url|replace("https://github.com/simonw/til/blob/", "https://github.com/simonw/til/commits/") }}">History</a>{% endif %} · <a href="{{ til.url }}">Edit</a></p>
38 {% endblock %}