Bookly is very useful. The first page contains this copyright notice: “This version of can be viewed and downloaded free of charge for personal use only. It must not be redistributed, sold, or used in derivative works.” I wish to edit these 2 sentences. How to do it?
Well, it seems the package has a bug. The manual states that
If you need to use a language that is not supported by default, you can modify the states.localization dictionary when initializing the template. For example, to add support for Dutch, you can do the following
#states.localization.update(json("path_to_file/dutch.json")). The JSON file should contain the translations of the terms used in the document.
Which also includes the option to change the copyright notice, "version-usage": "This version of can be viewed and downloaded free of charge for personal use only. It must not be redistributed, sold, or used in derivative works."
But actually, this doesn’t work (e.g. adding #states.localization.update(("version-usage": "new version usage")) has no effect). After digging through the source code, bookly seemingly just resets the localization dictionary to a default value:
// Localization
let bookly-lang = if default-language.contains(lang) {
lang
} else {
"en"
}
states.localization.update(json("resources/i18n/" + bookly-lang + ".json"))
So localization can only be changed after initializing the template. Best course of action would be to open an issue/PR and fix the bug, and in the meantime you can import the files locally and use the local files.
This is doubly unfortunate as the default text has a grammatical mistake, “This version of can be …”.
A hacky solution which avoids copying all the files locally is to use a show rule to change all occurrences of the default version-usage string. Note that this will most likely break if the version-usage string is ever updated by bookly.
// HACKY! Will likely break in future bookly updates!
#let bookly-default-version-usage = "This version of can be viewed and downloaded free of charge for personal use only. It must not be redistributed, sold, or used in derivative works."
#show bookly-default-version-usage: "Feel free to change the license"
@aarnent Thank you for the answer. I will correct the grammatical mistake and add a parameter to modify the version-usage if needed.
Regarding the dictionary, you are absolutely right. You need to update the state after the template initilization. But that doesn’t allow to modify the version-usage.
Thank you for your answer. I do have such technical knowledge. The reasons I wanted to change “default-version-usage” are: (1) grammatical mistakes in the original message; (2) the software (package) has copyright belonged to the author of the package, which was given under a license to the user; (3) the copyright of the content (book contents) drafted by the user belongs to the user (thus there is another licence, which I have drafted and wished to incorporate into “default-version-usage”. I suppose the default-version-usage should be referring to the contents of the book to be drafted. Just wonder how you were able to read the source code. Thanks for the answer. I have to wait for the change by the author or draft a plain Typst file which resembles Bookly - I have been trying to do that for 2 days. Thanks for you help. Best wishes.
No problem. I noticed the package author @maucejo (who commented on the thread earlier) has already pushed some updates to version 3.2.0 that support changing the version-usage parameter, you can see the updated package here: GitHub - maucejo/bookly · GitHub
It seems there isn’t yet a PR made to the universe, so it will take at least a few days to merge after that has been made. If you can’t wait that long, the files on github seem stable enough so you can just download the files, unzip the src subdirectory into your project and import src/bookly.typ. Alternatively you can make a local package, but perhaps that’s a bit technical. Anyways, the new version allows you to change the version-usage via
#import "src/bookly.typ": *
#show: bookly.with(
...
title-page: book-title-page(
...
version-usage: "Feel free to change the license"
),
...
)
Regarding how to read the source code, almost all packages on the universe have their repository listed under the “About” section, and this is the case with bookly, too. If not, you can always find the release version in the universe repository, though these files are sometimes less readable: packages/packages/preview at main · typst/packages · GitHub
To complete the answer of @aarnent, I have to tell that you can provide your own title page in the title-page argument, since book-title-page is basically a function that returns a content. It is normally documented in the manual.
I will submit a PR for version 3.2.0 soon.