Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jalhyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cassiopée
jalhyd
Commits
39d18642
Commit
39d18642
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
refactor: turn MermaidUtil.isMermaidId() to more general isMermaidEqualIds()
refs
#318
parent
44a24a47
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/prebarrage/pre_barrage.ts
+1
-1
1 addition, 1 deletion
src/prebarrage/pre_barrage.ts
src/util/mermaid.ts
+16
-7
16 additions, 7 deletions
src/util/mermaid.ts
with
17 additions
and
8 deletions
src/prebarrage/pre_barrage.ts
+
1
−
1
View file @
39d18642
...
...
@@ -134,7 +134,7 @@ export class PreBarrage extends Nub {
if
(
uid
!==
undefined
)
{
let
pos
=
0
;
for
(
const
c
of
this
.
children
)
{
if
(
MermaidUtil
.
isMermaidId
(
c
.
uid
,
uid
))
{
if
(
MermaidUtil
.
isMermaid
Equal
Id
s
(
c
.
uid
,
uid
))
{
res
.
child
=
c
;
res
.
position
=
pos
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/util/mermaid.ts
+
16
−
7
View file @
39d18642
...
...
@@ -3,16 +3,25 @@
*/
export
class
MermaidUtil
{
/**
* check if
an id
i
s
a Mermaid
generated id
* @param id
to check
. Can be equal to the original,graph provided id or Mermaid transformed (ie. flowchart-id-xx)
* @param
ref reference id
* check if
two ids are equal
i
n
a Mermaid
way
* @param id
1 first id to compare
. Can be equal to the original,graph provided id or Mermaid transformed (ie. flowchart-id-xx)
* @param
id2 second to compare (same remarks)
*/
public
static
isMermaidId
(
id
:
string
,
ref
:
string
):
boolean
{
if
(
id
===
ref
)
{
public
static
isMermaid
Equal
Id
s
(
id
1
:
string
,
id2
:
string
):
boolean
{
if
(
id
1
===
id2
)
{
return
true
;
}
const
mid
=
"
flowchart-
"
+
id
+
"
-
"
;
// Mermaid generated element id
return
ref
.
startsWith
(
mid
);
const
mid
=
"
flowchart-
"
+
id1
+
"
-
"
;
// Mermaid generated element id
if
(
id2
.
startsWith
(
mid
))
{
return
true
;
}
const
mid2
=
"
flowchart-
"
+
id2
+
"
-
"
;
// so the same in reverse order
if
(
mid2
.
startsWith
(
id1
))
{
return
true
;
}
return
false
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment