import Rulesets from './Rulesets';
import Icon from '../common/Icon';
import RawHTML from '../common/RawHTML';
+import nl2br from '../../helpers/nl2br';
import {
getRelations,
getTranslation,
</> : null}
{getTranslation(technique, 'attribution', i18n.language) ?
<Alert variant="dark">
- <RawHTML html={getTranslation(technique, 'attribution', i18n.language)} />
+ {nl2br(getTranslation(technique, 'attribution', i18n.language))}
</Alert>
: null}
</Container>;
--- /dev/null
+import React from 'react';
+
+const nl2br = str => {
+ if (typeof str !== 'string') {
+ return str;
+ }
+ const nl = /(\r\n|\r|\n)/g;
+ return str.split(nl).map((line, index) => {
+ if (line.match(nl)) {
+ return <br key={index} />;
+ }
+ return line;
+ });
+};
+
+export default nl2br;