https://github.com/sonsoleslp/aiken-to-moodlexml
JavaScript library for converting from Aiken format to MoodleXML. Ongoing work 🚧
https://github.com/sonsoleslp/aiken-to-moodlexml
Last synced: about 2 months ago
JSON representation
JavaScript library for converting from Aiken format to MoodleXML. Ongoing work 🚧
- Host: GitHub
- URL: https://github.com/sonsoleslp/aiken-to-moodlexml
- Owner: sonsoleslp
- License: mit
- Created: 2018-12-20T20:39:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-13T13:43:57.000Z (about 5 years ago)
- Last Synced: 2025-03-13T21:16:21.063Z (3 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Aiken to MoodleXML
[](https://travis-ci.org/sonsoleslp/aiken-to-moodlexml)
[](https://david-dm.org/sonsoleslp/aiken-to-moodlexml) [](https://david-dm.org/sonsoleslp/aiken-to-moodlexml?type=dev)
[](https://opensource.org/licenses/MIT)This JS library parses Aiken quizzes into MoodleXML files.
## Usage
```
import aikenToMoodleXML from 'aiken-to-moodlexml';
// ...
aikenToMoodleXML(aikenString, (result, error) => {
if (error) {
console.error(error);
} else {
console.log(result);
}
});
```
## ExamplesOn the server
```
import aikenToMoodleXML from 'aiken-to-moodlexml';
const fs = require('fs');
const path = require('path');const xmlString = fs.readFileSync("/path/to/your/aiken/file.txt", 'utf8');
aikenToMoodleXML(aikenString, (result, error) => {
if (error) {
console.error(error);
} else {
console.log(result);
}
});```
On a JS SPA
```
import aikenToMoodleXML from 'aiken-to-moodlexml';
// ...
fetch("https://myweb.org/aiken.txt")
.then(res=>res.text())
.then(aikenString => {
aikenToMoodleXML(aikenString, (result, error) => {
if (error) {
console.error(error);
} else {
console.log(result);
}
});
});
```## Development
### Commands
- `npm run clean` - Remove `lib/` directory
- `npm test` - Run tests with linting and coverage results.
- `npm test:only` - Run tests without linting or coverage.
- `npm test:watch` - You can even re-run tests on file changes!
- `npm test:prod` - Run tests with minified code.
- `npm run test:examples` - Test written examples on pure JS for better understanding module usage.
- `npm run lint` - Run ESlint with airbnb-config
- `npm run cover` - Get coverage report for your code.
- `npm run build` - Babel will transpile ES6 => ES5 and minify the code.
- `npm run prepublish` - Hook for npm. Do all the checks before publishing your module.## License
MIT © Sonsoles López Pernas