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

fix: empty en-todo fixed #431

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/turndown-rules/task-items-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export const taskItemsRule = {
const prefix = yarleOptions.outputFormat === OutputFormat.LogSeqMD ? '' :
node.parentElement?.nodeName?.toUpperCase() === 'LI' ? '' : '- ';

return `${prefix}${(nodeProxy.checked.value === 'true' ? '[x]' : '[ ]')} ${content}`;
return `${prefix}${(nodeProxy.checked && nodeProxy.checked.value === 'true' ? '[x]' : '[ ]')} ${content}`;
},
};
27 changes: 27 additions & 0 deletions test/data/test-empty-en-todo.enex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export4.dtd">
<en-export export-date="20221205T171453Z" application="Evernote Beta" version="10.47.7">
<note>
<title>test-empty-en-todo</title>
<created>20160804T143332Z</created>
<updated>20160809T172613Z</updated>
<tag>WorkLog</tag>
<tag>AU_RA</tag>
<note-attributes>
<source>desktop.mac</source>
</note-attributes>
<content>
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note>
<div><i><b>For this week</b></i></div>
<ul>
<li><i><b><en-todo checked="true"/></b></i>Add view_post_X_forum variable</li>
<li><en-todo checked="true"/>Handle the two non-_ttl variables to allow for analysis</li>
<li><en-todo/>Begin stepwise regression work</li>
</ul>
<div><br/></div>
</en-note> ]]>
</content>
</note>
</en-export>
16 changes: 16 additions & 0 deletions test/data/test-empty-en-todo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# test-empty-en-todo

---
Tag(s): #WorkLog #AU/RA

---

_**For this week**_

* Add view\_post\_X\_forum variable
* [x] Handle the two non-\_ttl variables to allow for analysis
* [ ] Begin stepwise regression work

Created at: 2016-08-04T15:33:32+01:00
Updated at: 2016-08-09T18:26:13+01:00

13 changes: 13 additions & 0 deletions test/yarle-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,19 @@ export const yarleTests: Array<YarleTest> = [
expectedOutputPath: `${dataFolder}test-sublists.md`,
},

{
name: 'Note empty en-todo',
options: {
enexSources: [ `.${testDataFolder}test-empty-en-todo.enex` ],
outputDir: 'out',
isMetadataNeeded: true,
},
testOutputPath: `notes${path.sep}test-empty-en-todo${path.sep}test-empty-en-todo.md`,

testModifier: YarleTestModifierOptions.only,
expectedOutputPath: `${dataFolder}test-empty-en-todo.md`,
},

{
name: 'Note with sublists (valid html)',
options: {
Expand Down