@@ -979,11 +979,7 @@ export class RdfaParser<N> {
979
979
attributes : Record < string , string > ,
980
980
predicateAttribute = 'property' ,
981
981
) => {
982
- const textSegments : string [ ] = activeTag . text || [ ] ;
983
- const object = this . util . createLiteral (
984
- attributes [ 'content' ] ?? textSegments . join ( '' ) ,
985
- activeTag ,
986
- ) ;
982
+ const object = this . util . createLiteral ( activeTag . content ?? '' , activeTag ) ;
987
983
this . contentNodeMapping . set ( node , {
988
984
subject : sayDataFactory . resourceNode (
989
985
this . util . getResourceOrBaseIri ( unwrap ( activeTag . subject ) , activeTag )
@@ -1049,6 +1045,14 @@ export class RdfaParser<N> {
1049
1045
const parentTag : IActiveTag < N > =
1050
1046
this . activeTagStack [ this . activeTagStack . length - 2 ] ;
1051
1047
1048
+ let textSegments : string [ ] = activeTag . text || [ ] ;
1049
+ if ( activeTag . collectChildTags && parentTag . collectChildTags ) {
1050
+ // If we are inside an XMLLiteral child that also has RDFa content, ignore the tag name that was collected.
1051
+ textSegments = textSegments . slice ( 1 ) ;
1052
+ }
1053
+ activeTag . content =
1054
+ activeTag . attributes [ 'content' ] ?? textSegments . join ( '' ) ;
1055
+
1052
1056
if (
1053
1057
! (
1054
1058
activeTag . collectChildTags &&
@@ -1120,8 +1124,7 @@ export class RdfaParser<N> {
1120
1124
1121
1125
// Reset text, unless the parent is also collecting text
1122
1126
if ( ! parentTag . predicates ) {
1123
- // Can we simply remove this statement?
1124
- // activeTag.text = null;
1127
+ activeTag . text = null ;
1125
1128
}
1126
1129
}
1127
1130
0 commit comments