Skip to content

Commit

Permalink
Fix typos (#34)
Browse files Browse the repository at this point in the history
Found via `typos --hidden --format brief`
  • Loading branch information
kianmeng authored Sep 23, 2024
1 parent 541bc07 commit 42ebb0a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ One advantage of having such an interface is that one can easily use it for read

### Mobipocket and Kindle Files

It can read both MOBI and KF8 (.azw3, and combo .mobi files) from a `File` (or `Blob`) object. For MOBI files, it decompresses all text at once and splits the raw markup into sections at every `<mbp:pagebreak>`, instead of outputing one long page for the whole book, which drastically improves rendering performance. For KF8 files, it tries to decompress as little text as possible when loading a section, but it can still be quite slow due to the slowness of the current HUFF/CDIC decompressor implementation. In all cases, images and other resources are not loaded until they are needed.
It can read both MOBI and KF8 (.azw3, and combo .mobi files) from a `File` (or `Blob`) object. For MOBI files, it decompresses all text at once and splits the raw markup into sections at every `<mbp:pagebreak>`, instead of outputting one long page for the whole book, which drastically improves rendering performance. For KF8 files, it tries to decompress as little text as possible when loading a section, but it can still be quite slow due to the slowness of the current HUFF/CDIC decompressor implementation. In all cases, images and other resources are not loaded until they are needed.

Note that KF8 files can contain fonts that are zlib-compressed. They need to be decompressed with an external library. The demo uses [fflate](https://github.com/101arrowz/fflate) to decompress them.

Expand Down Expand Up @@ -237,7 +237,7 @@ A range CFI is an object `{ parent, start, end }`, each property being the same

The parser uses a state machine rather than regex, and should handle assertions that contain escaped characters correctly (see tests for examples of this).

It has the ability ignore nodes, which is needed if you want to inject your own nodes into the document without affecting CFIs. To do this, you need to pass the optional filter function that works similarily to the filter function of [`TreeWalker`s](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker):
It has the ability ignore nodes, which is needed if you want to inject your own nodes into the document without affecting CFIs. To do this, you need to pass the optional filter function that works similarly to the filter function of [`TreeWalker`s](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker):

```js
const filter = node => node.nodeType !== 1 ? NodeFilter.FILTER_ACCEPT
Expand Down Expand Up @@ -356,7 +356,7 @@ document.querySelector('foliate-quoteimage').getBlob({

The main use of the library is for use in [Foliate](https://github.com/johnfactotum/foliate), which uses WebKitGTK. As such it's the only engine that has been tested extensively. But it should also work in Chromium and Firefox.

Apart from the renderers, using the modules outside browsers is also possible. Most features depend on having the global objects `Blob`, `TextDecoder`, `TextEncoder`, `DOMParser`, `XMLSerializer`, and `URL`, and should work if you polyfill them. Note that `epubcfi.js` can be used as is in any envirnoment if you only need to parse or sort CFIs.
Apart from the renderers, using the modules outside browsers is also possible. Most features depend on having the global objects `Blob`, `TextDecoder`, `TextEncoder`, `DOMParser`, `XMLSerializer`, and `URL`, and should work if you polyfill them. Note that `epubcfi.js` can be used as is in any environment if you only need to parse or sort CFIs.

## License

Expand Down
2 changes: 1 addition & 1 deletion epub.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const pathRelative = (from, to) => {
const pathDirname = str => str.slice(0, str.lastIndexOf('/') + 1)

// replace asynchronously and sequentially
// same techinque as https://stackoverflow.com/a/48032528
// same technique as https://stackoverflow.com/a/48032528
const replaceSeries = async (str, regex, f) => {
const matches = []
str.replace(regex, (...args) => (matches.push(args), null))
Expand Down
6 changes: 3 additions & 3 deletions pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const annotationLayerBuilderCSS = `
--input-disabled-border-color: GrayText;
--input-hover-border-color: Highlight;
--link-outline: 1.5px solid LinkText;
--hcm-highligh-filter: invert(100%);
--hcm-highlight-filter: invert(100%);
}
.annotationLayer .textWidgetAnnotation :is(input, textarea):required,
.annotationLayer .choiceWidgetAnnotation select:required,
Expand All @@ -159,7 +159,7 @@ const annotationLayerBuilderCSS = `
}
.annotationLayer .linkAnnotation:hover {
backdrop-filter: var(--hcm-highligh-filter);
backdrop-filter: var(--hcm-highlight-filter);
}
.annotationLayer .linkAnnotation > a:hover {
Expand All @@ -180,7 +180,7 @@ const annotationLayerBuilderCSS = `
left: 0;
width: 100%;
height: 100%;
backdrop-filter: var(--hcm-highligh-filter);
backdrop-filter: var(--hcm-highlight-filter);
content: "";
pointer-events: none;
}
Expand Down
4 changes: 2 additions & 2 deletions search.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ export const search = (strs, query, options) => {
}

export const searchMatcher = (textWalker, opts) => {
const { defalutLocale, matchCase, matchDiacritics, matchWholeWords } = opts
const { defaultLocale, matchCase, matchDiacritics, matchWholeWords } = opts
return function* (doc, query) {
const iter = textWalker(doc, function* (strs, makeRange) {
for (const result of search(strs, query, {
locales: doc.body.lang || doc.documentElement.lang || defalutLocale || 'en',
locales: doc.body.lang || doc.documentElement.lang || defaultLocale || 'en',
granularity: matchWholeWords ? 'word' : 'grapheme',
sensitivity: matchDiacritics && matchCase ? 'variant'
: matchDiacritics && !matchCase ? 'accent'
Expand Down

0 comments on commit 42ebb0a

Please sign in to comment.