# articles-adapter-pluxml

> Adapter to get informations from a pluXml cms

Latest version **1.2.1** (published 2018-03-08) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install articles-adapter-pluxml
pnpm add articles-adapter-pluxml
yarn add articles-adapter-pluxml
bun add articles-adapter-pluxml
```

## 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 | 1.2.1 |
| Published | 2018-03-08 |
| First published | 2017-12-07 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 75 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Patrick Poulain |
| Maintainers | petitchevalroux |

## Links

- npm: https://www.npmjs.com/package/articles-adapter-pluxml
- Repository: https://github.com/petitchevalroux/node-articles-adapter-pluxml
- Homepage: https://github.com/petitchevalroux/node-articles-adapter-pluxml#readme
- Issues: https://github.com/petitchevalroux/node-articles-adapter-pluxml/issues
- npm.io page: https://npm.io/package/articles-adapter-pluxml

## Dependencies (7)

- [xml2js](https://npm.io/package/xml2js.md) ^0.4.19
- [sprintf](https://npm.io/package/sprintf.md) ^0.1.5
- [arr-diff](https://npm.io/package/arr-diff.md) ^4.0.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.1
- [multi-fs](https://npm.io/package/multi-fs.md) ^1.0.1
- [sprintf-js](https://npm.io/package/sprintf-js.md) ^1.1.1
- [moment-timezone](https://npm.io/package/moment-timezone.md) ^0.5.14

## Recent versions

- 1.2.1 (latest) — 2018-03-08
- 1.2.0 — 2017-12-08
- 1.1.0 — 2017-12-08
- 1.0.0 — 2017-12-07

## README

# articles-adapter-pluxml
Adapter to get informations from a pluXml cms

## Install
```
npm install articles-adapter-pluxml
```

## Usage

### Instantiation with a local directory
```javascript
const PluXmlAdapter = require("articles-adapter-pluxml"),
adapter = new PluXmlAdapter("/var/www/pluxml");
```

### Getting all articles ids as an array of string
```javascript
adapter.articles.getIds().then((ids)=>{
    console.log(ids);
});
```

### Getting article by id
```javascript
adapter.articles.getById("0001").then((article)=>{
    console.log(article);
});
```

### Url rewriting
Url rewriting setting use [sprintf](http://www.diveintojavascript.com/projects/javascript-sprintf) syntax with the following arguments :
```javascript
sprintf(rewriteRule, id, slug)
```

With an article having the following properties :
```javascript
{id:"0001",slug:"article-slug"}
```

The following code rewrite url to http://example.com/1-article-slug.html
```javascript
const adapter = new PluXmlAdapter({
    storage:"/var/www/pluxml",
    rewriteRule:"http://example.com/%d-%s.html"
});
adapter.articles.getById("0001").then((article)=>{
    console.log(article.url); // => http://example.com/1-article-slug.html
});
```

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