Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Commits
f90fe55e
Commit
f90fe55e
authored
2 years ago
by
Emmanuel Raviart
Browse files
Options
Downloads
Patches
Plain Diff
Quick & dirty prefiguration of metsLesLiens when displaying article.
parent
e08c6218
Branches
Branches containing commit
Tags
0.0.202
Tags containing commit
No related merge requests found
Pipeline
#5810
passed
2 years ago
Stage: build
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/components/legifrance/ArticleView.svelte
+21
-2
21 additions, 2 deletions
src/lib/components/legifrance/ArticleView.svelte
src/lib/components/legifrance/LienView.svelte
+0
-1
0 additions, 1 deletion
src/lib/components/legifrance/LienView.svelte
with
21 additions
and
3 deletions
src/lib/components/legifrance/ArticleView.svelte
+
21
−
2
View file @
f90fe55e
...
...
@@ -8,6 +8,7 @@
Article
,
LegalObject
,
LegalObjectType
,
Lien
,
}
from
"
@tricoteuses/legal-explorer
"
import
LienView
from
"
$lib/components/legifrance/LienView.svelte
"
...
...
@@ -24,6 +25,7 @@
$
:
legifranceUrl
=
legifranceUrlFromLegalObject
(
"
article
"
,
article
)
$
:
liens
=
[...
iterArrayOrSingleton
(
article
.
LIENS
?.
LIEN
)]
$
:
contenu
=
metLesLiens
(
article
.
BLOC_TEXTUEL
.
CONTENU
,
liens
)
$
:
ciblesCreation
=
liens
.
filter
(
(
lien
)
=>
lien
[
"
@sens
"
]
===
"
cible
"
&&
lien
[
"
@typelien
"
]
===
"
CREATION
"
,
)
...
...
@@ -31,7 +33,7 @@
$
:
texte
=
article
.
CONTEXTE
.
TEXTE
$
:
titreTexte
=
firstValueOfArrayOrSingleton
(
texte
.
TITRE_TXT
)?.[
"
#text
"
]
export
function
legifranceUrlFromLegalObject
(
function
legifranceUrlFromLegalObject
(
type
:
LegalObjectType
,
object
:
LegalObject
,
):
string
|
undefined
{
...
...
@@ -47,6 +49,23 @@
return
undefined
}
}
function
metLesLiens
(
contenu
:
string
,
liens
:
Lien
[]):
string
{
for
(
const
lien
of
liens
)
{
if
(
lien
[
"
@sens
"
]
===
"
source
"
&&
lien
[
"
@typelien
"
]
===
"
CITATION
"
)
{
const
num
=
lien
[
"
@num
"
]
const
match
=
num
.
match
(
/^
(
A|D|LO|L|R
)(
.+
)
$/
)
if
(
match
!==
null
)
{
console
.
log
(
match
[
1
],
match
[
2
])
}
contenu
=
contenu
.
replaceAll
(
`article
${
match
[
1
]}
.
${
match
[
2
]}
`
,
`<a href="https://www.legifrance.gouv.fr/codes/article_lc/
${
lien
[
"
@id
"
]}
" target="_blank">$&</a>`
,
)
}
}
return
contenu
}
</script>
<div
class=
"grid grid-cols-1 gap-x-8 sm:grid-cols-3"
>
...
...
@@ -104,7 +123,7 @@
{
/if
}
<div
class=
"prose font-serif"
>
{
@html
article
.
BLOC_TEXTUEL
.
CONTENU
}
{
@html
contenu
}
</div>
{
#if
ciblesCreation
.
length
>
0
}
...
...
This diff is collapsed.
Click to expand it.
src/lib/components/legifrance/LienView.svelte
+
0
−
1
View file @
f90fe55e
...
...
@@ -15,7 +15,6 @@
export
let
level
=
1
export
let
lien
:
Lien
export
let
article
:
Article
let
open
=
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