Skip to content

Commit

Permalink
Merge pull request #24 from Edo78/develop
Browse files Browse the repository at this point in the history
0.2.1
  • Loading branch information
Edo78 authored Jan 26, 2022
2 parents 879084e + 9a8a13b commit e3965d5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ by: [[<%= it.authors %>]]
## Chapter: <%= it.chapter %>
Page: <%= it.page %>
**==<%= it.highlight %>==**
<%= it.text %>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-koreader-plugin",
"name": "KOReader Highlights",
"version": "0.2.0",
"version": "0.2.1",
"minAppVersion": "0.12.0",
"description": "This is a plugin for Obsidian. This plugin syncs highlights and notes taken in KOReader.",
"author": "Federico \"Edo\" Granata",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-koreader-plugin",
"version": "0.2.0",
"version": "0.2.1",
"description": "This is a plugin for Obsidian. This plugin syncs highlights and notes taken in KOReader.",
"main": "main.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export default class KOReader extends Plugin {
}) {
const { path, uniqueId, bookmark, managedBookTitle, book, keepInSync } =
note;
// the page is always the first number in the bookmark's text (eg. 'Pagine 12 foo bar')
const page = parseInt(bookmark.text.match(/\d+/g)[0]);
const noteItself = bookmark.text
? bookmark.text.split(bookmark.datetime)[1].replace(/^\s+|\s+$/g, '')
: '';
Expand All @@ -129,6 +131,8 @@ by: [[<%= it.authors %>]]
## Chapter: <%= it.chapter %>
Page: <%= it.page %>
**==<%= it.highlight %>==**
<%= it.text %>`;
Expand All @@ -147,6 +151,7 @@ by: [[<%= it.authors %>]]
highlight: bookmark.notes,
text: noteItself,
datetime: bookmark.datetime,
page,
})) as string;

const frontmatterData: { [key: string]: FrontMatter } = {
Expand All @@ -156,6 +161,7 @@ by: [[<%= it.authors %>]]
title: book.title,
authors: book.authors,
chapter: bookmark.chapter,
page,
highlight: bookmark.notes,
datetime: bookmark.datetime,
text: noteItself,
Expand Down
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface FrontMatterData {
title: string;
authors: string;
chapter: string;
page: number;
highlight: string;
datetime: string;
text: string;
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"0.1.0": "0.12.0",
"0.1.1": "0.12.0",
"0.1.2": "0.12.0",
"0.2.0": "0.12.0"
"0.2.0": "0.12.0",
"0.2.1": "0.12.0"
}

0 comments on commit e3965d5

Please sign in to comment.