From ee3c7d1e2baeaefd04fa958abd8030b1c5b44a20 Mon Sep 17 00:00:00 2001 From: Benjamin Zaslavsky Date: Thu, 23 Nov 2017 22:10:54 +0100 Subject: [PATCH] links: add refs in metadata Fixes: https://github.com/nodejs/node-core-utils/issues/117 --- lib/links.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/links.js b/lib/links.js index 1150d42d..593ee494 100644 --- a/lib/links.js +++ b/lib/links.js @@ -45,11 +45,12 @@ class LinkParser { // Do this so we can reliably get the correct url. // Otherwise, the number could reference a PR or an issue. getRefUrlFromOP(ref) { - const as = this.OP.querySelectorAll('a.issue-link'); + const as = Array.from(this.OP.children) + .filter(c => c.textContent.includes('Refs')) + .map(a => a.querySelector('a')); const links = Array.from(as); for (const link of links) { - const text = link.textContent; - if (text === ref) { + if (link.textContent === ref) { const href = link.getAttribute('href'); if (href) return href; }