diff options
author | Paul Wicking <paul.wicking@qt.io> | 2023-05-14 07:25:48 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2023-05-15 14:56:51 +0200 |
commit | 52c8f1dbdd52f6c6e5e5419a55c456c832d8cdf4 (patch) | |
tree | ede3ff0369d178865c2d4afb22d3fe2969f61164 /tests/auto/qdoc/generatedoutput/expected_output/e85685de.html | |
parent | ac01635f461bd9f211d89f6eea833d9d928fd113 (diff) | |
download | qttools-52c8f1dbdd52f6c6e5e5419a55c456c832d8cdf4.tar.gz |
QDoc: Append hash when normalizing non-ascii file names
When generating files, QDoc normalizes the string that's used for the
file's name. This normalization is done by
`Utilities::canonicalizeFileName`. The method returns a string stripped
for non-alphanumeric characters, with space replaced by hyphens, and
any repeating or trailing hyphens removed.
This causes the removal of non-ascii-printable characters, such as
a range of latin characters (e.g. 'ß`, 'ø', etc), and any non-latin
script (Arabic, Chinese, etc). If the file name, for example defined by
the `\page` command, contains nothing but disallowed characters, the
file simply isn't generated. However, QDoc doesn't warn the user in this
case.
This patch extends QDoc's generated output test to reproduce this issue.
The test serves as proof of the misbehavior and as regression discovery
mechanism.
The patch modifies `Utilities::canonicalizeFileName` such that it
appends a hash to "canonical" titles that contain characters not
considered legal in file names. For the purpose of compatibility across
file systems, legal characters are considered lowercase a-z, the digits
0-9, and the hyphen character. Other symbols and characters are still
removed. However, when encountering characters that are not part of a
subset of ascii-printable characters (ascii decimal 32-126, inclusive),
QDoc now appends a hash of the original file name string to the string
it returns as "canonicalized".
[ChangeLog][QDoc] QDoc now appends a hash of the original file name to
the file name(s) of files where the name contains non-ascii characters.
This means QDoc now generates files for pages with names written in
non-latin characters.
Fixes: QTBUG-113585
Change-Id: Icb0f8a094ed8eea38fb3ac954af318bb78f3a755
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Diffstat (limited to 'tests/auto/qdoc/generatedoutput/expected_output/e85685de.html')
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/e85685de.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/e85685de.html b/tests/auto/qdoc/generatedoutput/expected_output/e85685de.html new file mode 100644 index 000000000..ea52873e7 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/e85685de.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- adventures_with_non_ascii_characters.qdoc --> + <title>NonAsciiCharacterInput</title> +</head> +<body> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<!-- $$$موزاريلا-description --> +<div class="descr" id="details"> +<p>This page exists solely to understand how QDoc will generate the file name for a page with right-to-left script in its name.</p> +</div> +<!-- @@@موزاريلا --> +</body> +</html> |