Skip to content

Commit

Permalink
Hide empty snippets in Slate
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Aug 22, 2023
1 parent beefe17 commit 3a7a26c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ogc/bblocks/templates/slate/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ title: ${bblock.name} (${bblock.itemClass.capitalize()})
'jsonld': 'JSON-LD',
}
langs = {lang_aliases.get(snippet['language'].lower(), snippet['language']): True
for example in bblock.examples for snippet in example.get('snippets', [])}
for example in bblock.examples for snippet in example.get('snippets', []) if snippet.get('code', '').strip()}
%>
% if len(langs) > 1:
language_tabs:
Expand Down Expand Up @@ -87,6 +87,8 @@ ${example['content'].replace('@@assets@@', assets_rel or '')}

%endif
% for snippet in example.get('snippets', []):
% if snippet.get('code', '').strip():

<%
snippet_lang = lang_aliases.get(snippet['language'].lower(), snippet['language'])
snippet_url = snippet.get('url')
Expand Down Expand Up @@ -114,6 +116,7 @@ ${snippet['code']}
</blockquote>

% endif
% endif
% endif

% endfor
Expand Down

0 comments on commit 3a7a26c

Please sign in to comment.