datalad / datalad-catalog

Create a user-friendly data catalog from structured metadata
https://datalad-catalog.netlify.app
MIT License
15 stars 11 forks source link

Plain text rendering in `description` should honour newline characters #455

Open jsheunis opened 6 months ago

jsheunis commented 6 months ago

Looks like this will solve it: https://stackoverflow.com/a/41495115:

<span style="white-space: pre-wrap;"></span>
jsheunis commented 6 months ago

the diff to fix the issue:

diff --git a/datalad_catalog/catalog/templates/dataset-template.html b/datalad_catalog/catalog/templates/dataset-template.html
index d9f53c6..f06af76 100644
--- a/datalad_catalog/catalog/templates/dataset-template.html
+++ b/datalad_catalog/catalog/templates/dataset-template.html
@@ -190,11 +190,11 @@
         <b-row no-gutters>
           <b-col md="9" style="text-align: justify;">
             <b-card-text>
-              <strong>Description:</strong>
+              <strong>Description:</strong><br>
               <span v-if="displayData.description && Array.isArray(displayData.description) && displayData.description.length>0 ">
-                <span v-for="desc in displayData.description">{{desc}}<br></span>
+                <span v-for="desc in displayData.description" style="white-space: pre-wrap;">{{desc}}<br></span>
               </span>
-              <span v-else>{{selectedDataset.description}}</span>
+              <span v-else style="white-space: pre-wrap;">{{selectedDataset.description}}</span>
             </b-card-text>
           </b-col>
           <b-col md="3">

or as a patch file:

whitespace_patch.patch