Commit graph

46 commits

Author SHA1 Message Date
Damien Elmes
9f66e2cd0f update Rust deps 2022-01-15 14:59:43 +10:00
Damien Elmes
09e0666bfa move linkchecker into separate crate
The feature-based approach didn't work with cargo-raze, leading
to ./update.py in cargo/ breaking.
2021-12-20 17:27:43 +10:00
RumovZ
e1061393f2 New TTS/AV tag handling (#1559)
* Add new `card_rendering` mod

Parses a text with av/tts tags and strips or extracts tags.

* Replace old `extract_av_tags` and `strip_av_tags`

... with new `card_rendering` mod

* ressource -> resource

* Add AV prettifier for use in browser table

* Accept String in av tag routines

... and avoid redundant writes if no changes need to be made.

* add benchmarking with criterion; make links test optional (dae)

cargo install cargo-criterion, then run ./bench.sh

* performance comparison: creating HashMap up front (dae)

the previous solution:

anki_tag_parse          time:   [1.8401 us 1.8437 us 1.8476 us]

this solution:

anki_tag_parse          time:   [2.2420 us 2.2447 us 2.2477 us]
                        change: [+21.477% +21.770% +22.066%] (p = 0.00 < 0.05)
                        Performance has regressed.

* Revert "performance comparison: creating HashMap up front" (dae)

This reverts commit f19126a2f1.

* add missing header

* Write error message if tts lang is missing

* `Tag` -> `Directive`
2021-12-17 19:04:42 +10:00
Damien Elmes
8e5e22e21d update Rust deps 2021-12-03 20:35:53 +10:00
Damien Elmes
695871e66c Fix latest Rusqlite on Windows
https://github.com/bazelbuild/rules_rust/pull/1025
2021-11-19 10:44:02 +10:00
Damien Elmes
89b043c319 roll rusqlite back due to Windows breakage 2021-11-18 21:39:23 +10:00
Damien Elmes
c5c41759b4 update Rust deps 2021-11-18 20:58:41 +10:00
RumovZ
5c64aadb7a Garbage collect unused Fluent strings (#1482)
* Canonify import of i18n module

Should always be imported as `tr`, or `tr2` if there is a name collision
(Svelte).

* Add helper for garbage collecting ftl strings

Also add a serializer for ftl asts.

* Add helper for filter-mapping `DirEntry`s

* Fix `i18n_helpers/BUILD.bazel`

* run cargo-raze

* Refactor `garbage_collection.rs`

- Improve helper for file iterating
- Remove unused terms as well
- Fix issue with checking for nested messages by switching to a regex-
based approach (which runs before deleting)
- Some more refactorings and lint fixes

* Fix lints in `serialize.rs`

* Write json pretty and sorted

* Update `serialize.rs` and fix header

* Fix doc and remove `dbg!`

* Add binaries for ftl garbage collection

Also relax type constraints and strip debug tests.

* add rust_binary targets for i18n helpers (dae)

* add scripts to update desktop usage/garbage collect (dae)

Since we've already diverged from 2.1.49, we won't gain anything
from generating a stable json just yet. But once 2.1.50 is released,
we should run 'ftl/update-desktop-usage.sh stable'.

* add keys from AnkiMobile (dae)

* Mention caveats in `remove-unused.sh`
2021-11-12 18:19:01 +10:00
Damien Elmes
dae1854106 update Rust deps with cargo-raze 0.13.0 2021-10-26 08:16:40 +10:00
RumovZ
ea9fc3730e Switch CardInfoDialog to ts page (#1414)
* Only collect card stats on the backend ...

... instead of rendering an HTML string using askama.

* Add ts page Card Info

* Update test for new `col.card_stats()`

* Remove obsolete CardStats code

* Use new ts page in `CardInfoDialog`

* Align start and end instead of left and right

Curiously, `text-align: start` does not work for `th` tags if assigned
via classes.

* Adopt ts refactorings after rebase

#1405 and #1409

* Clean up `ts/card-info/BUILD.bazel`

* Port card info logic from Rust to TS

* Move repeated field to the top

https://github.com/ankitects/anki/pull/1414#discussion_r725402730

* Convert pseudo classes to interfaces

* CardInfoPage -> CardInfo

* Make revlog in card info optional

* Add legacy support for old card stats

* Check for undefined instead of falsy

* Make Revlog separate component

* drop askama dependency (dae)

* Fix nightmode for legacy card stats
2021-10-14 19:22:47 +10:00
Damien Elmes
79aa52c082 update Rust deps 2021-10-02 20:42:03 +10:00
RumovZ
059774cc9b Add links.rs for checking and building links 2021-07-22 10:03:03 +02:00
Damien Elmes
ef4289b4be strip invalid Unicode chars in media check 2021-07-17 18:30:19 +10:00
Damien Elmes
1e2ebd1c29 move from Python's URI escaping to IRI escaping in Rust
Should make non-Latin text readable in the HTML editor, without the
breakages reverted in the previous change.
2021-07-16 10:38:00 +10:00
Damien Elmes
33a9afaa1b add back in missing check for upload size
Compression now happens up-front, so we can tell in advance if the
upload size has been exceeded.
2021-06-29 10:50:03 +10:00
Damien Elmes
14a2cc44ac update to latest rusqlite 2021-06-25 16:22:21 +10:00
Damien Elmes
795afb7068 update most rust deps; skip rusqlite 2021-06-25 15:35:25 +10:00
Damien Elmes
63f183958a add rustls-native-certs
closes #1241
2021-06-18 18:15:41 +10:00
Damien Elmes
22828ad981 update Rust deps 2021-06-18 18:12:06 +10:00
Damien Elmes
596e37cabc update Rust deps 2021-06-16 16:10:57 +10:00
Damien Elmes
f9d5eda3f8 update Rust deps 2021-05-07 18:22:27 +10:00
Damien Elmes
d76ef9cde5 update Rust deps
- tokio 1.0
- updated reqwest, thanks to Rumo
- other minor dep updates

the reqwest build file has been split into two, as it was awkward
to manually update the combined file, and the platform gate is now
on the target in rslib/
2021-04-27 22:18:12 +10:00
Damien Elmes
2392c9b2b5 drop dependency on failure crate 2021-04-01 17:21:13 +10:00
Damien Elmes
2338998304 update to the latest rules_rust + security framework update 2021-03-27 19:28:19 +10:00
Damien Elmes
0a4bcd3faa update Rust deps 2021-03-27 14:47:16 +10:00
Damien Elmes
66d84336d7 update to latest Fluent 2021-03-27 13:24:11 +10:00
Damien Elmes
0c63a7c8c4 rework translation handling
Instead of generating a fluent.proto file with a giant enum, create
a .json file representing the translations that downstream consumers
can use for code generation.

This enables the generation of a separate method for each translation,
with a docstring that shows the actual text, and any required arguments
listed in the function signature.

The codebase is still using the old enum for now; updating it will need
to come in future commits, and the old enum will need to be kept
around, as add-ons are referencing it.

Other changes:

- move translation code into a separate crate
- store the translations on a per-file/module basis, which will allow
us to avoid sending 1000+ strings on each JS page load in the future
- drop the undocumented support for external .ftl files, that we weren't
using
- duplicate strings in translation files are now checked for at build
time
- fix i18n test failing when run outside Bazel
- drop slog dependency in i18n module
2021-03-26 09:41:32 +10:00
Damien Elmes
0d4e70fa64 roll back slog-term due to Windows break (2/2)
The cargo.toml update was missing from the previous commit, and term
was included directly when it didn't need to be.
2021-03-10 13:28:32 +10:00
Damien Elmes
a5c2766a71 roll back slog-term due to Windows breakage 2021-03-10 12:22:11 +10:00
Damien Elmes
79e6de24ae add strum crate 2021-03-10 11:53:27 +10:00
Damien Elmes
f8e023d56b update Rust deps 2021-03-10 11:53:27 +10:00
Damien Elmes
62b23d1bb9 experimental queue building
Still a work in progress, and hidden behind a feature flag.
2021-03-01 12:18:21 +10:00
Damien Elmes
2edd992020 render deck description with markdown; strip images
To support images on that screen, we'll first need to adjust the base url
for each platform, or rewrite the local image URLs, as otherwise they
are resolved to _anki/pages/...
2021-02-06 15:02:40 +10:00
Damien Elmes
3cae1b4cac sanitize deck description in decks screen on backend
Looks like ammonia only adds about 800k to the release binary
2021-02-06 13:42:38 +10:00
Damien Elmes
b87fc8e0fc pin proc_macro_nested due to Windows breakage 2021-02-03 21:17:11 +10:00
Damien Elmes
192c9a5418 update Rust deps 2021-02-03 20:29:48 +10:00
Damien Elmes
43e05aff6c update Rust deps; add async_trait 2021-01-11 19:19:45 +10:00
Damien Elmes
26c13f6dba add aarch64 Linux to cargo; update deps 2020-12-30 13:33:16 +10:00
Damien Elmes
2074bb03b6 update prost to new 0.7 release+auto stage changes
Allows us to drop slow git repo.
2020-12-28 10:12:35 +10:00
Damien Elmes
d222686755 update to stable pyo3 0.13 release 2020-12-23 10:08:38 +10:00
Damien Elmes
c17471f905 update Rust deps 2020-12-23 10:06:35 +10:00
Damien Elmes
cdea17e4f8 update Rust deps 2020-12-18 11:56:28 +10:00
cecini
77a94c8a45 Update rslib dep nom 2020-12-15 08:19:52 +00:00
Damien Elmes
15f697aa30 bump rust deps 2020-12-09 15:34:43 +10:00
Damien Elmes
1315d8b3c1 update Rust deps incl. Pyo3
This includes the refcount bug fix from pyo3 0.12.4
2020-12-01 16:48:45 +10:00
Damien Elmes
2f9ddadf2c switch to workspace for Rust code 2020-11-24 18:41:03 +10:00
Renamed from cargo/Cargo.lock (Browse further)