Closed jun6lee closed 8 months ago
@jun6lee Thank you for your interest in the plugin.
I briefly reviewed your PR, lgtm but as I can see, the annotationStyle
is unused within the template. Furthermore, you said that
Will share a suggested template for anyone looking to do the same, once we have the fields.
Would it make more sense for you to update the PR to introduce colors for the highlights? Without it, the PR looks a bit unfinished. Ultimately, these changes can then be reflected in documentation as "advanced" template customization for those who want (or need) color differentiation in their book highlights. What do you think?
Thanks
Sure thing.
I was looking to do something like this which I was using on another plugin:
---
book: {{library.ZSORTTITLE}}
author: {{library.ZAUTHOR}}
language: {{library.ZLANGUAGE}}
last_opened: {{dateFormat library.ZLASTOPENDATE "YYYY/MM/DD HH:mm:ss" }}
tags:
- highlights/iBooks
---
# ๐ {{library.ZSORTTITLE}}
---
{{#if library.ZBOOKDESCRIPTION}}
## ๐งพ Description
---
{{{library.ZBOOKDESCRIPTION}}}
{{/if}}
### ๐ Highlights
---
{{#group annotation by="ZFUTUREPROOFING5"}}
#### ๐{{value}}
---
{{#each items}}
{{#if ZANNOTATIONSELECTEDTEXT}}
{{#is ZANNOTATIONSTYLE 5}}
- ๐ฏ <mark style="background: #C4B3D9;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 4}}
- ๐ฏ <mark style="background: #E6A5AB;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 3}}
- ๐ฏ <mark style="background: #EDD570;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 2}}
- ๐ฏ <mark style="background: #A8BADE;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 1}}
- ๐ฏ <mark style="background: #B0D17F;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 0}}
- ๐ฏ <mark style="background: #FFD9B3;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{/if}}
{{#if ZANNOTATIONNOTE}}
- โ๏ธ {{ZANNOTATIONNOTE}}
{{/if}}
<sub>Highlighted: {{dateFormat ZANNOTATIONCREATIONDATE "YYYY/MM/DD HH:mm:ss" }}</sub>
---
{{/each}}
{{/group}}
Source:: [Apple Books Link](ibooks://assetid/{{library.ZASSETID}})
If you could push what I've added so far, I can test this and share an advanced_template file in a day or two.
Would that work for you?
I also think I may need to add an apple date converter proc, which I have on standby.
const APPLE_EPOCH_START = new Date("2001-01-01").getTime(); --- been able to dig out that Apple does a weird thing with EPOCH timestamps, so start with this.
and feed the ZANNOTATIONMODIFICATIONDATE or ZANNOTATIONCREATIONDATE something like this:
modifiedAt: convertAppleTime(r.modifiedAt),
createdAt: convertAppleTime(r.createdAt),
using
function convertAppleTime(appleTime) {
return new Date(APPLE_EPOCH_START + appleTime * 1000).getTime();
}
@jun6lee Thanks for sharing.
I was looking to do something like this which I was using on another plugin:
I see no problems integrating colors into the template and provide it as an example of advanced customization. You also saved me time for testing the mapping of ZANNOTATIONSTYLE
numbers to their respective colors ๐
If you could push what I've added so far, I can test this and share an advanced_template file in a day or two.
I'm now in the middle of releasing a new version and will get back to the colored template in a day or two as well, so basically I can pick up your PR #1 where you left off and add all the necessary changes, if you don't mind.
As for the time, it looks doable, but it's definitely a separate improvement. I would like to check it on my side.
Works for me, no rush. :)
Have raised a PR for the same.
Aiming for something like this:
Will share a suggested template for anyone looking to do the same, once we have the fields.