Skip to content

Commit

Permalink
fix: Tasks works with SlrVb's Alternative Checkboxes (#1174)
Browse files Browse the repository at this point in the history
* vault: Add some sample tasks with different states

* vault: Add "ITS Theme", to allow viewing custom checkboxes

* vault: Add #task tag to Custom Statuses.md

* vault: Add a tasks query showing the custom statuses

* fix: Tasks now honours capitalised custom statuses, such as '- [D]'

* vault: Add snippet 'S - Checkboxes.css'

Downloaded from:
https://github.com/SlRvb/Obsidian--ITS-Theme/blob/5fe6b3f0061e22f29e2c52a658d1b6132d81f24e/Snippets/S%20-%20Checkboxes.css

* Revert "vault: Add "ITS Theme", to allow viewing custom checkboxes"

This reverts commit 6d0ad07.

* vault: Add descriptive text to 'Custom Statuses.md'

* vault: Rename sample to "SlrVb's Alternative Checkboxes.md"
  • Loading branch information
claremacrae authored Sep 23, 2022
1 parent a5b1cf8 commit 1a889bc
Show file tree
Hide file tree
Showing 4 changed files with 984 additions and 1 deletion.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SlrVb's Alternative Checkboxes

## Background

This page demonstrates SlRvb's [Alternate-Checkboxes](https://github.com/SlRvb/Obsidian--ITS-Theme/blob/main/Guide/Alternate-Checkboxes.md) from the [ITS-Theme.](https://github.com/SlRvb/Obsidian--ITS-Theme), with the Tasks plugin installed.

It was created to test the fix for [Tasks Issue #520: In combination with SlrVb's S-Checkbox CSS, Task Plugin breaks that style](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/520).

## How to use this file

### Setup

1. Go to Settings > Appearance > **Enable the 'S - Checkboxes' snippet**
2. Optionally, install and enable the [Style Settings](obsidian://show-plugin?id=obsidian-style-settings) plugin.

### Use

The tasks below should look like one of the images in the [Alternate Checkboxes documentation](https://github.com/SlRvb/Obsidian--ITS-Theme/blob/main/Guide/Alternate-Checkboxes.md), depending on your display settings.

## One of each task status

- [ ] #task Unchecked
- [x] #task Regular
- [X] #task Checked
- [-] #task Dropped
- [>] #task Forward
- [D] #task Defer
- [?] #task Question
- [/] #task Half Done
- [+] #task Add
- [R] #task Research
- [!] #task Important
- [i] #task Idea
- [B] #task Brainstorm
- [P] #task Pro
- [C] #task Con
- [Q] #task Quote
- [N] #task Note
- [b] #task Bookmark
- [I] #task Information
- [p] #task Paraphrase
- [L] #task Location
- [E] #task Example
- [A] #task Answer
- [r] #task Reward
- [c] #task Choice

## Rendered in Tasks results block

```tasks
path includes Custom Statuses
group by filename
short mode
```
3 changes: 2 additions & 1 deletion src/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ export class Task {
const indentation = regexMatch[1];

// Get the status of the task, only todo and done supported.
const statusString = regexMatch[2].toLowerCase();
// But custom ones are retained and displayed as-is.
const statusString = regexMatch[2];
let status: Status;
switch (statusString) {
case ' ':
Expand Down
11 changes: 11 additions & 0 deletions tests/Task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ describe('parsing', () => {
resetSettings();
});

it('supports capitalised status characters', () => {
// See https://github.com/obsidian-tasks-group/obsidian-tasks/issues/520
// "In combination with SlrVb's S-Checkbox CSS, Task Plugin breaks that style"

// Act
const task = fromLine({ line: '- [D] this is a deferred task' });

// Assert
expect(task!.originalStatusCharacter).toStrictEqual('D');
});

it('allows signifier emojis as part of the description', () => {
// Arrange
const line = '- [x] this is a ✅ done task 🗓 2021-09-12 ✅ 2021-06-20';
Expand Down

0 comments on commit 1a889bc

Please sign in to comment.