Skip to content

Commit

Permalink
Update changelog, replace em units in a class, update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davivcu committed Feb 20, 2024
1 parent 46d2799 commit 89006ec
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
-

## [1.0.0-alpha] - 2022-12-07
## [1.0.0-alpha] - 2024-02-20

### Dependency Updates
- Updated to Angular 13
Expand Down Expand Up @@ -87,6 +87,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Named entities visualisation
- Named entities extraction
- OpenSeadragon component with support for manifest file
- Analogues and sources extraction and configuration
- Analogues and sources visualization

### Changed
- Routing params keys
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/sources/sources.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

.source-quote-symbol {
font-size: 1em;
font-size: 1rem;
color: #263238;
margin: 0;
padding: 0 0.3rem 0 0;
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/xml-parsers/analogue-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { BasicParser } from './quotes-parser';

@xmlParser('evt-analogue-entry-parser', AnalogueParser)
export class AnalogueParser extends BasicParser implements Parser<XMLElement> {

elementParser = createParser(GenericElemParser, parse);
attributeParser = createParser(AttributeParser, this.genericParse);
biblParser = createParser(BibliographyParser, this.genericParse);
Expand Down Expand Up @@ -37,7 +36,7 @@ export class AnalogueParser extends BasicParser implements Parser<XMLElement> {

return {
type: Analogue,
id: (notableElements.includes(analogue.tagName)) ? 'EVT-ANG:'+getID(analogue) : getID(analogue),
id: (notableElements.includes(analogue.tagName)) ? 'EVT-ANALOGUE:' + getID(analogue) : getID(analogue),
class: AnalogueClass,
attributes: this.attributeParser.parse(analogue),
text: normalizeSpaces(chainFirstChildTexts(analogue, this.evtTextComplexElements, this.evtInnerTextElements)),
Expand Down Expand Up @@ -107,6 +106,7 @@ export class AnalogueParser extends BasicParser implements Parser<XMLElement> {
return ppElements.concat(addendum.flat());
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private getQuotedTextFromSources(nodes: BibliographicEntry[]): any {
let quotesInSources = [];
nodes.forEach((el: BibliographicEntry|BibliographicList) => {
Expand Down
2 changes: 2 additions & 0 deletions src/app/services/xml-parsers/bilbliography-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class BibliographyParser extends BasicParser implements Parser<XMLElement
return null;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
parse(xml: XMLElement): any {

switch (xml.tagName) {
Expand Down Expand Up @@ -89,6 +90,7 @@ export class BibliographyParser extends BasicParser implements Parser<XMLElement
originalEncoding: xml,
};
default:
// it should never reach here but we don't want risking to not parse an element anyway...
return this.elementParser.parse(xml)
}
}
Expand Down
31 changes: 12 additions & 19 deletions src/app/services/xml-parsers/quotes-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ export class BasicParser {
constructor(parseFn: ParseFn) { this.genericParse = parseFn; }
}

/**
* It manages note, cit, ref, seg, div, p, l, lb, ptr elements
* sent on redirect from other parsers if detected as 'sources'
*/
@xmlParser('quote', QuoteParser)
//@xmlParser('note', QuoteParser) on redirect from their parser
//@xmlParser('cit', QuoteParser)
//@xmlParser('ref', QuoteParser)
//@xmlParser('seg', QuoteParser)
//@xmlParser('div', QuoteParser)
//@xmlParser('p', QuoteParser) "
//@xmlParser('l', QuoteParser) "
//@xmlParser('lb', QuoteParser) "
//@xmlParser('ptr', QuoteParser) "
@xmlParser('evt-quote-entry-parser', QuoteParser)
export class QuoteParser extends BasicParser implements Parser<XMLElement> {
elementParser = createParser(GenericElemParser, this.genericParse);
Expand Down Expand Up @@ -60,8 +55,7 @@ export class QuoteParser extends BasicParser implements Parser<XMLElement> {
case 'lg':
case 'l':
case 'note':
// if they are not a source send them to their parse
// otherwise create a note
// if they are not a source send them to their parse otherwise create a note
if (notSource) {
return ParserRegister.get(quote.tagName).parse(quote) as Paragraph|VersesGroup|Verse|Note;
}
Expand All @@ -78,17 +72,15 @@ export class QuoteParser extends BasicParser implements Parser<XMLElement> {

return divElement;
case 'ptr':
// if it's not a source send it to its parse
// otherwise parse here
// if it's not a source send it to its parse, otherwise it will be parsed here later
if (notSource) {
return ParserRegister.get(quote.tagName).parse(quote) as Ptr;
}
break;
case 'ref':
case 'seg':
case 'cit':
// if they are not a source create a generic element
// otherwise parse here
// if they are not a source create a generic element, otherwise it will be parsed here later
if (notSource) {
return ParserRegister.get('evt-generic-elem-parser').parse(quote) as GenericElement;
}
Expand Down Expand Up @@ -165,7 +157,7 @@ export class QuoteParser extends BasicParser implements Parser<XMLElement> {


/**
* Retrieve attributes linked to external bibl/listBibl/cit elements
* Retrieve attributes linked to external bibl, listBibl, cit elements
*/
private findExtRef(quote: XMLElement, isInCitElem: boolean): XMLElement {
const target = (isInCitElem) ? quote.parentElement : quote;
Expand All @@ -180,8 +172,9 @@ export class QuoteParser extends BasicParser implements Parser<XMLElement> {
/**
* Retrieve and send to the proper parsing all bibliography elements inside the quote element
* @param quote XMLElement
* @returns array of Bibliography Element or a single Bibliography List element
* @returns array of XML Elements
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private getInsideSources(quote: XMLElement, isInCit: boolean): { sources:any, analogues:any } {
const prsRg = {
bibl: this.biblParser,
Expand Down Expand Up @@ -289,7 +282,7 @@ export class QuoteParser extends BasicParser implements Parser<XMLElement> {
return quotesInSources;
}

private createNote(quote: XMLElement) {
private createNote(quote: XMLElement): QuoteEntry {
// const sources = this.getInsideSources(quote, false);
// not parsing inside sources, they will be parsed anyway
const isCit = ((quote.tagName === 'cit') || (quote.tagName === 'note'));
Expand All @@ -299,7 +292,7 @@ export class QuoteParser extends BasicParser implements Parser<XMLElement> {

return <QuoteEntry> {
type: QuoteEntry,
id: 'EVT-SRC:' + getID(quote),
id: 'EVT-SOURCE:' + getID(quote),
tagName: quote.tagName,
attributes: this.attributeParser.parse(quote),
text: normalizeSpaces(this.getQuotedTextInside(quote, isCit, isDiv)),
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/xml-parsers/source-entries-parser.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class SourceEntriesParserService {
const quoteParser = ParserRegister.get('evt-quote-entry-parser');

return [
Array.from(document.querySelectorAll<XMLElement>(`.${SourceClass}`))
.map((srcEntry) => quoteParser.parse(srcEntry) as QuoteEntry),
Array.from(document.querySelectorAll<XMLElement>(`.${SourceClass}`))
.map((srcEntry) => quoteParser.parse(srcEntry) as QuoteEntry),
];
}
}

0 comments on commit 89006ec

Please sign in to comment.