0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 05:52:46 +00:00

Merge branch 'master' into addEditorThemes-#362

This commit is contained in:
G.Ambatte
2023-04-05 07:45:03 +12:00
committed by GitHub
3 changed files with 19 additions and 3 deletions

View File

@@ -305,7 +305,7 @@ If you believe you should have access to this brew, ask the file owner to invite
if(brew.authors.length === 0) { if(brew.authors.length === 0) {
// Delete brew if there are no authors left // Delete brew if there are no authors left
await brew.remove() await brew.deleteOne()
.catch((err)=>{ .catch((err)=>{
console.error(err); console.error(err);
throw { status: 500, message: 'Error while removing' }; throw { status: 500, message: 'Error while removing' };

View File

@@ -134,7 +134,7 @@ const mustacheInjectInline = {
const match = inlineRegex.exec(src); const match = inlineRegex.exec(src);
if(match) { if(match) {
const lastToken = tokens[tokens.length - 1]; const lastToken = tokens[tokens.length - 1];
if(!lastToken) if(!lastToken || lastToken.type == 'mustacheInjectInline')
return false; return false;
const tags = ` ${processStyleTags(match[1])}`; const tags = ` ${processStyleTags(match[1])}`;
@@ -169,7 +169,7 @@ const mustacheInjectBlock = {
const match = inlineRegex.exec(src); const match = inlineRegex.exec(src);
if(match) { if(match) {
const lastToken = tokens[tokens.length - 1]; const lastToken = tokens[tokens.length - 1];
if(!lastToken) if(!lastToken || lastToken.type == 'mustacheInjectBlock')
return false; return false;
lastToken.originalType = 'mustacheInjectBlock'; lastToken.originalType = 'mustacheInjectBlock';

View File

@@ -105,6 +105,22 @@ test('Renders a mustache span with text, id, class and a couple of css propertie
expect(rendered).toBe('<span class="inline-block pen" id="author" style="color:orange; font-family:trebuchet ms;">text</span>'); expect(rendered).toBe('<span class="inline-block pen" id="author" style="color:orange; font-family:trebuchet ms;">text</span>');
}); });
test('Two consecutive injections into Inline', function() {
const source = '{{dog Sample Text}}{cat}{toad}';
const rendered = Markdown.render(source);
// FIXME: Drops original attributes in favor of injection, rather than adding.
// FIXME: Doesn't keep the raw text of second injection.
// FIXME: Renders the extra class attribute (which is dropped by the browser).
expect(rendered).toBe('<p><span class=" cat" class="inline-block cat" >Sample Text</span></p>\n');
});
test('Two consecutive injections into Block', function() {
const source = '{{dog\nSample Text\n}}\n{cat}\n{toad}';
const rendered = Markdown.render(source);
// FIXME: Renders the extra class attribute (which is dropped by the browser).
expect(rendered).toBe('<div class=" cat" class="block cat" ><p>Sample Text</p>\n</div><p>{toad}</p>\n');
});
// TODO: add tests for ID with accordance to CSS spec: // TODO: add tests for ID with accordance to CSS spec:
// //
// From https://drafts.csswg.org/selectors/#id-selectors: // From https://drafts.csswg.org/selectors/#id-selectors: