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

Commitcdbe136

Browse files
committed
Fix some Windows issues with path and regex
1 parente07e51e commitcdbe136

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/parse.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ function parseContent(md) {
3030
constsections={};
3131

3232
// Identify and remove the header
33-
constsummaryMatch=parts.shift().match(/^#\s(?<tutorialTitle>.*)\n+(?<tutorialDescription>[^]*)/);
33+
constsummaryMatch=parts.shift().match(/^#\s(?<tutorialTitle>.*)[\n\r]+(?<tutorialDescription>[^]*)/);
3434

3535
sections['summary']={
36-
title:summaryMatch.groups.tutorialTitle,
37-
description:summaryMatch.groups.tutorialDescription,
36+
title:summaryMatch.groups.tutorialTitle.trim(),
37+
description:summaryMatch.groups.tutorialDescription.trim(),
3838
};
3939

4040
// Identify each part of the content
4141
parts.forEach(section=>{
42-
constlevelRegex=/^(##\s(?<levelId>L\d+)\s(?<levelTitle>.*)\n*(>\s*(?<levelSummary>.*))?\n+(?<levelContent>[^]*))/;
43-
conststepRegex=/^(###\s(?<stepId>(?<levelId>L\d+)S\d+)\s(?<stepTitle>.*)\n+(?<stepContent>[^]*))/;
42+
constlevelRegex=/^(##\s(?<levelId>L\d+)\s(?<levelTitle>.*)[\n\r]*(>\s+(?<levelSummary>.*))?[\n\r]+(?<levelContent>[^]*))/;
43+
conststepRegex=/^(###\s(?<stepId>(?<levelId>L\d+)S\d+)\s(?<stepTitle>.*)[\n\r]+(?<stepContent>[^]*))/;
4444

4545
constlevelMatch=section.match(levelRegex);
4646
conststepMatch=section.match(stepRegex);
@@ -50,8 +50,8 @@ function parseContent(md) {
5050
[levelMatch.groups.levelId]:{
5151
id:levelMatch.groups.levelId,
5252
title:levelMatch.groups.levelTitle,
53-
summary:levelMatch.groups.levelSummary,
54-
content:levelMatch.groups.levelContent,
53+
summary:levelMatch.groups.levelSummary.trim(),
54+
content:levelMatch.groups.levelContent.trim(),
5555
}
5656
};
5757

@@ -66,7 +66,7 @@ function parseContent(md) {
6666
[stepMatch.groups.stepId]:{
6767
id:stepMatch.groups.stepId,
6868
// title: stepMatch.groups.stepTitle, //Not using at this momemnt
69-
content:stepMatch.groups.stepContent
69+
content:stepMatch.groups.stepContent.trim()
7070
}
7171
}
7272
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp