You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello friend, I would like to help you with the implementation of text markup. Below I'll provide a simplified example of how you can approach this functionality in your project. Please note that this is a conceptual example.
First, here's a general approach to how you might implement the text markup functionality and save the markup:
1. User Interface:
Add an option to select and highlight text in reading view of the .jwpub file.
Add a button or option to save the markup.
2. Dialing Logic:
When text is selected and highlighted, capture the location of the markup (for example, the range of characters selected) and the content of the marked text.
Store this information in a suitable data structure, such as a JSON object.
3. Marking Storage:
You can use a separate JSON file to store the markup information.
Every time the markup is saved, it updates or adds entries to the JSON file.
4. Upload Marking:
When opening a .jwpub file for reading, it checks if there is any associated markup information in the JSON file.
If there are bookmarks stored, applies the bookmarks in reading view.
Here's a simplified example of how you might structure the code:
// En el código Kotlin (app/src/main/kotlin/...):// Almacenamiento de marcadoresval markersJsonFile =File("markers.json")
funsaveMarker(selectionRange:String, markedText:String) {
val markers = loadMarkers()
markers[selectionRange] = markedText
markersJsonFile.writeText(Json.encodeToString(markers))
}
funloadMarkers(): MutableMap<String, String> {
if (markersJsonFile.exists()) {
val markersJson = markersJsonFile.readText()
returnJson.decodeFromString(markersJson)
}
returnmutableMapOf()
}
Keep in mind that you will have to adapt it to the structure of the "Open Witness Library" project.
The text was updated successfully, but these errors were encountered:
Ooh, thank you for this! I will keep an eye on your suggestion. But there's a worry for making open witness library compatible with JW Library markups, since the backup file export markups too.
I don't know for now if I will add a new approach or try to decode the backup file approach (with seems to be very simple and optimized)
Anyway, thank you for this, I will assign a branch for this soon! 😄
Actually, JW Library Markup functionality have some kind of tokenization process to define which element will be inside a highlight. A token can be a word, a punctuation, a bible's chapter and verse set, and so on. Invalid tokens can be footnote links and paragraph (or verse) numbered indicators. For now, my implementation can include in a single markup only the current paragraph content, while JW Library can include whole paragraphs. The idea is keep both app structures compatible and synchronized in features, even they are a little incomplete and inaccurate. But for now there is another major problem, since JW Library supports a wide range of languages, the tokenization process can include different kind of what a word is for non alphabetic systems, like japonese, chinese, russian and others.
I don't know if I will track this issue for now, but certainly will take a look if there is some interest in this so in the future. Soon I will work better on this feature and close this issue.
Hello friend, I would like to help you with the implementation of text markup. Below I'll provide a simplified example of how you can approach this functionality in your project. Please note that this is a conceptual example.
First, here's a general approach to how you might implement the text markup functionality and save the markup:
1. User Interface:
2. Dialing Logic:
3. Marking Storage:
4. Upload Marking:
Here's a simplified example of how you might structure the code:
Keep in mind that you will have to adapt it to the structure of the "Open Witness Library" project.
The text was updated successfully, but these errors were encountered: