mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
remove last script tag
This commit is contained in:
parent
fee5e3064e
commit
638f48c2fc
2 changed files with 3 additions and 5 deletions
|
@ -8,11 +8,8 @@ export default function setup(parser: Parser): void {
|
||||||
const content_start = parser.index;
|
const content_start = parser.index;
|
||||||
const setupScriptContent = parser.read_until(/^---/m);
|
const setupScriptContent = parser.read_until(/^---/m);
|
||||||
const content_end = parser.index;
|
const content_end = parser.index;
|
||||||
console.log(setupScriptContent);
|
|
||||||
parser.eat('---', true);
|
parser.eat('---', true);
|
||||||
const end = parser.index;
|
const end = parser.index;
|
||||||
|
|
||||||
console.log('XXX', parser.template.slice(end));
|
|
||||||
parser.js.push({
|
parser.js.push({
|
||||||
type: 'Script',
|
type: 'Script',
|
||||||
context: 'setup',
|
context: 'setup',
|
||||||
|
|
|
@ -79,13 +79,14 @@ async function convertMdToJsx(
|
||||||
// Break it up here so that the HTML parser won't detect it.
|
// Break it up here so that the HTML parser won't detect it.
|
||||||
const stringifiedSetupContext = JSON.stringify(setupContext).replace(/\<\/script\>/g, `</scrip" + "t>`);
|
const stringifiedSetupContext = JSON.stringify(setupContext).replace(/\<\/script\>/g, `</scrip" + "t>`);
|
||||||
|
|
||||||
const raw = `<script astro>
|
const raw = `---
|
||||||
${imports}
|
${imports}
|
||||||
${_frontmatterData.layout ? `export const layout = ${JSON.stringify(_frontmatterData.layout)};` : ''}
|
${_frontmatterData.layout ? `export const layout = ${JSON.stringify(_frontmatterData.layout)};` : ''}
|
||||||
export function setup({context}) {
|
export function setup({context}) {
|
||||||
return {context: ${stringifiedSetupContext} };
|
return {context: ${stringifiedSetupContext} };
|
||||||
}
|
}
|
||||||
</script><section>${mdHtml}</section>`;
|
---
|
||||||
|
<section>${mdHtml}</section>`;
|
||||||
|
|
||||||
const convertOptions = { compileOptions, filename, fileID };
|
const convertOptions = { compileOptions, filename, fileID };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue