-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update editor to rdfa-backwards-compatibility build (#395)
* wip: update editor * update editor to latest dev commit * update nodes to use rdfa-attr-spec function * update dummy pages to use rdfa-aware nodes * enable rdfa-awareness on regulatory statement doc node-spec * lint: remove unused imports * lint: prettier * make links in dummy pages rdfa-aware * feat(citation-plugin): update citation plugin to work with rdfa-aware link nodes * fix invisible_rdfa typo * enable rdfa-awareness on besluit-editable-nodes doc node-spec * use full uris when inserting/removing decision type properties * fix issue with toDOM of besluit_articel_structure node-spec * chore: bump editor to latest release * fix: revert dummy app route back to js --------- Co-authored-by: abeforgit <[email protected]>
- Loading branch information
Showing
24 changed files
with
420 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,48 @@ | ||
import { PNode } from '@lblod/ember-rdfa-editor'; | ||
import { CitationSchema } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin'; | ||
import { | ||
ELI, | ||
RDF, | ||
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants'; | ||
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option'; | ||
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory'; | ||
|
||
export function citedText( | ||
schema: CitationSchema, | ||
title: string, | ||
uri: string, | ||
): PNode { | ||
return unwrap(schema.nodes.link).create( | ||
{ | ||
href: uri, | ||
property: 'eli:cites', | ||
typeof: 'eli:LegalExpression', | ||
}, | ||
[schema.text(title)], | ||
); | ||
const linkType = unwrap(schema.nodes.link); | ||
const linkSpec = linkType.spec; | ||
if (linkSpec.attrs && linkSpec.attrs['properties']) { | ||
// Link node-spec is RDFa-aware | ||
return linkType.create( | ||
{ | ||
href: uri, | ||
subject: uri, | ||
rdfaNodeType: 'resource', | ||
properties: [ | ||
{ | ||
predicate: RDF('type').full, | ||
object: sayDataFactory.namedNode(ELI('LegalExpression').full), | ||
}, | ||
{ | ||
predicate: ELI('cites').full, | ||
object: sayDataFactory.contentLiteral(), | ||
}, | ||
], | ||
}, | ||
schema.text(title), | ||
); | ||
} else { | ||
// Link node-spec uses classic RDFa | ||
return linkType.create( | ||
{ | ||
href: uri, | ||
property: 'eli:cites', | ||
typeof: 'eli:LegalExpression', | ||
}, | ||
[schema.text(title)], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.