Importing Taskade projects into NCP

31 views
Skip to first unread message

ToddA

unread,
May 9, 2022, 8:36:01 PM5/9/22
to Notecase Pro
Hi All,

There are several Taskade projects (documents) that I've taken over from a friend and I would like to import them into NCP.

My attempts to use Pandoc to create an NCP friendly import were not successful so I'm here to ask for help.

Part 1 -- importing to NCP

I do not know the best way to do this -- either by having dedicated Taskade import code added in NCP, or via a Lua script (I don't do Lua).

I'm attaching three exported Taskade examples:

  1. Taskade-example.pdf

    This is to show approximately how it appears when being edited in Taskade.

    It has a text example -- the word "vernacular" -- showing how Taskade does colored highlighting; unfortunately such highlighting is not preserved when exporting from Taskade so I'll handle these few cases manually post-import.

  2. Taskade-example-exported-as-markdown.md

    I envision this to be the primary structure for importing into NCP.

  3. Taskade-example-exported-as-text.txt

    I include this only for the sake of completeness as it might be beneficial for some future Taskade user to import into NCP. In the testing I have done when exporting as text, the only difference I've seen between the markdown export and the text export is the presence of the "[ ]" on each line that represents a checkbox.
Taskade has lots of ways to layout its projects but I'm only giving examples for the layout and features present in the projects I want to import into NCP.

Notes on the markdown and text export structures -- it is pretty simple:
  • Lines are terminated with linefeeds.

  • On import, the first non-blank character (usually "#" or "-") is significant and would trigger either a new NCP child note or a new NCP sibling note. Parent-child levels can be determined by the number of blank characters preceding the "-".

  • The markdown "checkbox" appears to be based on the github Task lists syntax. I envision lines that are checked "[x]" will be imported with the NCP "Done" Note Flag. I also envision that the leading spaces, #, -, [ ] and [x] will be stripped after being parsed because they don't need to be preserved by NCP.

  • It is important that the "checkbox" be parsed if present because of the sheer number of notes to be imported that are marked this way; it would be a nightmare if I had to do Note Flags -> Done manually.
You may notice that the "12/30/2021" example has a strikethrough in the PDF to indicate it is done. I don't know why this did not get exported as "[x] 12/30/2021" for the markdown file, but there are so few of these that I can manually do Note Flags -> Done after it is imported into NCP.

Part 2 -- post-import processing

I wonder if some kind soul could write a Lua script for me that would loop through the NCP notes looking for lines that consist solely of text in the following formats:
  • mm/dd/yy
  • mm/dd/yyyy
  • mm/dd/yy dow
  • mm/dd/yyyy dow
where "dow" is the abbreviated day of the week (e.g., Mon, Tue, Wed, etc.), then rewrite the notes to a single format: yyyy/mm/dd dow

Lines that begin with a date or date+dow AND that have extra text after them should not be reformatted. The Taskade Example entry for "12/29/21 Wed" has an example of this, the one that begins with "- 03/19/20 even...".

The purpose in doing this is so that I can use NCP's descending sort feature to put them in reverse chronological order. I could not find a built-in sort capability in NCP to do this (maybe I missed it?) where the dates are allowed to be free format text. (I do know that NCP notes have a dedicated date property but that won't help me because of the free format structure being used in the existing import file, and ongoing as I manually add new entries.) I've already created a custom NCP ctrl-shift-T to do "%Y/%m/%d %a". :D

Kind regards,
Todd
Taskade-example.pdf
Taskade-example-exported-as-markdown.md
Taskade-example-exported-as-text.txt

karlma...@gmail.com

unread,
May 12, 2022, 6:32:16 PM5/12/22
to Notecase Pro
That is roughly 2 areas:

###########################################
1) Reorganize Chunks in a RecurringFormat:
###########################################

eg: mm:dd:yy to yy:mm:dd

for this something like vi was good.
On windows or mac etc probably best use Sublimt-Text, using:

RegExp (regular expressions), when you search for something in sublime, need to enable RegExp:
it is the button [ .* ] at far left of textbox that pops up for search (CTRL + F) in sublime at bottom
+
Groups in RegExp:
Groups let you define patterns in text
Can have multi RegExp groups
then can have search & replace using those RegExp group definitions. 
So you define search & replace (for all instances clicked), then it replaces all with 1 click. 

RegExp grouping needs a lot of training & trial & error, in vi or sublime etc.
Best start simply with one group definition (/1). Then multi groups in one search: (/1) abc (/2) defg etc (/3) etc

############################################
2) SORTING Chunks:
############################################

This is an algorithm & has to be done by some code, in a language or database.
Or at very least for simple cases in batch files, macros for  excel or word etc.

############################################

Good luck.



karlma...@gmail.com

unread,
May 12, 2022, 6:42:12 PM5/12/22
to Notecase Pro
P.S.
For mere importing, can use sublime again with a simple search & replace, for markdown files to convert:
each space at start of line to convert to a deeper subnode level
for OPML import.

ToddA

unread,
May 14, 2022, 10:14:56 PM5/14/22
to Notecase Pro
Unfortunately I don't use Sublime and don't have regex skills. I guess I'm just out of luck. Thanks for the reply though.

karlma...@gmail.com

unread,
May 15, 2022, 1:03:06 PM5/15/22
to Notecase Pro
Pleasure. Years ago in a company, we converted lots of data for Sony/Apple. I mainly used many programming languages & DBs, but sometimes prepared inputs in vi.
For your needs you just need to learn the basics, like defining basics, as example: dd:mm:yy or first word at start of line or whatever. Then replace. More advanced uses, can pick virually any pattern, but you won't need advanced regexp.
Then your defined results' hits in regexp can be defined as a group (/1) or more (/2) etc. Then can replace each group globally with whatever or more groups: eg: replace (/1) patterns dd:mm:yy with (/3) can be yy:mm:dd

sublime is a text editor, nothing scary, though has thousands of plugins coders use, has a free version, default has regexp functions. As do it's rivals, MS VS Code & Atom and have regexp plugins tools etc. for advanced users, you won't need plugins. You can play with regexp online too:




Good luck.

Miroslav Rajcic

unread,
May 15, 2022, 3:30:32 PM5/15/22
to Notecase Pro
Hi Todd,

Taskade seems to be a custom format, and you need to:
  • decide how to map concepts of Taskade to concepts of Notecase
    • for example, each checkbox/bulleted line seems to map to one Notecase note
    • if so, what should you map the date lines to ? I guess that also maps to Notecase note
  • write some kind of line-by-line reader code in Lua (can you assume that Taskade items are all one-liners?) that will read the .md file (I suppose) and generate notes in NCP
It may need some effort to do it, but it's doable. Perhaps someone has free time to jump in with the help, but your best bet is to start yourself and post your work here for anyone to improve upon.

Best regards,
  Miro

From: noteca...@googlegroups.com <noteca...@googlegroups.com> on behalf of ToddA <starm...@gmail.com>
Sent: Tuesday, May 10, 2022 2:36 AM
To: Notecase Pro <noteca...@googlegroups.com>
Subject: Importing Taskade projects into NCP
 
--
You received this message because you are subscribed to the Google Groups "Notecase Pro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notecase-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/notecase-pro/7f242302-f4da-4acf-a5ed-2a31aece4506n%40googlegroups.com.

karlma...@gmail.com

unread,
May 15, 2022, 4:25:05 PM5/15/22
to Notecase Pro
Hi Miro,
I'm interested to know if NCP Lua scripts can re-format certain defined text patterns? And also re-sort sub-parts within a document? If so that would be great.

Paul Merrell

unread,
May 16, 2022, 7:44:33 AM5/16/22
to Notecase Pro
On Sun, May 15, 2022 at 1:25 PM karlma...@gmail.com
<karlma...@gmail.com> wrote:
>
> Hi Miro,
> I'm interested to know if NCP Lua scripts can re-format certain defined text patterns? And also re-sort sub-parts within a document? If so that would be great.

Answers: Yes and Yes. It would be helpful if you might provide an
example of reformatting a certain defined text pattern.

Lua does not use regular expressions for its pattern matching. Instead
it has its own pattern matching algorithms. See Lua Reference Manual
section 6.4.1 Patterns,
<https://www.lua.org/manual/5.4/manual.html#6.4.1>. However, the
string functions of the lua-utf8 library embedded in NoteCase should
be used rather than the corresponding Lua string functions because Lua
does not natively support Unicode. See Help file > Automation, Scripts
and Plugins > Scripting NoteCase Pro > Integrated Lua Libraries >
Lua-utf8.

On the sorting, see Help file > Automation, Scripts and Plugins >
Scripting NoteCase Pro > Scriptable Program Commands > Notegroup
Commands > Nc_NoteGroup_Sort

Best regards,

Paul
--
[Notice not included in the above original message: The U.S. National
Security Agency neither confirms nor denies that it intercepted this
message.]
¯\_(ツ)_/¯

Miroslav Rajcic

unread,
May 16, 2022, 8:22:08 AM5/16/22
to Notecase Pro
Paul is spot-on, you can do quite a lot in Lua.

Best regards,
  Miro

From: noteca...@googlegroups.com <noteca...@googlegroups.com> on behalf of Paul Merrell <mar...@gmail.com>
Sent: Monday, May 16, 2022 1:44 PM
To: Notecase Pro <noteca...@googlegroups.com>
Subject: Re: Importing Taskade projects into NCP
 
--
You received this message because you are subscribed to the Google Groups "Notecase Pro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to notecase-pro...@googlegroups.com.

karlma...@gmail.com

unread,
May 16, 2022, 5:13:22 PM5/16/22
to Notecase Pro
Hi Paul,
Thanks, that's good to know. I never played with Lua. Always used coding.
Hopefully Todd's requirements for changing patterns (eg: dd:mm:yy  > mm:dd:yy) and sorting a.k.a rearranging chunks within docs can be helped with.

Hi Miro,
NCP is behaving immaculately on my latest phone! I'm a bit pressed for time but last month i made some dark themes for NCP GTK3. They need polishing up + i want to add another half a dozen after i get my palettes perfect for the first batch, when i get a free weekend. Works good on Windows, even on Geany etc. Latest NCP build is solid as usual, thanks. 

Have a good week guys.

Miroslav Rajcic

unread,
May 17, 2022, 12:39:21 PM5/17/22
to Notecase Pro
Thanks Karl,

feel free to share the theme in the group once polished :)

Best regards,
  Miro

From: noteca...@googlegroups.com <noteca...@googlegroups.com> on behalf of karlma...@gmail.com <karlma...@gmail.com>
Sent: Monday, May 16, 2022 11:13 PM

ToddA

unread,
May 17, 2022, 1:12:04 PM5/17/22
to Notecase Pro
Hi All, I'd forgotten that Miro had created a custom import script for me just about 10 years ago this month. :D I think I can adapt it. I'll handle the date stuff separately.

karlma...@gmail.com

unread,
May 17, 2022, 8:26:05 PM5/17/22
to Notecase Pro
hehe :) i will. i made about 5 or 6 dark ones last month on a sunday, they need polishing + want to do half a dozen more once on a roll, on a free day.
Plus instructions to write. Unlike gtk2 themes on windows, gtk3 is global, like distros, so need to check on other apps too.


Sorry Todd, short off-topic. 
Post a rough NCP Lua script to start with & build on here, as Paul & Miro are experts in it.
Reply all
Reply to author
Forward
0 new messages