diff --git a/frontend/src/global/hbsPartials.ts b/frontend/src/global/hbsPartials.ts new file mode 100644 index 00000000..6fe5815c --- /dev/null +++ b/frontend/src/global/hbsPartials.ts @@ -0,0 +1,5 @@ +import Handlebars from 'handlebars/dist/handlebars.runtime'; + +import sparqlPreamble from '../sparql/query-templates/preamble-template'; + +Handlebars.registerPartial('sparqlPreamble', sparqlPreamble); diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 97666892..5e48ff2d 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -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'; diff --git a/frontend/src/sparql/query-templates/items-for-source-template.hbs b/frontend/src/sparql/query-templates/items-for-source-template.hbs index a9ee0641..4310b434 100644 --- a/frontend/src/sparql/query-templates/items-for-source-template.hbs +++ b/frontend/src/sparql/query-templates/items-for-source-template.hbs @@ -1,6 +1,4 @@ -{{#each namespaces}} -PREFIX {{label}}: <{{prefix}}> -{{/each}} +{{>sparqlPreamble}} PREFIX schema: PREFIX oa: CONSTRUCT { diff --git a/frontend/src/sparql/query-templates/preamble-template.hbs b/frontend/src/sparql/query-templates/preamble-template.hbs new file mode 100644 index 00000000..20cdbc82 --- /dev/null +++ b/frontend/src/sparql/query-templates/preamble-template.hbs @@ -0,0 +1,3 @@ +{{#each namespaces}} +PREFIX {{label}}: <{{prefix}}> +{{/each}} diff --git a/frontend/src/test-util.ts b/frontend/src/test-util.ts index afbc8bdb..5f0ca6bd 100644 --- a/frontend/src/test-util.ts +++ b/frontend/src/test-util.ts @@ -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'; /**