θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions collector/utils/extensions/DrupalWiki/DrupalWiki/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ class DrupalWiki {
pageId: pageId,
accessToken: this.accessToken,
};
return `drupalwiki://${this.baseUrl}?payload=${encryptionWorker.encrypt(
return `drupalwiki://${
this.baseUrl
}/node/${pageId}?payload=${encryptionWorker.encrypt(
JSON.stringify(payload)
)}`;
}
Expand Down Expand Up @@ -259,17 +261,27 @@ class DrupalWiki {
* @private
*/
#processPageBody({ body, url, title, lastModified }) {
// use the title as content if there is none
const textContent = body.trim() !== "" ? body : title;

const plainTextContent = htmlToText(textContent, {
wordwrap: false,
preserveNewlines: true,
selectors: [
{
selector: "table",
format: "dataTable",
options: {
colSpacing: 3,
rowSpacing: 1,
uppercaseHeaderCells: true,
maxColumnWidth: Infinity,
},
},
],
});
// preserve structure

const plainBody = plainTextContent.replace(/\n{3,}/g, "\n\n");
// add the link to the document
return `Link/URL: ${url}\n\n${plainBody}`;
return plainBody;
}

async #downloadAndProcessAttachments(pageId) {
Expand Down