2.2.0 • Published 5 years ago

telligent-parser v2.2.0

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Telligent Converter JS (telligent-converter-js)

Build Status Codacy Badge Codacy Badge

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.

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.

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
2.2.0

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago