| 131 | return `${diffDays} day${diffDays === 1 ? '' : 's'} ago`; |
| 132 | } |
| 133 | |
| 134 | function extractDirection(content) { |
| 135 | const lines = content.split(/\r?\n/); |
| 136 | for (let index = 0; index < lines.length; index++) { |
| 137 | const match = lines[index].match(/^\s*(?:\*\*)?Direction:(?:\*\*)?\s*(.*)$/i); |
| 138 | if (!match) continue; |
| 139 | |
| 140 | const parts = []; |
| 141 | if (match[1]) parts.push(match[1].trim()); |
| 142 | |
| 143 | for (let next = index + 1; next < lines.length; next++) { |
| 144 | const line = lines[next]; |
| 145 | if (!line.trim()) break; |
| 146 | if (/^#/.test(line) || /^[A-Z][A-Za-z ]+:/.test(line)) break; |
| 147 | parts.push(line.trim()); |
| 148 | } |
| 149 | |
| 150 | return parts.join(' ').trim(); |
| 151 | } |
| 152 | return ''; |
| 153 | } |
| 154 | |
| 155 | function normalizeStatus(campaign) { |