Skip to content

Commit c340812

Browse files
committed
Only skip tags with case considered
Do not lower tags first Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 5d2c0e7 commit c340812

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

src/textcode/markup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,9 @@ def strip_known_markup_from_text(text):
19311931

19321932
SKIP_ATTRIBUTES = (
19331933
"href=",
1934+
"HREF=",
19341935
"class=",
1936+
"CLASS=",
19351937
"width=",
19361938
"@end",
19371939
"@group",
@@ -1940,7 +1942,8 @@ def strip_known_markup_from_text(text):
19401942
"xmlns:",
19411943
"xml:",
19421944
"lang=",
1943-
"<windows"
1945+
"<Windows",
1946+
"<windows",
19441947
)
19451948

19461949

@@ -1960,7 +1963,7 @@ def keep_tag(token, skips_tags=ALL_TAGS, skip_attributes=SKIP_ATTRIBUTES, kept_t
19601963
if any(k in tlow for k in kept_tags):
19611964
return True
19621965

1963-
if tlow.startswith(skip_attributes):
1966+
if token.startswith(skip_attributes):
19641967
return False
19651968

19661969
if tlow in skips_tags or tlow == ">":

tests/formattedcode/data/common/manifests-expected.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ headers:
2929
system_environment:
3030
operating_system: linux
3131
cpu_architecture: 64
32-
platform: Linux-5.15.0-116-generic-x86_64-with-glibc2.35
33-
platform_version: '#126-Ubuntu SMP Mon Jul 1 10:14:24 UTC 2024'
34-
python_version: 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0]
35-
spdx_license_list_version: '3.24'
32+
platform: Linux-6.5.0-1025-oem-x86_64-with-glibc2.35
33+
platform_version: '#26-Ubuntu SMP PREEMPT_DYNAMIC Tue Jun 18 12:35:22 UTC 2024'
34+
python_version: 3.11.8 (main, Feb 12 2024, 14:25:06) [GCC 11.4.0]
35+
spdx_license_list_version: '3.25'
3636
files_count: 4
3737
summary:
3838
declared_license_expression: apache-2.0 AND cddl-1.0 AND lgpl-3.0 AND mit
@@ -1399,7 +1399,7 @@ license_references:
13991399
minimum_coverage: '0'
14001400
standard_notice:
14011401
ignorable_copyrights:
1402-
- Copyright (c) 2007 Free Software Foundation, Inc. <https://fsf.org/>
1402+
- Copyright (c) 2007 Free Software Foundation, Inc. https://fsf.org
14031403
ignorable_holders:
14041404
- Free Software Foundation, Inc.
14051405
ignorable_authors: []

tests/textcode/data/markup_expected/PDL.html.stripmarkup.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"})();",
127127
"",
128128
"",
129-
"<body lang=\"en-US\"",
129+
"<body",
130130
"id=\"bannera\"",
131131
"id=\"languagesdiv\"",
132132
"English:",

tests/textcode/data/markup_expected/java.jsp.stripmarkup.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"<%--!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"",
1616
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"--%",
1717
"",
18-
"xml:lang=\"en\"",
18+
"",
1919
"<% IServerInfo serverInfos = (IServerInfo) request.getAttribute(\"serverInfos\");",
2020
"String webFilesRoot = (String) request.getAttribute(\"WebFilesRoot\"); %",
2121
"<%--c:url value=\"${pageContext.request.servletPath}\" var=\"submitUrl\" scope=\"page\"/--% <%-- can use value=\"${pageContext.request.servletPath}\" because this JSP is include()'ed --%",

tests/textcode/data/markup_expected/services.htm.stripmarkup.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
"<!DOCTYPE html",
3-
"lang=\"en-US\"",
3+
"",
44
"",
55
"charset=\"utf-8\"",
66
"",

0 commit comments

Comments
 (0)