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

Bookmark titles or comments? #3415

Closed
embryo10 opened this issue Oct 23, 2017 · 19 comments
Closed

Bookmark titles or comments? #3415

embryo10 opened this issue Oct 23, 2017 · 19 comments
Labels

Comments

@embryo10
Copy link

embryo10 commented Oct 23, 2017

This is not an issue.
On the contrary, its about a new (as of 2015.11-1370) feature, the Tap-edit bookmarks #3369.
Now that we can just click on a highlight and change its title, I think that its almost like adding a comment about the highlight.
I did read them with the KoHighlights app like this
screen1
and I wonder if I should call them comments.
If there is a plan (or a reason) to add another kind of comments to the highlights, then I should call these bookmarks titles something different to avoid the confusion.
Any suggestions?

@Frenzie
Copy link
Member

Frenzie commented Oct 24, 2017

@poire-z @robert00s ?

@embryo10
Copy link
Author

While adding the ability to edit the title/comment from the PC, I observed that although the "Edit" dialog does not let you create a multi-line text, it does shows it to you (if it is) and lets you edit it.

Since the bookmarks seems to be working fine, do you think it is dangerous to not restrict the text to a single line?

FYI the new line is written the same way as the new line in the highlighted text.

@Frenzie
Copy link
Member

Frenzie commented Oct 24, 2017

Sounds more like a missing feature on the KOReader side to me. :-)

@KenMaltby
Copy link

I tried to add text to a highlighted paragraph, as a note, using the "rename" function, when it was first proposed. I could add a note but it wouldn't save, with the highlight. I saw it as a good way to add a much asked for note taking function/feature. I didn't try it in a .pdf. It might have worked there as the highlight is reportedly added directly into the .pdf itself.

@embryo10
Copy link
Author

The "Edit"/"Rename" function of the reader works fine in the 2015.11-1370 version.
This is how I enter the initial titles and started the experiments...
Tested in epub and pdf.

@Frenzie
Copy link
Member

Frenzie commented Oct 24, 2017

It does save it but wrt highlight there's some kind of display issue.

        [3] = {
            ["page"] = "/body/DocFragment[3]/body/div/div[1]/p/text().720",
            ["highlighted"] = true,
-- this is displayed in the details view
            ["notes"] = "began\
 a successful career in London as an actor, writer, and part owner of the playing company the Lord Chamberlain's Men, later known as the King's Men. He appears to have retired to Stratford around 1613, where he died three years later. Few records of Shakespeare's private life survive, and there has been considerable speculation about such matters as his sexuality, religious beliefs, and whether the works attributed to him were written by others. Shakespeare produced most of his known work between 1590 and 1613. His early plays were mainly comedies and histories, genres he raised to the peak of sophistication and artistry by the end of the sixteenth century. Next he wrote mainly tragedies until about",
            ["datetime"] = "2017-10-24 15:05:11",
            ["pos0"] = "/body/DocFragment[3]/body/div/div[1]/p/text().720",
            ["pos1"] = "/body/DocFragment[3]/body/div/div[1]/p/text().1433",
-- this is (partially) displayed in the "Bookmarks" dialog
-- and also when you click "rename bookmark"
            ["text"] = "Page 5 beganddd a successful career in London as an actor, writer, and part owner of the playing company the Lord Chamberlain's Men, later known as the King's Men. He appears to have retired to Stratford around 1613, where he died three years later. Few records of Shakespeare's private life survive, and there has been considerable speculation about such matters as his sexuality, religious beliefs, and whether the works attributed to him were written by others. Shakespeare produced most of his known work between 1590 and 1613. His early plays were mainly comedies and histories, genres he raised to the peak of sophistication and artistry by the end of the sixteenth century. Next he wrote mainly tragedies until about dddddddfffff @ 2017-10-24 15:05:11"
        }

Pinging @robert00s

@poire-z
Copy link
Contributor

poire-z commented Oct 24, 2017

I don't use much bookmarks nor highlights, and never tried KOhighlights. But see #3275 for some other comments about .. comments , notes and how these can be used.
I don't know if there will be other fields to highlights and bookmarks, I haven't read any issue asking for more.
I don't think multiline should be a problem.

I don't know what KOhighlights uses from the metadata.lua, but it seems we have:

    ["bookmarks"] = {
        [2] = {
            ["page"] = "/body/DocFragment[6]/body/p[1]/text().213",
            ["highlighted"] = true,
            ["notes"] = "exclusivement théorique",
            ["datetime"] = "2017-10-24 15:29:19",
            ["pos0"] = "/body/DocFragment[6]/body/p[1]/text().213",
            ["pos1"] = "/body/DocFragment[6]/body/p[1]/text().236",
            ["text"] = "i edited this"
        },
        [1] = {
            ["page"] = "/body/DocFragment[6]/body/p[1]/text().394",
            ["highlighted"] = true,
            ["notes"] = "mode de vie",
            ["datetime"] = "2017-10-24 15:28:57",
            ["pos1"] = "/body/DocFragment[6]/body/p[1]/text().405",
            ["pos0"] = "/body/DocFragment[6]/body/p[1]/text().394"
        }
    },
    ["highlight"] = {
        [10] = {
            [2] = {
                ["pos0"] = "/body/DocFragment[6]/body/p[1]/text().213",
                ["drawer"] = "lighten",
                ["datetime"] = "2017-10-24 15:29:19",
                ["pos1"] = "/body/DocFragment[6]/body/p[1]/text().236",
                ["text"] = "exclusivement théorique"
            },
            [1] = {
                ["pos0"] = "/body/DocFragment[6]/body/p[1]/text().394",
                ["drawer"] = "lighten",
                ["datetime"] = "2017-10-24 15:28:57",
                ["pos1"] = "/body/DocFragment[6]/body/p[1]/text().405",
                ["text"] = "mode de vie"
            }
        }
    },

and one needs to go to Bookmarks, for the bookmarks sorting stuff to create the text fields:

    ["bookmarks"] = {
        [1] = {
            ["page"] = "/body/DocFragment[6]/body/p[1]/text().394",
            ["highlighted"] = true,
            ["notes"] = "mode de vie",
            ["datetime"] = "2017-10-24 15:28:57",
            ["pos0"] = "/body/DocFragment[6]/body/p[1]/text().394",
            ["pos1"] = "/body/DocFragment[6]/body/p[1]/text().405",
            ["text"] = "Page 10 mode de vie @ 2017-10-24 15:28:57"    -- this here
        },

So, bookmark["notes"] seems to contain the selected text, and can not be changed.
bookmark["text"] is what may be nil, may at some point contain "Page 10 mode de vie @ 2017-10-24 15:28:57", and may be edited to anything (this "Page 10...+ something, this "Page 10... truncated, this "Page 10... replaced by "I edited this").

Do you distinguish text from non edited (so not interesting) to edited ?

From a quick glance at readerbookmark.lua and readerhighlight.lua, it seems bookmark["text"] is only used for display, so it shouldn't break anything if you edit it to anything, including new lines, as they work in the edit text widget (but check that if you put a new line at the beginning of text, it does not screw up the Bookmarks windows, and that the line does not mess up with the next entry).
The bookmark["notes"] should not be changed, as it contain the original text and is used to find the matching highlight["text"] for bookmarks and highlights to be kept in sync when deleting one or the other.

@embryo10
Copy link
Author

@poire-z
Yes, this is what I do.
I don't write to bookmarks["notes"] .
The bookmarks of epub's metadata have a "text" key always in the default format of

Page nr Highlight Text @ Date nr

So if the highlight["text"] matches the bookmarks["text"] I conclude that its not edited.
The bookmarks of pdf's metadata do not have a "text" key if I don't edit it, so that's how I know for that format.
I didn't check other formats, but I will in the future.

I tested the line break in the beginning of the name and it works OK.
The only display problem is in the Bookmarks view
screen2
but I don't think that its serious...

@KenMaltby
Copy link

With 1373, the added text stays in the "rename/edit" display, both for that under the "Edit" button, from a tap on the highlighted text -and- in the rename box after the "Rename this bookmark" button in the "Bookmark details" page you get if you long press on the bookmark listing. But it won't show in the Bookmark details page itself.

@Frenzie
Copy link
Member

Frenzie commented Oct 24, 2017

@embryo10
Looks like the same issue exists if you just highlight some text with a linebreak in the right spot. Nothing for you to worry about I'd say.

@embryo10
Copy link
Author

@KenMaltby Aaa, now I understood what you meant!

@KenMaltby
Copy link

I was hoping to do something like you are doing with your Highlights program, but on the device itself. After all, it is all there, I thought it might not be too hard to just append something to the "Bookmark details" wherever it is stored. Or add the associated note to the construction of the details page, if the note needed to be stored elsewhere.

@poire-z
Copy link
Contributor

poire-z commented Oct 24, 2017

OK, the "Bookmark details" shows only bookmark["notes"] = the highlighted text, that should not be changed.
May be each bookmark entry deserves a "edited" = true key, and if true, Bookmarks details should include/append bookmark["text"], although there is now way to know it the edited stuff still contains the original text, or it the user has edited it out to add his own words...

edit: Or just a bookmark["comment"] that would contain the edited text, and wherever bookmark["text"] is used for getting something to display, should be replaced by blah = bookmark["comment"] or bookmark["text"].

I didn't check other formats, but I will in the future.

There's not really other kind of documents, it's either crengine/epub/xpointers, or not (pdf/stable pages).

So if the highlight["text"] matches the bookmarks["text"] I conclude that its not edited.

I think it can also be nil if the user has not gone to display Bookmarks, which would mean it's not edited. Dunno if you took care of that case.

@embryo10
Copy link
Author

@poire-z The way I check for edits in the bookmarks is this.
There are three possible situations:

  • No "text" key at all. Could be a pdf or an epub before displaying Bookmarks (as you said)
  • A "text" key with the highlight["text"] in some form (I check it with regex)
  • A "text" key with some other text in it

I consider the first two as "Unedited" and the third as "Edited"

@KenMaltby
Copy link

So for now there is a hidden note taking function. The added text remains with the associated highlight and is viewable, that way, by again opening the Edit/Rename function. So it is being kept someplace, as it is still there after a restart of KOReader.

@embryo10
Copy link
Author

embryo10 commented Oct 25, 2017

Just realized that I still don't know how should I call the edited text...

Well, I'll go with the "Comment" for now, since I don't think that a new field will be added in the ".sdr format" anytime soon (apart for the "edited" boolean).
If something changes, I'll update the app..

@poire-z
Copy link
Contributor

poire-z commented May 24, 2018

@embryo10 : does KoHighlights include the ability to reinject saved highlights into a fresh metadata.lua (think the user Purge .sdr, and would use your tool to add back the highlights/bookmarks) ?
In which case you may need now to remember another setting key cre_dom_version as the highlights xpaths may change when we fix thing (details in #3940).
If it doesn't include that feature, don't worry and ignore my comment :)

@embryo10
Copy link
Author

@poire-z : no, it can not add highlights. It can only edit, delete or copy them.
I just save the text. No other data (like position) is saved.
To add a highlight, I should be able to open the book for the user to select the position in the text that the highlight would be.
Too lazy to do that just for a highlight ;o)

@poire-z
Copy link
Contributor

poire-z commented Jul 5, 2018

Question answered, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants