# telligent-parser

> Parse Telligent Widget/Theme XML exports to/from source files

Latest version **2.2.0** (published 2020-06-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install telligent-parser
pnpm add telligent-parser
yarn add telligent-parser
bun add telligent-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2020-06-10 |
| First published | 2020-01-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 277.7 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jasper van der Stoop |
| Maintainers | jasperrr91 |

## Links

- npm: https://www.npmjs.com/package/telligent-parser
- Repository: https://github.com/Jasperrr91/telligent-converter-js
- Homepage: https://github.com/Jasperrr91/telligent-converter-js#readme
- Issues: https://github.com/Jasperrr91/telligent-converter-js/issues
- npm.io page: https://npm.io/package/telligent-parser

## Dependencies (3)

- [he](https://npm.io/package/he.md) ^1.2.0
- [codacy-coverage](https://npm.io/package/codacy-coverage.md) ^3.4.0
- [fast-xml-parser](https://npm.io/package/fast-xml-parser.md) ^3.17.4

## Recent versions

- 2.2.0 (latest) — 2020-06-10
- 2.1.0 — 2020-06-10
- 2.0.2 — 2020-02-20
- 2.0.1 — 2020-02-20
- 2.0.0 — 2020-02-06
- 1.2.0 — 2020-01-27
- 1.1.2 — 2020-01-27
- 1.1.1 — 2020-01-27
- 1.1.0 — 2020-01-27
- 1.0.0 — 2020-01-27

## README

# Telligent Converter JS (telligent-converter-js)

[![Build Status](https://api.travis-ci.org/Jasperrr91/telligent-converter-js.svg?branch=master)](https://travis-ci.org/Jasperrr91/telligent-converter-js) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/4039bbc7f8334fe6b237baea0c538cd4)](https://www.codacy.com/manual/jasper_3/telligent-converter-js?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Jasperrr91/telligent-widget-converter-js&amp;utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/4039bbc7f8334fe6b237baea0c538cd4)](https://www.codacy.com/manual/jasper_3/telligent-converter-js?utm_source=github.com&utm_medium=referral&utm_content=Jasperrr91/telligent-widget-converter-js&utm_campaign=Badge_Coverage)

## Description
Telligent Community has an in-browser editor for it's widgets and themes but this editor is slow and lacks powerful features that your favorite IDE offers. You *can* export/import these widgets and themes, but everything is exported combined into a single XML file. With all widget/theme files encoded in base64. This requires **a lot** of manual labour to make widgets/themes editable. It is also a pain for version control.

This JavaScript project will let you decode and encode* these widget/theme files so you wind up with an easily managable and editable project structure.

_* encoding has not yet been implemented_

## Usage
### Decoding Theme(s)
To decode widgets, place the the XML file containing the theme(s) in the root folder and name it `themes.xml`. Then use the following code for your `app.js`.
```javascript
import { readdir } from 'fs';
import config from '../config.json';
import { widgetDecoder, themeDecoder, helpers } from './decoder/index';

// Decode Themes XML file
const themesFile = '../themes.xml';
const themesXml = helpers.openXmlFile(themesFile, config);
const themesJson = helpers.convertXmlToJson(themesXml);
themeDecoder(themesJson, config);
```

Run with `npm start`.

### Decoding Widgets
To decode widgets, place the widgets in the input folder and use the following code for your `app.js`.
```javascript
import { readdir } from 'fs';
import config from '../config.json';
import { widgetDecoder, themeDecoder, helpers } from './decoder/index';

// Decode each widget
const { inputFolder } = config;
readdir(inputFolder, (err, files) => {
  if (err) throw err;
  files.forEach((file) => {
    const widgetXml = helpers.openXmlFile(file, config);
    const widgetJson = helpers.convertXmlToJson(widgetXml);
    widgetDecoder(widgetJson.scriptedContentFragments.scriptedContentFragment, config);
  });
});
```

### Encoding
Not yet supported.

## TODO
  - Remove DRY code
  - Add Encoding
  - Turn into package

---
_Source: https://npm.io/package/telligent-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
