From 098e3c2fba37e318cc5d2206808a13bb8b18aad1 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 17 Dec 2018 17:23:02 -0700 Subject: [PATCH] More FILES.BBS support --- core/files_bbs_file.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/core/files_bbs_file.js b/core/files_bbs_file.js index 34483e48..fcafd165 100644 --- a/core/files_bbs_file.js +++ b/core/files_bbs_file.js @@ -108,6 +108,7 @@ module.exports = class FilesBBSFile { const long = [ hdr[2].trim() ]; for(let j = i + 1; j < lines.length; ++j) { line = lines[j]; + // -------------------------------------------------v 32 if(!line.startsWith(' | ')) { break; } @@ -122,6 +123,42 @@ module.exports = class FilesBBSFile { } }, + { + // + // Simple first line with partial description, + // secondary description lines tabbed out. + // + // Examples + // - GUS archive @ dk.toastednet.org + // + lineRegExp : /^([^\s]{1,12})\s+\[00\]\s([^\r\n]+)$/, + detect : function() { + return regExpTestUpTo(10, this.lineRegExp); + }, + extract : function() { + for(let i = 0; i < lines.length; ++i) { + let line = lines[i]; + const hdr = line.match(this.lineRegExp); + if(!hdr) { + continue; + } + const long = [ hdr[2].trimRight() ]; + for(let j = i + 1; j < lines.length; ++j) { + line = lines[j]; + if(!line.startsWith('\t\t ')) { + break; + } + long.push(line.substr(4)); + ++i; + } + const desc = long.join('\r\n'); + const fileName = hdr[1]; + + filesBbs.entries.set(fileName, { desc } ); + } + } + }, + { // // Examples: