Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
logilab-views
Commits
6d4d8836b8d0
Commit
cc9233fd
authored
Mar 23, 2020
by
Élodie Thiéblin
Browse files
[DublinCore] Add markdown converter when format is specified
parent
c87beef3c4ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/common/aliases.ts
View file @
6d4d8836
...
...
@@ -133,6 +133,13 @@ export const ALIASES = [
[
"
http://ns.cubicweb.org/cubicweb/0.0/BlogEntry
"
,
"
http://rdfs.org/sioc/types#BlogPost
"
],
// format
[
"
http://purl.org/dc/elements/1.1/format
"
,
"
http://purl.org/dc/terms/format
"
,
"
http://ns.cubicweb.org/cubicweb/0.0/content_format
"
]
];
...
...
src/dublincore/DublinCoreImpl.tsx
View file @
6d4d8836
import
*
as
React
from
"
react
"
;
import
{
DublinCoreElement
}
from
"
./dcschema
"
;
import
*
as
ReactMarkdown
from
"
react-markdown
"
;
export
const
DublinCoreElementComponent
:
React
.
FC
<
{
dcelement
:
DublinCoreElement
;
}
>
=
({
dcelement
})
=>
(
<>
<
h1
>
{
dcelement
.
title
}
</
h1
>
<
div
>
{
dcelement
.
creator
}
</
div
>
<
div
>
{
dcelement
.
date
}
</
div
>
<
div
>
{
dcelement
.
description
}
</
div
>
</>
);
}
>
=
({
dcelement
})
=>
{
let
contentDisplay
=
<
div
>
{
dcelement
.
description
}
</
div
>;
if
(
dcelement
.
contentType
===
"
text/markdown
"
)
{
contentDisplay
=
<
ReactMarkdown
source
=
{
dcelement
.
description
}
/>;
}
return
(
<>
<
h1
>
{
dcelement
.
title
}
</
h1
>
<
div
>
{
dcelement
.
creator
}
</
div
>
<
div
>
{
dcelement
.
date
}
</
div
>
{
contentDisplay
}
</>
);
};
src/dublincore/dcschema.ts
View file @
6d4d8836
...
...
@@ -9,6 +9,7 @@ export interface DublinCoreElement extends rdfMeta.Loadable {
description
:
string
;
creator
:
string
;
date
:
string
;
contentType
:
string
;
}
/**
...
...
@@ -29,7 +30,11 @@ DCE_METACLASS.properties = [
"
creator
"
,
"
http://purl.org/dc/elements/1.1/creator
"
),
new
rdfMeta
.
MetaPropertyData
(
"
date
"
,
"
http://purl.org/dc/elements/1.1/date
"
)
new
rdfMeta
.
MetaPropertyData
(
"
date
"
,
"
http://purl.org/dc/elements/1.1/date
"
),
new
rdfMeta
.
MetaPropertyData
(
"
contentType
"
,
"
http://purl.org/dc/elements/1.1/format
"
)
];
/**
...
...
src/dublincore/dublincore.tsx
View file @
6d4d8836
...
...
@@ -77,7 +77,7 @@ class DCElementRendering implements implementation.ViewImplementation {
const
dctitles
=
entity
.
getValuesForS
(
"
http://purl.org/dc/terms/title
"
);
if
(
dctitles
.
length
!==
0
)
{
return
1
0
;
return
1
1
;
}
return
implementation
.
VIEW_PRIORITY_INAPPROPRIATE
;
}
...
...
Write
Preview
Supports
Markdown
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