From afb15b150dba48d11d942a45a88fa07afd78403b Mon Sep 17 00:00:00 2001 From: LightAir Date: Thu, 26 Apr 2018 13:19:20 +0300 Subject: [PATCH] Update readme.md --- readme.md | 81 ++++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 49 deletions(-) diff --git a/readme.md b/readme.md index 6263024..cdbba0b 100644 --- a/readme.md +++ b/readme.md @@ -7,82 +7,71 @@ ![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg) ->RSS based, feed generator for Yandex turbo. +>Генератор RSS разментки для сервиса Турбо-страницы ->WARNING! Work In Progress +>ПРЕДУПРЕЖДЕНИЕ! Работа в процессе -### Usage +### Использование -#### Create a new feed +#### Создание канала ```js var TR = require('turbo-rss'); -var feed = new TS(feedOptions); +var feed = new TR(feedOptions); ``` -##### `feedOptions` +##### `Опции канала` - * `title` **string** Title of your site or feed - * `description` _optional_ **string** A short description of the feed. - * `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. - * `pubDate` _optional_ **Date object or date string** The publication date for content in the feed + * `title` **string** Название RSS-канала. + * `description` _optional_ **string** Описание канала одним предложением. Не используйте HTML-разметку.. + * `author` _optional_ **string** If included it is the name of the item's creator. **(Будет удалено)** + * `link` **url string** Домен сайта, данные которого транслируются.. + * `pubDate` _optional_ **Date object or date string** The publication date for content in the feed **(Будет удалено)** -#### Add items to a feed - -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. - + *Будет добавлено в новых версиях turbo:analytics, turbo:adNetwork* + +#### Добавление страницы в канал ```js feed.item(itemOptions); ``` ##### itemOptions - * `title` **string** Title of this particular item. - * `image_url` **url string** Link to header image - * `url` **url string** Url to the item. This could be a blog entry. - * `author` _optional_ **string** If included it is the name of the item's creator. - If not provided the item author will be the same as the feed author. This is typical - except on multi-author blogs. - * `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 + * `title` **string** Заголовок страницы. + * `image_url` **url string** Адрес изображения, которое используется в качестве обложки. Изображение может быть в любом формате. + * `url` **url string** URL страницы сайта, для которой нужно сформировать Турбо-страницу. + * `author` _optional_ **string** Автор статьи, размещенной на странице. + * `date` **string** Время публикации контента на сайте источника. + * `content` **string** Содержимое страницы -##### Feed XML + *Будет добавлено в новых версиях turbo:source, turbo:topic, yandex:related, menu, pubDate как алиас date + +##### Получение XML ```js 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 -var RSS = require('rss'); +var TR = require('turbo-rss'); /* lets create feed */ -var feed = new RSS({ +var feed = new TR({ title: 'title', description: 'description', - link: 'http://example.com', // site url - author: 'LightAir', - pubDate: 'May 20, 2012 04:00:00 GMT' + link: 'http://example.com', }); /* loop over data and add to feed */ feed.item({ title: 'item title', image_url: 'http://example.com/example.png', - url: 'http://example.com/article4?this&that', // link to the item - author: 'LightAir', // optional - defaults to feed author property + url: 'http://example.com/article4?this&that', + author: 'LightAir', date: 'May 27, 2012', content: '

hello

' }); @@ -91,15 +80,9 @@ feed.item({ var xml = feed.xml(); ``` -### Contributing +## Тестирование -Contributions to the project are welcome. Feel free to fork and improve. -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. +Для запуска тестов выполните `npm test`. На текущий момен покрытие тестами не 100% ```sh $ npm test