Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ndlano/h5p-editor-csv-to-text
Upload a file and insert its contents into an H5P field
https://github.com/ndlano/h5p-editor-csv-to-text
h5p
Last synced: about 5 hours ago
JSON representation
Upload a file and insert its contents into an H5P field
- Host: GitHub
- URL: https://github.com/ndlano/h5p-editor-csv-to-text
- Owner: NDLANO
- License: mit
- Created: 2023-01-13T09:19:15.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-15T15:45:09.000Z (4 months ago)
- Last Synced: 2024-07-15T19:10:10.590Z (4 months ago)
- Topics: h5p
- Language: TypeScript
- Homepage:
- Size: 303 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# h5p-editor-csv-to-text
Upload a CSV file and insert its parsed contents into an H5P field.
## How to use
This widget can be added to any field of type `text`.
It will render a button that lets the user upload a CSV file and a textarea that the file contents are inserted into.### Format
The CSV file is parsed and outputted on the format that's consumed by [H5P.VocabularyDrill](https://github.com/NDLANO/h5p-vocabulary-drill).
Input: `ocean/sea;o___n;sjø;s_ø`
Output: `'ocean/sea:o___n,sjø:s_ø'`The CSV parser automatically detects the CSV delimiter and currently supports using either comma (`,`) or semicolon (`;`).
### Usage
The widget's name is `csv-to-text`.
`semantics.json`:
```json
{
"label": "Words",
"name": "words",
"type": "text",
"widget": "csv-to-text",
"description": "Add words by uploading a CSV-file or write them in the text field.",
"important": {
"description": "
- Source and target words are separated with a comma (,).
- Alternative answers are separated with a forward slash (/).
- You may add a textual tip, using a colon (:) in front of the tip.
"example": "water/sea:w___r,vann/hav:v__n"
}
}
```
It is not part of the H5P core, therefore it must be added as an editor dependency.
`library.json`:
```json
{
"editorDependencies": [
{
"machineName": "H5PEditor.CSVToText",
"majorVersion": 1,
"minorVersion": 0
},
]
}
```
#### Result
![Screenshot of the widget when specified as in the example code above](https://user-images.githubusercontent.com/9085189/216600680-424c1934-2792-4a59-9216-fded55a20d1b.png)