Skip to content

Commit

Permalink
Updated TO converter for notes, groups and seperators. Added message …
Browse files Browse the repository at this point in the history
…soliciting feedback on R-C
  • Loading branch information
tconfrey committed May 7, 2024
1 parent 7e9e78f commit 3f4da4c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/messageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const messageManager = (() => {
"Browser Tab Group to BrainTool Topic syncing is now enabled."
];
const introSlidesArray = [
`<p>This window is the <b>Topic Manager</b>.</p><p>It allows you to open and close tabs, tab groups, and browser windows, organize them into nested <b>Topics</b> and find them again when you need them.</p><img class="introImage" src="resources/slide1.png"/>`,
`<p><i style="color: #A22; font-size: 12px;">NB This is the 1.0 Release-Candidate please send feedback to [email protected]</i></p><p>This window is the <b>Topic Manager</b>.</p><p>It allows you to open and close tabs, tab groups, and browser windows, organize them into nested <b>Topics</b> and find them again when you need them.</p><img class="introImage" src="resources/slide1.png"/>`,
`<p>The BrainTool <b>Bookmarker</b> tool lives in the browser bar.</p><p>It allows you to save the current tab, tab group, window or session under a named <b>Topic</b>, along with an optional note.</p><p>Pin it for easy access.</p><img class="introImage" src="resources/slide2.png"/>`,
`<p>Use BrainTool to organize all the tabs you want to save and come back to. Hover over a row for tools to open and close groups of tabs, add notes and todo's or edit the topic hierarchy.</p><img class="introImage" src="resources/slide3.png"/>`,
`<p>Everything is kept in plain text in a private local file that you own and can edit, or under your personal Google Drive account for cloud access.</p><img class="introImage" src="resources/slide4.png"/>`,
Expand Down
36 changes: 29 additions & 7 deletions utilities/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ function tabsToBT(tabsStr) {
throw(e);
}
const lastIndex = tabsJson.length - 1;
let node, title, numwin = 1;
let dateStr = getDateString().replace(':', ';');
let BTText = "* TabsOutliner Import - " + dateStr + "\n";
let node, title, numwin = 1, numgroup = 1, numnote = 1, numsep = 1;
// Don't need the extra layer of hierarchy since the fle name will be used as the top node:
//let BTText = "* TabsOutliner Import - " + getDateString().replace(':', '∷') + "\n";
let BTText = "";
tabsJson.forEach((elt, ind) => {
// ignore first and last elements, TO seems to use them for some special purpose
if (!ind || ind == lastIndex) return;
const info = elt[1];
const nesting = elt[2];
// Handle window/container type elements
if (info.type && (info.type == 'win' || info.type == 'savedwin')) {
node = '*'.repeat(nesting.length + 1);
node = '*'.repeat(nesting.length);
title = (info.marks && info.marks.customTitle) ?
info.marks.customTitle : 'Window'+numwin++;
node += ` ${title}\n`;
Expand All @@ -45,16 +46,37 @@ function tabsToBT(tabsStr) {
// Handle tab/link type elements
if (info.data && info.data.url) {
// Create org header row
node = '*'.repeat(nesting.length+1);
node = '*'.repeat(nesting.length);
title = info.data.title || 'Title';
node += ` [[${info.data.url}][${title}]]\n`;
// Add note if any - its stored in marks.customTitle
if (info?.marks?.customTitle) node+= `${info.marks.customTitle}\n`;
BTText += node;
}
// Handle group type elements
if (info.type && info.type == 'group') {
node = '*'.repeat(nesting.length);
title = (info.marks && info.marks.customTitle) ?
info.marks.customTitle : 'Group'+numgroup++;
node += ` ${title}\n`;
BTText += node;
}
// Handle notes type elements
if (info.type && info.type == 'textnote') {
node = '*'.repeat(nesting.length);
title = (info.data && info.data.note) ?
info.data.note : 'Note'+numnote++;
node += ` ${title}\n`;
BTText += node;
}
// Handle seperator type elements
if (info.type && info.type == 'separatorline') {
node = '*'.repeat(nesting.length);
title = 'Separator'+numsep++;
node += ` ${title}\n--------------------------------\n`;
BTText += node;
}
});
console.log("Copy this text to your BrainTool.org file:\n");
console.log(BTText);
return BTText;
}

2 changes: 1 addition & 1 deletion versions/Release-Candidate/app/messageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const messageManager = (() => {
"Browser Tab Group to BrainTool Topic syncing is now enabled."
];
const introSlidesArray = [
`<p>This window is the <b>Topic Manager</b>.</p><p>It allows you to open and close tabs, tab groups, and browser windows, organize them into nested <b>Topics</b> and find them again when you need them.</p><img class="introImage" src="resources/slide1.png"/>`,
`<p><i style="color: #A22; font-size: 12px;">NB This is the 1.0 Release-Candidate please send feedback to [email protected]</i></p><p>This window is the <b>Topic Manager</b>.</p><p>It allows you to open and close tabs, tab groups, and browser windows, organize them into nested <b>Topics</b> and find them again when you need them.</p><img class="introImage" src="resources/slide1.png"/>`,
`<p>The BrainTool <b>Bookmarker</b> tool lives in the browser bar.</p><p>It allows you to save the current tab, tab group, window or session under a named <b>Topic</b>, along with an optional note.</p><p>Pin it for easy access.</p><img class="introImage" src="resources/slide2.png"/>`,
`<p>Use BrainTool to organize all the tabs you want to save and come back to. Hover over a row for tools to open and close groups of tabs, add notes and todo's or edit the topic hierarchy.</p><img class="introImage" src="resources/slide3.png"/>`,
`<p>Everything is kept in plain text in a private local file that you own and can edit, or under your personal Google Drive account for cloud access.</p><img class="introImage" src="resources/slide4.png"/>`,
Expand Down

0 comments on commit 3f4da4c

Please sign in to comment.