Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/version#8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 5 commits intomasterfromfeature/version
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
cleanup parser tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedMay 31, 2020
commita7d615b942b920cfc442304c3ba1a3390fb32ed3
15 changes: 9 additions & 6 deletionssrc/utils/parse.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ export function parseMdContent(md: string): TutorialFrame | never {
levelSummary,
levelContent,
} = levelMatch.groups;

const level = {
[levelId]: {
id: levelId,
Expand DownExpand Up@@ -110,14 +111,14 @@ export function parse(params: ParseParams): any {
if (parsed.levels) {
parsed.levels.forEach((level: T.Level, levelIndex: number) => {
const levelContent = mdContent[level.id];
console.log(levelContent);

if (!levelContent) {
console.log(`Markdown content not found for ${level.id}`);
return;
}

// add level setup commits
const levelSetupKey = `L${levelIndex + 1}S`;
const levelSetupKey = `L${levelIndex + 1}`;
if (params.commits[levelSetupKey]) {
if (!level.setup) {
level.setup = {
Expand All@@ -127,9 +128,11 @@ export function parse(params: ParseParams): any {
level.setup.commits = params.commits[levelSetupKey];
}

const { steps, ...content } = levelContent;

// add level step commits
if (levelContent.steps) {
levelContent.steps.forEach((step: T.Step, stepIndex: number) => {
if (steps) {
steps.forEach((step: T.Step, stepIndex: number) => {
const stepSetupKey = `${levelSetupKey}S${stepIndex + `1`}Q`;
if (params.commits[stepSetupKey]) {
if (!step.setup) {
Expand All@@ -150,11 +153,11 @@ export function parse(params: ParseParams): any {
step.solution.commits = params.commits[stepSolutionKey];
}

return _.merge(step,levelContent.steps[step.id]);
return _.merge(step, steps[step.id]);
});
}

_.merge(level);
_.merge(level, content);
});
}

Expand Down
2 changes: 1 addition & 1 deletiontests/parse.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,7 +110,7 @@ Description.
Some text that becomes the summary
`;

const config = { levels: [{ id:1 }] };
const config = { levels: [{ id:"L1" }] };
const result = parse({
text: md,
config,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp