mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 03:56:19 +00:00
Update readme.md
This commit is contained in:
81
readme.md
81
readme.md
@@ -7,82 +7,71 @@
|
|||||||

|

|
||||||
|
|
||||||
|
|
||||||
>RSS based, feed generator for Yandex turbo.
|
>Генератор RSS разментки для сервиса Турбо-страницы
|
||||||
|
|
||||||
>WARNING! Work In Progress
|
>ПРЕДУПРЕЖДЕНИЕ! Работа в процессе
|
||||||
|
|
||||||
### Usage
|
### Использование
|
||||||
|
|
||||||
#### Create a new feed
|
#### Создание канала
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var TR = require('turbo-rss');
|
var TR = require('turbo-rss');
|
||||||
|
|
||||||
var feed = new TS(feedOptions);
|
var feed = new TR(feedOptions);
|
||||||
```
|
```
|
||||||
|
|
||||||
##### `feedOptions`
|
##### `Опции канала`
|
||||||
|
|
||||||
* `title` **string** Title of your site or feed
|
* `title` **string** Название RSS-канала.
|
||||||
* `description` _optional_ **string** A short description of the feed.
|
* `description` _optional_ **string** Описание канала одним предложением. Не используйте HTML-разметку..
|
||||||
* `author` _optional_ **string** If included it is the name of the item's creator.
|
* `author` _optional_ **string** If included it is the name of the item's creator. **(Будет удалено)**
|
||||||
* `link` **url string** Url to the site that the feed is for.
|
* `link` **url string** Домен сайта, данные которого транслируются..
|
||||||
* `pubDate` _optional_ **Date object or date string** The publication date for content in the feed
|
* `pubDate` _optional_ **Date object or date string** The publication date for content in the feed **(Будет удалено)**
|
||||||
|
|
||||||
#### Add items to a feed
|
*Будет добавлено в новых версиях turbo:analytics, turbo:adNetwork*
|
||||||
|
|
||||||
An item can be used for a blog entry, project update, log entry, etc. Your RSS feed
|
#### Добавление страницы в канал
|
||||||
can have any number of items. Most feeds use 20 or fewer items.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
feed.item(itemOptions);
|
feed.item(itemOptions);
|
||||||
```
|
```
|
||||||
|
|
||||||
##### itemOptions
|
##### itemOptions
|
||||||
|
|
||||||
* `title` **string** Title of this particular item.
|
* `title` **string** Заголовок страницы.
|
||||||
* `image_url` **url string** Link to header image
|
* `image_url` **url string** Адрес изображения, которое используется в качестве обложки. Изображение может быть в любом формате.
|
||||||
* `url` **url string** Url to the item. This could be a blog entry.
|
* `url` **url string** URL страницы сайта, для которой нужно сформировать Турбо-страницу.
|
||||||
* `author` _optional_ **string** If included it is the name of the item's creator.
|
* `author` _optional_ **string** Автор статьи, размещенной на странице.
|
||||||
If not provided the item author will be the same as the feed author. This is typical
|
* `date` **string** Время публикации контента на сайте источника.
|
||||||
except on multi-author blogs.
|
* `content` **string** Содержимое страницы
|
||||||
* `date` **string** The date and time of when the item was created. Feed
|
|
||||||
readers use this to determine the sort order. Some readers will also use it to determine
|
|
||||||
* `content` **string** Content
|
|
||||||
|
|
||||||
##### Feed XML
|
*Будет добавлено в новых версиях turbo:source, turbo:topic, yandex:related, menu, pubDate как алиас date
|
||||||
|
|
||||||
|
##### Получение XML
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var xml = feed.xml();
|
var xml = feed.xml();
|
||||||
```
|
```
|
||||||
|
Вернёт XML как строку.
|
||||||
|
|
||||||
This returns the XML as a string.
|
## Пример использования
|
||||||
|
|
||||||
>maybe later...
|
|
||||||
>`indent` _optional_ **boolean or string** What to use as a tab. Defaults to no tabs (compressed).
|
|
||||||
>For example you can use `'\t'` for tab character, or `' '` for two-space tabs. If you set it to
|
|
||||||
>`true` it will use four spaces.
|
|
||||||
|
|
||||||
## Example Usage
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var RSS = require('rss');
|
var TR = require('turbo-rss');
|
||||||
|
|
||||||
/* lets create feed */
|
/* lets create feed */
|
||||||
var feed = new RSS({
|
var feed = new TR({
|
||||||
title: 'title',
|
title: 'title',
|
||||||
description: 'description',
|
description: 'description',
|
||||||
link: 'http://example.com', // site url
|
link: 'http://example.com',
|
||||||
author: 'LightAir',
|
|
||||||
pubDate: 'May 20, 2012 04:00:00 GMT'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* loop over data and add to feed */
|
/* loop over data and add to feed */
|
||||||
feed.item({
|
feed.item({
|
||||||
title: 'item title',
|
title: 'item title',
|
||||||
image_url: 'http://example.com/example.png',
|
image_url: 'http://example.com/example.png',
|
||||||
url: 'http://example.com/article4?this&that', // link to the item
|
url: 'http://example.com/article4?this&that',
|
||||||
author: 'LightAir', // optional - defaults to feed author property
|
author: 'LightAir',
|
||||||
date: 'May 27, 2012',
|
date: 'May 27, 2012',
|
||||||
content: '<p>hello</p>'
|
content: '<p>hello</p>'
|
||||||
});
|
});
|
||||||
@@ -91,15 +80,9 @@ feed.item({
|
|||||||
var xml = feed.xml();
|
var xml = feed.xml();
|
||||||
```
|
```
|
||||||
|
|
||||||
### Contributing
|
## Тестирование
|
||||||
|
|
||||||
Contributions to the project are welcome. Feel free to fork and improve.
|
Для запуска тестов выполните `npm test`. На текущий момен покрытие тестами не 100%
|
||||||
I do my best accept pull requests in a timely manor, especially when tests and updated docs
|
|
||||||
are included.
|
|
||||||
|
|
||||||
## Tests
|
|
||||||
|
|
||||||
Tests included use Mocha. Use `npm test` to run the tests.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm test
|
$ npm test
|
||||||
|
|||||||
Reference in New Issue
Block a user