Skip to content

Commit

Permalink
Factor out common hbs partial for the SPARQL preamble (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed May 25, 2021
1 parent 3de323f commit 2131032
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions frontend/src/global/hbsPartials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Handlebars from 'handlebars/dist/handlebars.runtime';

import sparqlPreamble from '../sparql/query-templates/preamble-template';

Handlebars.registerPartial('sparqlPreamble', sparqlPreamble);
1 change: 1 addition & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import './global/scroll-easings';
import { i18nPromise } from './global/i18n';
import './global/internalLinks';
import './global/hbsHelpers';
import './global/hbsPartials';
import user from './global/user';
import { prefetch } from './global/ld-store';
import './global/item-cache';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{#each namespaces}}
PREFIX {{label}}: <{{prefix}}>
{{/each}}
{{>sparqlPreamble}}
PREFIX schema: <http://schema.org/>
PREFIX oa: <http://www.w3.org/ns/oa#>
CONSTRUCT {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/sparql/query-templates/preamble-template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#each namespaces}}
PREFIX {{label}}: <{{prefix}}>
{{/each}}
1 change: 1 addition & 0 deletions frontend/src/test-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Events } from 'backbone';

import Store from './common-rdf/store';
import './global/hbsHelpers';
import './global/hbsPartials';
import { i18nPromise } from './global/i18n';

/**
Expand Down

0 comments on commit 2131032

Please sign in to comment.