diff --git a/src/parsers/directive.parser.ts b/src/parsers/directive.parser.ts index c7114ea..d61da53 100644 --- a/src/parsers/directive.parser.ts +++ b/src/parsers/directive.parser.ts @@ -2,7 +2,9 @@ import { ParserInterface } from './parser.interface'; import { AbstractTemplateParser } from './abstract-template.parser'; import { TranslationCollection } from '../utils/translation.collection'; -import * as $ from 'cheerio'; +import * as cheerio from 'cheerio'; + +const $ = cheerio.load('', {xmlMode: true}); export class DirectiveParser extends AbstractTemplateParser implements ParserInterface { diff --git a/tests/parsers/directive.parser.spec.ts b/tests/parsers/directive.parser.spec.ts index 3ce777a..c1050f4 100644 --- a/tests/parsers/directive.parser.spec.ts +++ b/tests/parsers/directive.parser.spec.ts @@ -118,4 +118,10 @@ describe('DirectiveParser', () => { expect(template).to.equal('

Hello World

'); }); + it('should extract contents from within custom tags', () => { + const contents = `Hello World`; + const keys = parser.extract(contents, templateFilename).keys(); + expect(keys).to.deep.equal(['Hello World']); + }); + });