dansays / thingy

A Things Parser for Drafts 5

Home Page:https://actions.getdrafts.com/g/1HW

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thingy: A Things Parser for Drafts 5

Installation

An action group is available for download in the Drafts Action Directory. If you wish to customize, run npm run build to generate the bundled script to import into Drafts.

Overview

Like most parsers, multiple tasks can be specified, one task per line:

Vacuum the rug
Paint the lawn
Mow the hedge
Shave the chickens

If you select text in a draft, only that text will be processed. Properties can be defined by prefacing the value with an emoji. Keyboard actions are provided to facilitate easy entry.

Property Note
🏷 Tags One or more, separated by commas
πŸ“ List Must be exact project or area name or ID
πŸ“† When Can be fuzzy date; including a time will set a reminder
⏰ Reminder Time only; can also be appended to "when" value
⚠️ Deadline Date only, time will be ignored
πŸ“Œ Heading Heading name (exact; ignored if doesn't exist)
πŸ”˜ Checklist item Can include multiple item definitions
πŸ—’ Notes Can include multiple notes, which will render as paragraphs

So now our tasks can have tags, be assigned to lists, and given notes, dates, and checklist items:

Vacuum the rug 🏷 Home πŸ“ Chores ⏰ 3:00
Paint the lawn 🏷 Home πŸ“ Landscaping
Mow the hedge 🏷 Home πŸ“ Landscaping
Shave the chickens 🏷 Farm πŸ“ Livestock πŸ“† Tonight 7pm

Adding whitespace makes things a bit more readable. The keyboard actions included in the bundle automatically format properties on a new line, with indentation:

Vacuum the rug
  πŸ“ Chores
  🏷 Home
  ⏰ 3:30

Paint the lawn
  πŸ“ Landscaping
  🏷 Home
  πŸ“† Next Saturday
  πŸ”˜ Wash brushes and rollers
  πŸ”˜ Lay down tarp to protect sidewalk
  πŸ”˜ Make sure paint can lids are closed tightly!

Mow the hedge
  πŸ“ Landscaping
  🏷 Home
  ⚠️ 2 weeks

Shave the chickens
  πŸ“ Livestock
  🏷 Farm
  πŸ“† Tonight 7pm
  πŸ—’ Remember to use a fresh razor blade!

Dates

While Things does an admirable job parsing natural language dates, I opted to employ DateJS to allow for additional flexibility. Some examples of valid dates:

  • Tonight
  • Next Saturday
  • in 3 weeks
  • +4d
  • July
  • Someday

Any date can be offset by appending +4 or -7 to the string. This will add 4 days, or subtract 7 days, from the parsed date. (It may not seem very useful, but it comes in handy when processing template tags. Keep reading.)

A few things to note:

  • If only a time is specified, today's date will be assumed
  • If a time associated with today's date is after 5pm, the task will be automatically categorized in the "this evening" section.
  • If a specified time is before 7:00 and lacks an am/pm suffix, it will be assumed to be in the evening. We don't want accidental reminders at 5am.

Autotagger

Tags and other properties can be automatically applied to tasks based on pattern-based rules. When you first run the "Add Things Tasks" action, a new "Thingy Autotagger Rules" draft note will be placed in your inbox. This note will contain a handful of default autotagger rule definitions:

# Thingy Autotagger Rules

Starts with "Call"   🏷 Calls
Starts with "Email"  🏷 Email
Contains "Mom"       🏷 Mom
Contains "Dad"       🏷 Dad

Starts with "Waiting For|WF"
  🏷 Waiting For
  πŸ“† Tomorrow
  ⚠️ 1 week

Starts with "Drop off|Pick up|Deliver"
  🏷 Errands

You can edit or add to these rules as you see fit. Feel free to archive the draft if you don't want it cluttering up your inbox... just don't change the title. (Side note: You can have multiple config files if you want. Just make sure the title starts with "# Thingy Autotagger Rules".)

Autotagger rules are defined just like tasks, but follow a specific notation:

Syntax Description
Starts with "Call" Task must start with "Call"
Ends with "ASAP" Task must end with "ASAP"
Contains "groceries" Task must contain the word "groceries"
Matches "^Bug( #\d+)?:" Task must match the regular expression
All tasks Match all tasks

All rules are case-insensitive, and all but regular expression rules must be anchored against word boundaries. For example, Starts with "Call" will match "Call Bob", but not "Callously berate Bob for constantly being late".

Multiple options can be referenced, separated by the | character. For example, Contains "groceries|grocery store|Whole Foods" will match tasks that contain "groceries", "grocery store", or "Whole Foods".

Projects

When you give your document a title that begins with a hash mark, your tasks will be created as a part of a new project. Any headings referenced in task properties will be created. For example:

# Trip to Maui

Pack luggage
  🏷 Home
  πŸ“Œ Packing
  πŸ”˜ Swimsuit
  πŸ”˜ Flip-flops
  πŸ”˜ Sunscreen

Pack carry-on bag
  🏷 Home
  πŸ“Œ Packing
  πŸ”˜ Kindle
  πŸ”˜ iPad
  πŸ”˜ Chargers

Take out the trash
  🏷 Home
  πŸ“Œ Before Leaving

Drop dog off at sitter
  🏷 Home
  πŸ“Œ Before Leaving

Make sure you have your tickets and passport!
  🏷 Home
  πŸ“Œ Before Leaving

Template Tags

Thingy will scan your document for template tags, and prompt you for values before processing. This comes in handy when combined with project templates and date offsets:

# Pack for trip to [[City]]

Pack luggage for trip to [[City]]
  🏷 Home
  πŸ“† [[Departure Date]] -3
  ⚠️ [[Departure Date]] -1

Take out the trash before leaving for [[City]]
  🏷 Home
  πŸ“† [[Departure Date]]
  ⚠️ [[Departure Date]]

Note that template tag names are case sensitive, and can only contain letters, numbers, spaces, and underscores. Thingy will not prompt you for values for any built-in Drafts template tags your document contains.

About

A Things Parser for Drafts 5

https://actions.getdrafts.com/g/1HW


Languages

Language:JavaScript 100.0%