0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 23:42:41 +00:00

Passes all tests

This commit is contained in:
Trevor Buckner
2024-05-03 14:31:34 -04:00
parent 1a33e6e631
commit 193cde0925
2 changed files with 6 additions and 3 deletions

View File

@@ -218,13 +218,16 @@ const mustacheInjectInline = {
lastToken.type = 'mustacheInjectInline'; lastToken.type = 'mustacheInjectInline';
lastToken.injectedTags = tags; lastToken.injectedTags = tags;
return { return {
type : 'text', // Should match "name" above type : 'mustacheInjectInline', // Should match "name" above
raw : match[0], // Text to consume from the source raw : match[0], // Text to consume from the source
text : '' text : ''
}; };
} }
}, },
renderer(token) { renderer(token) {
if(!token.originalType){
return;
}
token.type = token.originalType; token.type = token.originalType;
const text = this.parser.parseInline([token]); const text = this.parser.parseInline([token]);
const originalTags = extractHTMLStyleTags(text); const originalTags = extractHTMLStyleTags(text);

View File

@@ -297,10 +297,10 @@ describe('Injection: When an injection tag follows an element', ()=>{
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<p><img style="position:absolute;" src="http://i.imgur.com/hMna6G0.png" alt="alt text"></p>'); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<p><img style="position:absolute;" src="http://i.imgur.com/hMna6G0.png" alt="alt text"></p>');
}); });
it.failing('Renders an element modified by only the first of two consecutive injections', function() { it('Renders an element modified by only the first of two consecutive injections', function() {
const source = '{{ text}}{color:red}{background:blue}'; const source = '{{ text}}{color:red}{background:blue}';
const rendered = Markdown.render(source).trimReturns(); const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<span class="inline-block" style="color:red;">text</span>{background:blue}'); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<p><span class="inline-block" style="color:red;">text</span>{background:blue}</p>');
}); });
it('Renders an image with added attributes', function() { it('Renders an image with added attributes', function() {