Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
Falcon
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Walter Huang
Falcon
Commits
8483e8ac
Commit
8483e8ac
authored
Jun 26, 2025
by
Lin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add the category field
parent
d78ba114
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
diffWithDeepDiff.ts
src/detect_section_selector_masters/diffWithDeepDiff.ts
+3
-1
handlePageContent.ts
src/detect_section_selector_masters/handlePageContent.ts
+14
-5
No files found.
src/detect_section_selector_masters/diffWithDeepDiff.ts
View file @
8483e8ac
...
@@ -31,7 +31,7 @@ const baselinePath = join(srcDir, baselineFile);
...
@@ -31,7 +31,7 @@ const baselinePath = join(srcDir, baselineFile);
const
baselineData
=
JSON
.
parse
(
readFileSync
(
baselinePath
,
'utf-8'
));
const
baselineData
=
JSON
.
parse
(
readFileSync
(
baselinePath
,
'utf-8'
));
// Fields to ignore during diff
// Fields to ignore during diff
const
ignoreFields
=
[
'pageUid'
,
'pageTitle'
,
'id'
,
'path'
];
const
ignoreFields
=
[
'
category'
,
'
pageUid'
,
'pageTitle'
,
'id'
,
'path'
];
selectedSelectors
selectedSelectors
.
filter
(
id
=>
Number
(
id
)
!==
baselineId
)
.
filter
(
id
=>
Number
(
id
)
!==
baselineId
)
...
@@ -53,6 +53,8 @@ selectedSelectors
...
@@ -53,6 +53,8 @@ selectedSelectors
const
langA
=
selectedLanguages
[
baselineId
];
const
langA
=
selectedLanguages
[
baselineId
];
const
langB
=
selectedLanguages
[
otherId
];
const
langB
=
selectedLanguages
[
otherId
];
// pageUid, pageTitle, sectionIndex
// pageUid, pageTitle, sectionIndex
context
[
`
${
langA
}
:category`
]
=
pageA
.
category
;
context
[
`
${
langB
}
:category`
]
=
pageB
.
category
;
context
[
`
${
langA
}
:subcategory`
]
=
pageA
.
pageTitle
;
context
[
`
${
langA
}
:subcategory`
]
=
pageA
.
pageTitle
;
context
[
`
${
langB
}
:subcategory`
]
=
pageB
.
pageTitle
;
context
[
`
${
langB
}
:subcategory`
]
=
pageB
.
pageTitle
;
context
[
`
${
langA
}
:sectionIndex`
]
=
pageA
.
sectionIndex
;
context
[
`
${
langA
}
:sectionIndex`
]
=
pageA
.
sectionIndex
;
...
...
src/detect_section_selector_masters/handlePageContent.ts
View file @
8483e8ac
...
@@ -546,17 +546,25 @@ export function mainParse(jsonData) {
...
@@ -546,17 +546,25 @@ export function mainParse(jsonData) {
// 生成导航信息
// 生成导航信息
const
navigationInfo
=
getNavigationInfo
(
jsonData
.
navigation
.
items
);
const
navigationInfo
=
getNavigationInfo
(
jsonData
.
navigation
.
items
);
// 遍历 pages 数组
const
navLinks
=
jsonData
.
navigation
.
items
.
reduce
((
pre
,
cur
)
=>
{
const
navLinks
=
jsonData
.
navigation
.
items
.
reduce
((
pre
,
cur
)
=>
{
if
(
cur
.
items
)
{
if
(
cur
.
items
)
{
return
pre
.
concat
(
cur
.
items
);
// merge cur.title into each child item
return
pre
.
concat
(
cur
.
items
.
map
(
item
=>
({
...
item
,
category
:
cur
.
title
,
}))
);
}
}
return
pre
;
return
pre
;
},
[]);
},
[]);
const
pages
=
navLinks
.
map
((
item
)
=>
{
// 遍历 pages 数组,并将 category 合并到 page 对象中
return
jsonData
.
pages
.
find
((
page
)
=>
page
.
uid
===
item
.
id
);
const
pages
=
navLinks
.
flatMap
((
item
)
=>
{
});
const
page
=
jsonData
.
pages
.
find
((
page
)
=>
page
.
uid
===
item
.
id
);
// 如果找到对应页面,则附加 category 字段并返回,否则跳过
return
page
?
[{
...
page
,
category
:
item
.
category
}]
:
[];
})
if
(
Array
.
isArray
(
pages
))
{
if
(
Array
.
isArray
(
pages
))
{
pages
.
forEach
((
page
,
pageIndex
)
=>
{
pages
.
forEach
((
page
,
pageIndex
)
=>
{
...
@@ -572,6 +580,7 @@ export function mainParse(jsonData) {
...
@@ -572,6 +580,7 @@ export function mainParse(jsonData) {
result
.
push
({
result
.
push
({
pageIndex
,
pageIndex
,
pageUid
:
page
.
uid
,
pageUid
:
page
.
uid
,
category
:
page
.
category
||
'无 category'
,
pageTitle
:
page
.
title
,
pageTitle
:
page
.
title
,
sectionIndex
:
sectionIndex
,
sectionIndex
:
sectionIndex
,
result
:
sectionResult
.
result
,
result
:
sectionResult
.
result
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment