Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse only article also from templates #490

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mighty-mice-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lblod/ember-rdfa-editor-lblod-plugins': patch
---

parse articles also from templates
5 changes: 4 additions & 1 deletion addon/plugins/structure-plugin/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
`span[property~='${ELI('number').prefixed}'],
span[property~='${ELI('number').full}']`,
);
const isOnlyArticle =
node.dataset.sayIsOnlyArticle &&
node.dataset.sayIsOnlyArticle !== 'false';
const number = numberNode?.textContent
? parseInt(numberNode.textContent, 10)
: 1;
Expand All @@ -274,7 +277,7 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
structureType: 'article',
displayStructureName: true,
hasTitle: false,
isOnlyArticle: false,
isOnlyArticle,
number,
};
}
Expand Down
6 changes: 3 additions & 3 deletions tests/dummy/app/controllers/besluit-sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export default class BesluitSampleController extends Controller {
<h5>Beslissing</h5>

<div property="prov:value" datatype="xsd:string">
<div property="eli:has_part" resource="http://data.lblod.info/artikels/\${generateUuid()}" typeof="besluit:Artikel">
<div property="eli:has_part" resource="http://data.lblod.info/artikels/\${generateUuid()}" typeof="besluit:Artikel" data-say-is-only-article="true">
<div>Artikel <span property="eli:number" datatype="xsd:string">1</span></div>
<span style="display:none;" property="eli:language" resource="http://publications.europa.eu/resource/authority/language/NLD" typeof="skos:Concept">&nbsp;</span>
<div property="prov:value" datatype="xsd:string">
Expand Down Expand Up @@ -518,7 +518,7 @@ export default class BesluitSampleController extends Controller {

<p class="u-spacer--small">Beslist,</p>
<div property="prov:value" datatype="xsd:string">
<div property="eli:has_part" resource="http://data.lblod.info/artikels/\${generateUuid()}" typeof="besluit:Artikel">
<div property="eli:has_part" resource="http://data.lblod.info/artikels/\${generateUuid()}" typeof="besluit:Artikel" data-say-is-only-article="true">
<div>Artikel <span property="eli:number" datatype="xsd:string">1</span></div>
<span style="display:none;" property="eli:language" resource="http://publications.europa.eu/resource/authority/language/NLD" typeof="skos:Concept">&nbsp;</span>
<div property="prov:value" datatype="xsd:string"><span class="mark-highlight-manual">Voer inhoud in</span></div>
Expand Down Expand Up @@ -563,7 +563,7 @@ export default class BesluitSampleController extends Controller {
<br />
<h5>Beslissing</h5>
<div property="prov:value" datatype="xsd:string">
<div property="eli:has_part" resource="http://data.lblod.info/artikels/\${generateUuid()}" typeof="besluit:Artikel">
<div property="eli:has_part" resource="http://data.lblod.info/artikels/\${generateUuid()}" typeof="besluit:Artikel" data-say-is-only-article="true">
<div>Artikel <span property="eli:number" datatype="xsd:string">1</span></div>
<span style="display: none;" property="eli:language" resource="http://publications.europa.eu/resource/authority/language/NLD" typeof="skos:Concept">&nbsp;</span>
<div property="prov:value" datatype="xsd:string"><span class="mark-highlight-manual">Voer inhoud in</span></div>
Expand Down