Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fix typo in grouping.md (filenameWithoutExtension) #2369

Conversation

andrewmwhite
Copy link
Contributor

Description

The docs refer to task.file.filename.filenameWithoutExtension, which is undefined. The correct path is task.file.filenameWithoutExtension.

Motivation and Context

n/a

How has this been tested?

Locally.

Screenshots (if appropriate)

Types of changes

Changes visible to users:

  • Bug fix (prefix: fix - non-breaking change which fixes an issue)
  • New feature (prefix: feat - non-breaking change which adds functionality)
  • Breaking change (prefix: feat!! or fix!! - fix or feature that would cause existing functionality to not work as expected)
  • Documentation (prefix: docs - improvements to any documentation content for users)
  • Sample vault (prefix: vault - improvements to the Tasks-Demo sample vault)
  • Contributing Guidelines (prefix: contrib - any improvements to documentation content for contributors - see Contributing to Tasks)

Internal changes:

  • Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)
  • Infrastructure (prefix: chore - examples include GitHub Actions, issue templates)

Checklist

Terms

@claremacrae
Copy link
Collaborator

Good spot - and thank you very much for the fix...

This is interesting to me on many levels...

tl;dr

I will accept the change - thanks!

The text is definitely a typo - but surprisingly it does actually behave as documented...

After I've merged the PR, I'll go ahead and update the bit of the Tasks automated tests that generates this text, to prevent the error coming back again next time I update the docs...

1. The documentation is machine-generated from the automated tests..

This is one of a lot of pieces in the Tasks documentation that is machine-generated and automatically tested.

Your correction is inside these lines - see the include: on the first line, and the endInclude on the last..

<!-- placeholder to force blank line before included text --><!-- include: CustomGroupingExamples.test.file_properties_task.file.filename_docs.approved.md -->
```javascript
group by function task.file.filename
```
- Like 'group by filename' but does not link to the file.
```javascript
group by function task.file.filename.filenameWithoutExtension + (task.hasHeading ? (' > ' + task.heading) : '')
```
- Like 'group by backlink' but does not link to the heading in the file.
<!-- placeholder to force blank line after included text --><!-- endInclude -->

And here is the bit of the source-code that contains the data that generates the text that later gets inserted in the docs....

[
'task.file.filename',
[
['group by function task.file.filename', "Like 'group by filename' but does not link to the file"],
[
"group by function task.file.filename.filenameWithoutExtension + (task.hasHeading ? (' > ' + task.heading) : '')",
"Like 'group by backlink' but does not link to the heading in the file",
],
],
SampleTasks.withAllRootsPathsHeadings(),
],

2. The output of the tests looks good...

That test, run on a selection of tasks, generates this output:

Results of custom groupers
group by function task.file.filename
Like 'group by filename' but does not link to the file.
=>
_c_.md
a_b_c.md
b.md
c.md
====================================================================================
group by function task.file.filename.filenameWithoutExtension + (task.hasHeading ? (' > ' + task.heading) : '')
Like 'group by backlink' but does not link to the heading in the file.
=>
undefined
undefined > a_b_c
undefined > c
undefined > heading
undefined > heading _italic text_
====================================================================================

So yes you're definitely correct that the text is not what was intended...

And also, looking at the files generated by running that test, is shows that the code does actually work (surprisingly...)

3. Oh the irony...

I've given a few conference lightning talks on the technique I'm using...

So yes, the tests work and the sample in the documentation works - but it is also still not 'correct'!

@claremacrae claremacrae added the scope: documentation Improvements or additions to documentation label Oct 24, 2023
@claremacrae
Copy link
Collaborator

Irony on irony....

And also, looking at the files generated by running that test, is shows that the code does actually work (surprisingly...)

Having updated the source code I see the changed output...

I was looking past all the undefined... The output was clearly wrong.

I will now need to search through the rest of the test output and make sure there are no more undefined that crept through!

😊

@claremacrae claremacrae changed the title Fix typo in docs (filenameWithoutExtension) docs: Fix typo in grouping.md (filenameWithoutExtension) Oct 24, 2023
@claremacrae claremacrae merged commit 3147016 into obsidian-tasks-group:main Oct 24, 2023
1 check passed
claremacrae added a commit that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants