Skip to content

Commit

Permalink
Merge pull request #411 from Appelsiini1/bug-400
Browse files Browse the repository at this point in the history
Fix project work export wrong headers
  • Loading branch information
RSaarivuoriLUT authored Jan 9, 2025
2 parents 6667d1d + 355ca96 commit 82cfe18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "procasma",
"productName": "Procasma",
"version": "1.7.13",
"version": "1.7.14",
"description": "Dynamic Assignment Manager",
"main": ".vite/build/main.js",
"scripts": {
Expand Down
12 changes: 0 additions & 12 deletions resource/texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
"FI": "Harjoitustyön tehtävänanto",
"ENG": "Final work description"
},
"project_minimum_level_assignment_description": {
"FI": "Harjoitustyön minimitason tehtävänanto",
"ENG": "Basic level final work description"
},
"project_basic_level_assignment_description": {
"FI": "Harjoitustyön perustason tehtävänanto",
"ENG": "Basic level final work description"
},
"project_target_level_assignment_description": {
"FI": "Harjoitustyön tavoitetason tehtävänanto",
"ENG": "Target level final work description"
},
"assignment_description": {
"FI": "Tehtävänanto",
"ENG": "Assignment"
Expand Down
26 changes: 9 additions & 17 deletions src/mainHelpers/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ export async function exportProjectFS(
let moduleString = "";
const css = papercolorLight;

const mainHeader = formatMainHeaderProject(levelID);
const mainHeader = formatMainHeaderProject(
projectInput.variations[levelID].levelName
);

if (splitLevels || html.length === 0) {
// HTML Base
Expand Down Expand Up @@ -440,6 +442,7 @@ export async function exportProjectFS(
log.info("HTML created.");
const inlineHTML = juice(html);
const inlineSolutionHTML = juice(solutionHtml);
log.debug(projectInput.format);

await saveSetModuleFS(
inlineHTML,
Expand Down Expand Up @@ -810,22 +813,10 @@ function formatMainHeader(module: number, moduleType: SupportedModuleType) {
*/
function formatMainHeaderProject(level: string) {
let title = ``;
const addToTitle = (ui_code: string) => {
title += parseUICodeMain(ui_code);
};
switch (level) {
case "1":
addToTitle("project_minimum_level_assignment_description");
break;
case "2":
addToTitle("project_basic_level_assignment_description");
break;
case "3":
addToTitle("project_target_level_assignment_description");
break;
default:
addToTitle("project_assignment_description");
break;
title += parseUICodeMain("project_assignment_description");
if (level !== "") {
title += " - ";
title += level;
}
return title;
}
Expand Down Expand Up @@ -1140,6 +1131,7 @@ function generateToCProject(html: string): string {
block += `<h3><a class="toc" href="#${anchorIdAndText.id}">${anchorIdAndText.text}`;
block += `</a></h3>`;
});
block += `<div style="margin-bottom: 1cm;"></div>`;

return block;
} catch (err) {
Expand Down

0 comments on commit 82cfe18

Please sign in to comment.