Skip to content

Commit

Permalink
Merge pull request #27 from DesignLiquido/25-subir-cobertura-de-códig…
Browse files Browse the repository at this point in the history
…o-para-45
  • Loading branch information
leonelsanchesdasilva authored Nov 8, 2023
2 parents be47f8a + d92e8eb commit 93a9c8d
Show file tree
Hide file tree
Showing 19 changed files with 673 additions and 334 deletions.
4 changes: 4 additions & 0 deletions .ambiente
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
chaveSecreta=MinhaChave
session=Falso
variavelTrue=verdadeiro
variavelFalse=falso
58 changes: 29 additions & 29 deletions infraestrutura/preprocessadores/foles.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
import { FolEs } from '@designliquido/foles';
import { XMLBuilder, XMLParser } from 'fast-xml-parser';

export class PreprocessadorFolEs {
leitorLmht: XMLParser;
construtorLmht: XMLBuilder;
foles: FolEs;
leitorLmht: XMLParser;
construtorLmht: XMLBuilder;
foles: FolEs;

constructor() {
this.leitorLmht = new XMLParser({
ignoreAttributes : false
});
this.construtorLmht = new XMLBuilder({
ignoreAttributes : false
});
this.foles = new FolEs(false);
}

processar(conteudoLmht: string): string {
const objetoVisao = this.leitorLmht.parse(conteudoLmht);
constructor() {
this.leitorLmht = new XMLParser({
ignoreAttributes: false
});
this.construtorLmht = new XMLBuilder({
ignoreAttributes: false
});
this.foles = new FolEs(false);
}

const cabeca = objetoVisao.lmht?.cabeca || objetoVisao.lmht?.cabeça;
if (cabeca) {
// Procurar por estrutura de estilo.
const estilo = cabeca.estilo;
if (estilo) {
const estiloConvertido = this.foles.converterTextoParaCss(estilo);
cabeca.style = estiloConvertido;
delete cabeca.estilo;
}
}
processar(conteudoLmht: string): string {
const objetoVisao = this.leitorLmht.parse(conteudoLmht);

const xmlContent = this.construtorLmht.build(objetoVisao);
return xmlContent;
const cabeca = objetoVisao.lmht?.cabeca || objetoVisao.lmht?.cabeça;
if (cabeca) {
// Procurar por estrutura de estilo.
const estilo = cabeca.estilo;
if (estilo) {
const estiloConvertido = this.foles.converterTextoParaCss(estilo);
cabeca.style = estiloConvertido;
delete cabeca.estilo;
}
}
}

const xmlContent = this.construtorLmht.build(objetoVisao);
return xmlContent;
}
}
Loading

0 comments on commit 93a9c8d

Please sign in to comment.