Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Goethes Farbenlehre
gfl-app-new
Commits
520610a2
Commit
520610a2
authored
Nov 08, 2022
by
pestov
Browse files
Render note>bibl>ref as links inside of a note annotation
parent
3ffa0d9c
Pipeline
#332009
passed with stages
in 22 minutes and 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Transform/EditedTextTransformer.php
View file @
520610a2
...
...
@@ -380,19 +380,29 @@ class EditedTextTransformer extends CommonTransformer
if
(
$target
)
{
$htmlEl
=
$doc
->
a
(
$target
);
// There can be self
closing <ref/> tags, so we just add the target as content for the <a> tag.
if
(
!
$teiEl
->
hasChildNodes
())
{
// There can be self
-
closing <ref/> tags, so we just add the target as content for the <a> tag.
if
(
!
$teiEl
->
hasChildNodes
()
&&
!
$teiEl
->
textContent
)
{
$htmlEl
->
appendChild
(
$doc
->
text
(
$target
));
}
if
(
'bibl'
===
$teiEl
->
parentNode
->
nodeName
)
{
$htmlEl
=
$doc
->
span
();
$targetArr
=
explode
(
'#'
,
$target
);
$url
=
'./../literatur/'
.
$targetArr
[
1
];
$text
=
str_replace
(
'_'
,
' '
,
$targetArr
[
1
]);
// Create annotation
// If we have note > bibl > ref, then we are here in the middle of note HTML doc
// instead of the actual edited text HTMl doc.
// So we just want to display the link in there.
if
(
'note'
===
$teiEl
->
parentNode
->
parentNode
->
nodeName
)
{
return
$doc
->
a
(
$url
);
}
// Otherwise it appears to be a regular bibl inside of the edited text.
// So we create a respective annotation for it and put this link as part of it's text.
$htmlEl
=
$doc
->
span
();
$uuid
=
$this
->
createUuid
();
$text
=
str_replace
(
'_'
,
' '
,
$targetArr
[
1
]);
$this
->
works
[
$uuid
]
=
$text
.
' (<a href="'
.
$url
.
'" target="_blank">Literaturverzeichnis</a>)'
;
$this
->
literature
[
$uuid
]
=
$targetArr
[
1
];
$htmlEl
->
setAttribute
(
'id'
,
$uuid
);
...
...
pestov
@paul.pestov
mentioned in issue
#207
·
Nov 08, 2022
mentioned in issue
#207
mentioned in issue #207
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment