@@ -173,11 +173,11 @@ class IssueContentParser {
173173 .map(x => (0, utils_1.parseIssueUrl)(x))
174174 .filter((x) => x !== null);
175175 }
176- extractIssueDependencies(issue) {
176+ extractIssueDependencies(issue, repoRef ) {
177177 const contentLines = issue.body?.split("\n") ?? [];
178178 return contentLines
179179 .filter(x => this.isDependencyLine(x))
180- .map(x => (0, utils_1.parseIssuesUrls)(x))
180+ .map(x => (0, utils_1.parseIssuesUrls)(x, repoRef ))
181181 .flat()
182182 .filter((x) => x !== null);
183183 }
@@ -291,7 +291,7 @@ const run = async () => {
291291 for (const issueRef of rootIssueTasklist) {
292292 const issue = await githubApiClient.getIssue(issueRef);
293293 const issueDetails = mermaid_node_1.MermaidNode.createFromGitHubIssue(issue);
294- const issueDependencies = issueContentParser.extractIssueDependencies(issue);
294+ const issueDependencies = issueContentParser.extractIssueDependencies(issue, issueRef );
295295 graphBuilder.addIssue(issueRef, issueDetails);
296296 issueDependencies.forEach(x => graphBuilder.addDependency(x, issueRef));
297297 }
@@ -330,35 +330,24 @@ run();
330330/***/ }),
331331
332332/***/ 235:
333- /***/ ((__unused_webpack_module, exports) => {
333+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__ ) => {
334334
335335"use strict";
336336
337337Object.defineProperty(exports, "__esModule", ({ value: true }));
338338exports.MermaidNode = void 0;
339+ const utils_1 = __nccwpck_require__(918);
339340class MermaidNode {
340341 constructor(nodeId, title, status, url) {
341342 this.nodeId = nodeId;
342343 this.title = title;
343344 this.status = status;
344345 this.url = url;
345346 }
346- getWrappedTitle() {
347- const maxWidth = 40;
348- const words = this.title.split(/\s+/);
349- let result = words[0];
350- let lastLength = result.length;
351- for (let wordIndex = 1; wordIndex < words.length; wordIndex++) {
352- if (lastLength + words[wordIndex].length >= maxWidth) {
353- result += "\n";
354- lastLength = 0;
355- }
356- else {
357- result += " ";
358- }
359- result += words[wordIndex];
360- lastLength += words[wordIndex].length;
361- }
347+ getFormattedTitle() {
348+ let result = this.title;
349+ result = result.replaceAll('"', "'");
350+ result = (0, utils_1.wrapString)(result, 40);
362351 return result;
363352 }
364353 static createFromGitHubIssue(issue) {
@@ -447,7 +436,7 @@ ${renderedGraphIssues}
447436`;
448437 }
449438 renderIssue(issue) {
450- const title = issue.getWrappedTitle ();
439+ const title = issue.getFormattedTitle ();
451440 const linkedTitle = issue.url
452441 ? `<a href='${issue.url}' style='text-decoration:none;color: inherit;'>${title}</a>`
453442 : title;
@@ -478,9 +467,10 @@ exports.MermaidRender = MermaidRender;
478467"use strict";
479468
480469Object.defineProperty(exports, "__esModule", ({ value: true }));
481- exports.parseIssuesUrls = exports.parseIssueUrl = void 0;
470+ exports.wrapString = exports. parseIssuesUrls = exports.parseIssueNumber = exports.parseIssueUrl = void 0;
482471const issueUrlRegex = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/i;
483- const issueUrlsRegex = /github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/gi;
472+ const issueNumberRegex = /^#(\d+)$/;
473+ const issueUrlsRegex = /https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)|#\d+/gi;
484474const parseIssueUrl = (str) => {
485475 const found = str.trim().match(issueUrlRegex);
486476 if (!found) {
@@ -493,18 +483,47 @@ const parseIssueUrl = (str) => {
493483 };
494484};
495485exports.parseIssueUrl = parseIssueUrl;
496- const parseIssuesUrls = (str) => {
486+ const parseIssueNumber = (str, repoRef) => {
487+ const found = str.trim().match(issueNumberRegex);
488+ if (!found) {
489+ return null;
490+ }
491+ return {
492+ repoOwner: repoRef.repoOwner,
493+ repoName: repoRef.repoName,
494+ issueNumber: parseInt(found[1]),
495+ };
496+ };
497+ exports.parseIssueNumber = parseIssueNumber;
498+ const parseIssuesUrls = (str, repoRef) => {
497499 const result = [];
498500 for (const match of str.matchAll(issueUrlsRegex)) {
499- result.push({
500- repoOwner: match[1],
501- repoName: match[2],
502- issueNumber: parseInt(match[3]),
503- });
501+ const parsedIssue = (0, exports.parseIssueUrl)(match[0]) || (0, exports.parseIssueNumber)(match[0], repoRef);
502+ if (parsedIssue) {
503+ result.push(parsedIssue);
504+ }
504505 }
505506 return result;
506507};
507508exports.parseIssuesUrls = parseIssuesUrls;
509+ const wrapString = (str, maxWidth) => {
510+ const words = str.split(/\s+/);
511+ let result = words[0];
512+ let lastLength = result.length;
513+ for (let wordIndex = 1; wordIndex < words.length; wordIndex++) {
514+ if (lastLength + words[wordIndex].length >= maxWidth) {
515+ result += "\n";
516+ lastLength = 0;
517+ }
518+ else {
519+ result += " ";
520+ }
521+ result += words[wordIndex];
522+ lastLength += words[wordIndex].length;
523+ }
524+ return result;
525+ };
526+ exports.wrapString = wrapString;
508527
509528
510529/***/ }),
0 commit comments