enketo-transformer
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -6,2 +6,8 @@ ## Change Log | ||
## [2.1.4] - 2022-05-04 | ||
##### Changed | ||
- Fixed mangling of markdown-produced HTML next to top-level text nodes when a mediamap is provided (#150) | ||
## [2.1.3] - 2022-04-21 | ||
@@ -8,0 +14,0 @@ |
{ | ||
"name": "enketo-transformer", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Library/app that transforms ODK-compliant XForms into a format that Enketo can consume", | ||
@@ -65,3 +65,3 @@ "license": "Apache-2.0", | ||
"eslint-plugin-react": "^7.29.4", | ||
"eslint-plugin-react-hooks": "^4.4.0", | ||
"eslint-plugin-react-hooks": "^4.5.0", | ||
"eslint-plugin-unicorn": "^36.0.0", | ||
@@ -75,3 +75,3 @@ "grunt": "^1.5.2", | ||
"mocha": "^9.2.2", | ||
"nodemon": "^2.0.15", | ||
"nodemon": "^2.0.16", | ||
"nyc": "^15.1.0", | ||
@@ -78,0 +78,0 @@ "prettier": "^2.6.2", |
@@ -1,2 +0,2 @@ | ||
![coverage-shield-badge-1](https://img.shields.io/badge/coverage-97.86%25-brightgreen.svg) | ||
![coverage-shield-badge-1](https://img.shields.io/badge/coverage-98.31%25-brightgreen.svg) | ||
[![npm version](https://badge.fury.io/js/enketo-transformer.svg)](http://badge.fury.io/js/enketo-transformer) [![Build Status](https://travis-ci.org/enketo/enketo-transformer.svg?branch=master)](https://travis-ci.org/enketo/enketo-transformer) [![Dependency Status](https://david-dm.org/enketo/enketo-transformer.svg)](https://david-dm.org/enketo/enketo-transformer) | ||
@@ -3,0 +3,0 @@ |
@@ -83,8 +83,12 @@ /** | ||
const mediaMap = Object.fromEntries( | ||
Object.entries(survey.media || {}).map((entry) => | ||
entry.map(escapeURLPath) | ||
) | ||
); | ||
let mediaMap = null; | ||
if (survey.media) { | ||
mediaMap = Object.fromEntries( | ||
Object.entries(survey.media).map((entry) => | ||
entry.map(escapeURLPath) | ||
) | ||
); | ||
} | ||
return _parseXml(survey.xform) | ||
@@ -502,8 +506,11 @@ .then((doc) => { | ||
if (mediaMap != null) { | ||
const fragment = libxmljs.parseHtmlFragment(rendered); | ||
const fragment = libxmljs.parseHtmlFragment( | ||
`<div class="temporary-root">${rendered}</div>` | ||
); | ||
rendered = _replaceMediaSources( | ||
fragment, | ||
mediaMap | ||
).toString(false); | ||
rendered = _replaceMediaSources(fragment, mediaMap) | ||
.root() | ||
.childNodes() | ||
.map((node) => node.toString(false)) | ||
.join(''); | ||
} | ||
@@ -510,0 +517,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1749795
107
4593