Commit graph

77 commits

Author SHA1 Message Date
mmd-osm
ac42afefcd OCI: ignore invalid replacement token 2024-09-21 09:17:03 +02:00
Anton Khorev
6be766d015 Skip paragraphs with no text when looking for richtext description 2024-08-07 08:02:19 +03:00
Anton Khorev
88a7ca5625 Truncate long richtext descriptions 2024-08-07 08:02:06 +03:00
Anton Khorev
e5279dacde Detect <p> as richtext paragraph 2024-08-07 08:01:48 +03:00
Anton Khorev
aa8dd75e5e Use first paragraph as richtext description 2024-08-07 08:01:48 +03:00
Anton Khorev
097a414b22 Add a blank richtext description method 2024-08-07 08:01:14 +03:00
Anton Khorev
69a2d5f4d4 Add image_alt accessor to rich text 2024-08-05 05:08:44 +03:00
Anton Khorev
37edcb113a Skip images with missing src 2024-08-02 20:19:10 +03:00
Anton Khorev
25aea657e2 Detect <img> images in markdown rich text 2024-08-02 20:04:59 +03:00
Tom Hughes
f9ea6aa718 Fallback to english locale when looking for community index templates
Starting with the v5.8.0 release osm-community-index has removed
strings from translations which are identical to the engish version
which mostly causes no problem except for some of the template values
that don't involve any localised text.
2024-07-18 18:00:19 +01:00
Tom Hughes
63f0b9257d Don't try and change the HTTP client user agent
Because we only create the client once we can't override the
server URL for a test to change the user agent as we don't know
which test will create it.
2024-07-10 19:17:09 +01:00
Anton Khorev
382e773793 Test Nominatim.describe_location 2024-07-10 17:41:56 +03:00
Anton Khorev
c7353c9ac1 Add image method to get first image from rich text 2024-06-06 17:09:21 +03:00
Tom Hughes
e71355c5bb Fix new rubocop warnings 2024-01-23 18:14:28 +00:00
Anton Khorev
17ba464b1e Use test() instead of define_method() to add locale-specific tests 2024-01-12 15:05:45 +03:00
Anton Khorev
3a8a997fb8 Use assert_not_predicate in tests that have assert_predicate 2024-01-03 16:01:17 +03:00
Tom Hughes
0c2e471708 Fix new rubocop warnings 2023-12-05 18:13:13 +00:00
Tom Hughes
e8af4b85bf Fix new rubocop warnings 2023-09-26 18:42:57 +01:00
Tom Hughes
dc54ce7d0a Update argon2 tests for change in library default costs 2023-09-05 17:16:53 +01:00
Anton Khorev
0ef4a299bb Check required bbox parameter presence outside of BoundingBox class 2023-09-03 09:47:27 +03:00
Tom Hughes
62c68b9f20 Merge remote-tracking branch 'upstream/pull/4077' 2023-07-05 15:10:12 +01:00
Andy Allan
d58cae6ff6 Avoid using the zero key for pluralisation in English
This makes it impossible to translate to other languages that use the
`zero:` key, e.g. for other numbers that end in zero.

An alternative approach would be possible in future, when ruby-i18n
and rails and translatewiki all have full support for `0:` and `1:` keys.

Fixes #3997
2023-07-05 14:47:39 +01:00
Andy Allan
22c137cc0c Expand raw html checks to all translation files
This closes a potential security issue, where unreviewed html could
be added via translation files.
2023-07-05 13:47:12 +01:00
Andy Allan
387d130e87 Add some validations for i18n values
These only apply to the en.yml file for now, but can be expanded
in due course.
2023-04-12 13:58:55 +01:00
Andy Allan
4af923dbf9 Ensure kramdown table alignment styles are converted to bootstrap classes
Adds tests for commit f42a7a2d8d
2023-02-22 09:46:52 +00:00
Tom Hughes
6033359bd0 Preserve rel=me on links in rich text
Fixes #3859
2022-12-29 18:02:23 +00:00
Andy Allan
4ab134d869 Use fallbacks for OCI resource names
This uses the fallbacks for OCI translations. For example, if a
local chapter doesn't have an explicitly translated name, it will
use a template for osm-lc resources and fill in the appropriate
translated community name.

Fixes #3814
2022-12-14 14:54:01 +00:00
Andy Allan
af6fec502a Validate URLs against supply-chain attacks
Unfortunately validates_url gem doesn't support mailto or xmpp urls,
so we need to write our own validation.
2022-11-02 18:21:00 +00:00
Andy Allan
561ee71129 Rubocop autofix: ambiguous operator precedence
This simply adds braces to clarify which mathematical operator comes
first.
2022-04-06 14:55:29 +01:00
Tom Hughes
03cad948e3 Fix new rubocop warnings 2022-03-15 19:24:09 +00:00
Tom Hughes
aad81eb74c Switch to Argon2 for password hashing 2021-11-03 20:39:31 +00:00
Andy Allan
37b03e47c6 Fix various code comments
These were found as part of #3233
2021-07-21 11:24:23 +01:00
Andy Allan
bb2afc3e8b Prevent addition of style attributes to all elements 2021-03-24 20:55:30 +00:00
Andy Allan
d7eac9b5a8 Strip away class attributes from sanitized outputs
There's a lot of shenanigans that are possible when you can apply
arbitrary classes to the rendered output.
2021-03-24 19:15:21 +00:00
Andy Allan
5d39bf8491 Add tests for richtext table classes 2021-03-24 17:55:15 +00:00
Tom Hughes
3512d6303c Fix new rubocop warnings 2021-03-23 19:48:13 +00:00
Andy Allan
2519841efe Return the centre of the image if the bbox has no extent
Fixes #3007. If all the provided points in the gpx file have the same
lat/lon, then an image where they are all at the centre seems plausible.
2020-12-23 15:01:01 +00:00
Andy Allan
c04d05686f Resolve some extra-long lines 2020-10-28 11:07:34 +01:00
Tom Hughes
e72092161b Update test results for presence of zh-HK translations 2020-10-19 19:26:17 +01:00
Tom Hughes
ea59d95f4a Fix some new rubocop warnings 2020-08-06 22:27:30 +01:00
Tom Hughes
0e2a66e8de Fix new rubocop warnings 2020-08-06 18:42:16 +01:00
Tom Hughes
2d3972249c Fix some rubocop todos 2020-08-02 19:38:58 +01:00
Tom Hughes
a221aabe3c Check that pluralizable translations have an "other" key 2020-06-11 19:21:41 +01:00
Tom Hughes
bf22c69286 Improve locale selection algorithm
Don't include locales which only have rails translations in
the candidates, and ensure that user specified options take
priority over less specific variants of earlier choices.
2020-06-04 17:33:11 +01:00
Tom Hughes
ef147d479e Fix new rubocop warnings 2020-04-19 19:06:07 +01:00
Tom Hughes
7a1615bc55 Fix rubocop-minitest warnings 2020-04-15 19:07:13 +01:00
Andreas Geyer-Schulz
f6f23ed0ee
Fix typo: change 'noreferer' to 'noreferrer'
as the correct rel attribute in external links.
2020-01-25 20:10:23 +01:00
Tom Hughes
4ee60c0f8f Make all translation lookup errors throw exceptions in test mode 2019-12-16 21:54:11 +00:00
Tom Hughes
4b646e17a8 Fix rubocop warnings 2019-08-14 19:27:02 +01:00
Tom Hughes
df232ec96f Add noopener and noreferer to links in user generated content 2019-01-16 10:10:51 +00:00