diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d95194ed..599eb1080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated to Angular 9 ### Added +- Deletion vizualization - Verses group visualization - Multiple line words normalization in interpretative and critical edition - Word visualization diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d0a9ab53b..dda75520b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -27,6 +27,7 @@ import { CharComponent } from './components/char/char.component'; import { ChoiceComponent } from './components/choice/choice.component'; import { ContentViewerComponent } from './components/content-viewer/content-viewer.component'; import { DamageComponent } from './components/damage/damage.component'; +import { DeletionComponent } from './components/deletion/deletion.component'; import { EditionLevelSelectorComponent } from './components/edition-level-selector/edition-level-selector.component'; import { EntitiesSelectComponent } from './components/entities-select/entities-select.component'; import { GComponent } from './components/g/g.component'; @@ -101,6 +102,7 @@ export function initializeApp(appConfig: AppConfig) { CollationComponent, ContentViewerComponent, DamageComponent, + DeletionComponent, EditionLevelSelectorComponent, EditorialConventionLayoutDirective, EntitiesSelectComponent, diff --git a/src/app/components/deletion/deletion.component.html b/src/app/components/deletion/deletion.component.html new file mode 100644 index 000000000..23646d136 --- /dev/null +++ b/src/app/components/deletion/deletion.component.html @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/src/app/components/deletion/deletion.component.scss b/src/app/components/deletion/deletion.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/components/deletion/deletion.component.spec.ts b/src/app/components/deletion/deletion.component.spec.ts new file mode 100644 index 000000000..f4c2ccb4e --- /dev/null +++ b/src/app/components/deletion/deletion.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DeletionComponent } from './deletion.component'; + +describe('DeletionComponent', () => { + let component: DeletionComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DeletionComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DeletionComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/deletion/deletion.component.ts b/src/app/components/deletion/deletion.component.ts new file mode 100644 index 000000000..e3f709d4d --- /dev/null +++ b/src/app/components/deletion/deletion.component.ts @@ -0,0 +1,27 @@ +import { Component, Input } from '@angular/core'; + +import { EditorialConventionLayoutData } from '../../directives/editorial-convention-layout.directive'; +import { Deletion } from '../../models/evt-models'; +import { register } from '../../services/component-register.service'; +import { EditionlevelSusceptible, Highlightable } from '../components-mixins'; + +export interface DeletionComponent extends EditionlevelSusceptible, Highlightable { } + +@register(Deletion) +@Component({ + selector: 'evt-deletion', + templateUrl: './deletion.component.html', + styleUrls: ['./deletion.component.scss'], +}) +export class DeletionComponent { + @Input() data: Deletion; + + get editorialConventionData(): EditorialConventionLayoutData { + return { + name: 'del', + attributes: this.data.attributes, + editionLevel: this.editionLevel, + defaultsKey: 'deletion', + }; + } +} diff --git a/src/app/models/evt-models.ts b/src/app/models/evt-models.ts index b6e216367..00a3cda25 100644 --- a/src/app/models/evt-models.ts +++ b/src/app/models/evt-models.ts @@ -327,3 +327,7 @@ export class Sic extends GenericElement { export class Word extends GenericElement { lemma?: string; } + +export class Deletion extends GenericElement { + rend: string; +} diff --git a/src/app/services/editorial-conventions.service.ts b/src/app/services/editorial-conventions.service.ts index 9bbf6804d..ed973264b 100644 --- a/src/app/services/editorial-conventions.service.ts +++ b/src/app/services/editorial-conventions.service.ts @@ -5,7 +5,7 @@ import { EditorialConvention, EditorialConventionLayouts } from '../models/evt-m // List of handled editorial convention export type EditorialConventionDefaults = 'addition' | 'additionAbove' | 'additionBelow' | 'additionInline' | 'additionLeft' | 'additionRight' | - 'damage' | 'sicCrux' | 'surplus'; + 'damage' | 'deletion' | 'sicCrux' | 'surplus'; @Injectable({ providedIn: 'root', @@ -90,6 +90,18 @@ export class EditorialConventionsService { }, }, }, + deletion: { + diplomatic: { + style: { + 'background-color': '#fdd3d1', + 'text-decoration': 'line-through', + }, + }, + interpretative: { + pre: '[[', + post: ']]', + }, + }, sicCrux: { diplomatic: { pre: '†', diff --git a/src/app/services/xml-parsers/basic-parsers.ts b/src/app/services/xml-parsers/basic-parsers.ts index 0e04ce5bd..e46b57fd2 100644 --- a/src/app/services/xml-parsers/basic-parsers.ts +++ b/src/app/services/xml-parsers/basic-parsers.ts @@ -1,6 +1,6 @@ import { AttributesMap } from 'ng-dynamic-component'; import { - Addition, Attributes, Damage, Gap, GenericElement, Lb, Note, NoteLayout, + Addition, Attributes, Damage, Deletion, Gap, GenericElement, Lb, Note, NoteLayout, Paragraph, PlacementType, Supplied, Text, Verse, VersesGroup, Word, XMLElement, } from '../../models/evt-models'; import { isNestedInElem, xpath } from '../../utils/dom-utils'; @@ -256,3 +256,18 @@ export class WordParser extends EmptyParser implements Parser { }; } } + +export class DeletionParser extends EmptyParser implements Parser { + elementParser = createParser(ElementParser, this.genericParse); + attributeParser = createParser(AttributeParser, this.genericParse); + parse(xml: XMLElement): Deletion { + return { + type: Deletion, + rend: xml.getAttribute('rend'), + path: xpath(xml), + content: parseChildren(xml, this.genericParse), + attributes: this.attributeParser.parse(xml), + class: xml.tagName.toLowerCase(), + }; + } +} diff --git a/src/app/services/xml-parsers/index.ts b/src/app/services/xml-parsers/index.ts index db92d8812..6cddb9b4f 100644 --- a/src/app/services/xml-parsers/index.ts +++ b/src/app/services/xml-parsers/index.ts @@ -1,7 +1,7 @@ import { Comment, GenericElement, HTML, XMLElement } from '../../models/evt-models'; import { AppParser, RdgParser } from './app-parser'; import { - AdditionParser, DamageParser, ElementParser, GapParser, LBParser, NoteParser, ParagraphParser, + AdditionParser, DamageParser, DeletionParser, ElementParser, GapParser, LBParser, NoteParser, ParagraphParser, PtrParser, SuppliedParser, TextParser, VerseParser, VersesGroupParser, WordParser, } from './basic-parsers'; import { CharParser, GlyphParser, GParser } from './character-declarations-parser'; @@ -14,7 +14,7 @@ import { } from './named-entity-parsers'; import { createParser, Parser, ParseResult } from './parser-models'; -type SupportedTagNames = 'add' | 'app' | 'char' | 'choice' | 'damage' | 'event' | 'g' | 'gap' | 'geogname' | 'glyph' | 'graphic' | 'l' | 'lb' | +type SupportedTagNames = 'add' | 'app' | 'char' | 'choice' | 'damage' | 'del' | 'event' | 'g' | 'gap' | 'geogname' | 'glyph' | 'graphic' | 'l' | 'lb' | 'lem' | 'lg' | 'note' | 'orgname' | 'p' | 'persname' | 'placename' | 'ptr' | 'person' | 'personGrp' | 'place' | 'org' | 'rdg' | 'sic' | 'surface' | 'supplied' | 'surplus' | 'w' | 'zone'; @@ -24,6 +24,7 @@ export const parseF: { [T in SupportedTagNames]: Parser } = { char: createParser(CharParser, parse), choice: createParser(ChoiceParser, parse), damage: createParser(DamageParser, parse), + del: createParser(DeletionParser, parse), event: createParser(NamedEntityRefParser, parse), g: createParser(GParser, parse), gap: createParser(GapParser, parse),