Skip to content

Commit

Permalink
Merge pull request #2 from SPF-Open/Prettier
Browse files Browse the repository at this point in the history
Feat: Pretier rules and update
  • Loading branch information
Benoit-Welsch authored Nov 23, 2023
2 parents 3f41f9b + 3e1c912 commit fa7af4c
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 70 deletions.
12 changes: 11 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte",
"semi": true,
"tabWidth": 2,
"singleQuote": true
}
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@typescript-eslint/parser": "^6.12.0",
"eslint": "^8.54.0",
"eslint-plugin-svelte": "^2.35.1",
"prettier": "^2.8.8",
"prettier": "^3.1.0",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^3.59.2",
"svelte-atoms": "^0.0.27",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
dimension: get(dimensionColumn),
indicator: get(indicatorColumn),
},
{ offset: get(rowOffset) }
{ offset: get(rowOffset) },
);
}, 100);
};
Expand Down
102 changes: 50 additions & 52 deletions src/lib/Input/Download.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,70 +31,68 @@
dimension: $dimensionColumn,
indicator: $indicatorColumn,
},
{ offset: $rowOffset }
{ offset: $rowOffset },
);
switch ($selectedFormat.toLocaleLowerCase()) {
case 'csv':{
const CSVString = exportToCSV(sheet, { lang: $langOutput});
case 'csv': {
const CSVString = exportToCSV(sheet, { lang: $langOutput });
const blob = new Blob([CSVString], { type: 'text/csv;charset=utf-8,' });
const objUrl = URL.createObjectURL(blob);
const blob = new Blob([CSVString], { type: 'text/csv;charset=utf-8,' });
const objUrl = URL.createObjectURL(blob);
linkFile.href = objUrl;
console.log(fileName);
linkFile.download = fileName + ' - ' + $langOutput;
linkFile.click();
break;
}
case 'pdf':{
window.print();
break;
}
case 'qti':
{
const lang = $langOutput;
const { manifest, questionsManifest } = exportToQTI(sheet, {
lang,
});
linkFile.href = objUrl;
console.log(fileName);
linkFile.download = fileName + ' - ' + $langOutput;
linkFile.click();
break;
}
case 'pdf': {
window.print();
break;
}
case 'qti': {
const lang = $langOutput;
const { manifest, questionsManifest } = exportToQTI(sheet, {
lang,
});
const manifestBlob = new Blob([manifest.toString()], {
type: 'text/xml',
});
const questionsManifestBlob = questionsManifest.map(
(q) => new Blob([q.toString()], { type: 'text/xml' })
);
const manifestBlob = new Blob([manifest.toString()], {
type: 'text/xml',
});
const questionsManifestBlob = questionsManifest.map(
(q) => new Blob([q.toString()], { type: 'text/xml' }),
);
const ex = async () => {
const zipFileStream = new TransformStream();
const zipFileBlobPromise = new Response(
zipFileStream.readable
).blob();
const ex = async () => {
const zipFileStream = new TransformStream();
const zipFileBlobPromise = new Response(
zipFileStream.readable,
).blob();
const zipWriter = new ZipWriter(new BlobWriter('application/zip'));
const zipWriter = new ZipWriter(new BlobWriter('application/zip'));
// Create manifest xml file
await zipWriter.add('imsmanifest.xml', new BlobReader(manifestBlob));
// Create manifest xml file
await zipWriter.add('imsmanifest.xml', new BlobReader(manifestBlob));
await Promise.all(
questionsManifestBlob.map((b, n) =>
zipWriter.add(`items/${n}/qti.xml`, new BlobReader(b))
)
);
await Promise.all(
questionsManifestBlob.map((b, n) =>
zipWriter.add(`items/${n}/qti.xml`, new BlobReader(b)),
),
);
const finalBlob = await zipWriter.close();
const finalBlob = await zipWriter.close();
linkFile.setAttribute('href', URL.createObjectURL(finalBlob));
linkFile.download = fileName + '.zip';
linkFile.click();
};
ex();
linkFile.setAttribute('href', URL.createObjectURL(finalBlob));
linkFile.download = fileName + '.zip';
linkFile.click();
};
ex();
break;
}
default:
{
console.log('Not unsuported yet');
}
break;
}
default: {
console.log('Not unsuported yet');
}
}
};
</script>
Expand Down
1 change: 0 additions & 1 deletion src/lib/Input/DropZone.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
// Restore options
currentSheet.update(() => undefined);
const data = await fileTemp.arrayBuffer();
/* data is an ArrayBuffer */
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Input/LetterPicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
cursor: pointer;
}
button:hover{
button:hover {
filter: invert(0.5);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/menu/Column.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
flex-wrap: wrap;
align-items: center;
}
.line{
.line {
background-color: #00566b;
width: 2px;
}
Expand Down
7 changes: 3 additions & 4 deletions src/lib/preview/PreviewTAO.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
export let QCMs: QCM[] = [];
export let hideAnswer: boolean;
</script>

<div class="questions" bind:this={$TaoPreviewBind}>
Expand All @@ -19,7 +18,7 @@
</div>
<div class="prompt">
<br />
<!-- eslint-disable svelte/no-at-html-tags -->
<!-- eslint-disable svelte/no-at-html-tags -->
{@html QCM.prompt}
<!--eslint-enable-->
<br />
Expand All @@ -33,7 +32,7 @@
}`}
>
<div class="text">
<!-- eslint-disable svelte/no-at-html-tags -->
<!-- eslint-disable svelte/no-at-html-tags -->
{@html answer.prompt}
<!--eslint-enable-->
</div>
Expand All @@ -49,7 +48,7 @@

<style>
.question {
font-family: "Source Sans Pro";
font-family: 'Source Sans Pro';
display: flex;
flex-direction: column;
border: 3px solid #007f9f;
Expand Down

0 comments on commit fa7af4c

Please sign in to comment.