Skip to content

Commit 4ca0991

Browse files
authored
Merge pull request #53 from brainhack-vandy/david-regex-fixed
made regex more flexible and switched titles
2 parents 63f13b4 + aeaf9a1 commit 4ca0991

File tree

3 files changed

+632
-582
lines changed

3 files changed

+632
-582
lines changed

.github/ISSUE_TEMPLATE/project-submission-template.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ name: Project submission template
55

66
description: Fill in this template to submit a project
77

8-
labels: [project-proposal]
8+
title: "Project: "
9+
labels: ["project-proposal"]
910

1011
body:
1112
- type: markdown

src/data/data_utils.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@ function processIssues(issues) {
2525
return;
2626
}
2727

28-
const title = issue.title;
28+
2929
const body = issue.body || '';
3030

3131
// Initialize variables
3232
let infoLink = null;
3333
let imageLink = null;
3434
let description = null;
35+
let title = null;
3536

3637
// Regular expressions
37-
const linkRegex = /### Link to project repository\/sources\n\n([\s\S]*?)\n\n###/;
38-
const imageRegex = /### Image\n\n!\[.*?\]\((.*?)\)/;
39-
const descriptionRegex = /### Project Description\n\n([\s\S]*?)\n\n###/;
38+
const linkRegex = /### Link to project repository\/sources([\s\S]*?)###/;
39+
const imageRegex = /### Image!\[.*?\]\((.*?)\)/;
40+
const descriptionRegex = /### Project Description([\s\S]*?)###/;
41+
42+
const titleRegex = /### Title([\s\S]*?)###/;
4043

4144
// Extract image link
4245
const imageMatch = imageRegex.exec(body);
@@ -55,6 +58,13 @@ function processIssues(issues) {
5558
description = descriptionMatch[1].trim();
5659
}
5760

61+
62+
const titleMatch = titleRegex.exec(body);
63+
if (titleMatch) {
64+
title = titleMatch[1].trim();
65+
}
66+
67+
5868
const project = {
5969
title: title,
6070
description: description,

0 commit comments

Comments
 (0)