{"action":"created","comment":{"url":"https://api.github.com/repos/bem/bem-xjst/pulls/comments/91077316","pull_request_review_id":11584309,"id":91077316,"diff_hunk":"@@ -1,159 +1,174 @@\n-# BEM-XJST\n+# bem-xjst\n \n-Declarative template engine for the browser and server.\n+Declarative template engine for the browser and server with regular JS syntax.\n \n [![NPM version](http://img.shields.io/npm/v/bem-xjst.svg?style=flat)](http://www.npmjs.org/package/bem-xjst)\n [![Build Status](http://img.shields.io/travis/bem/bem-xjst/master.svg)](https://travis-ci.org/bem/bem-xjst)\n [![Dependency Status](https://david-dm.org/bem/bem-xjst.svg)](https://david-dm.org/bem/bem-xjst)\n [![devDependency Status](https://david-dm.org/bem/bem-xjst/dev-status.svg)](https://david-dm.org/bem/bem-xjst#info=devDependencies)\n [![Coverage Status](https://coveralls.io/repos/github/bem/bem-xjst/badge.svg?branch=coverage-badge)](https://coveralls.io/github/bem/bem-xjst?branch=coverage-badge)\n \n-[Online demo](https://bem.github.io/bem-xjst/). Twitter account: [@bemxjst](https://twitter.com/bemxjst)\n+## Features\n \n-## Installation\n+### Templates are extensible: they can be redefined or extended\n \n-Install it by [npm](https://npmjs.org): `npm install bem-xjst`.\n-\n-## Usage\n-\n-### As a node.js module\n+Not only by simple redefined via new templates, but using ‘modes’ you can redefine or extend only paticular part of output. For example only tag name or tag content.\n \n ```js\n-var bemxjst = require('bem-xjst');\n-var bemhtml = bemxjst.bemhtml;\n-\n-// Add templates\n-var templates = bemhtml.compile(function() {\n-  block('b').content()('yay');\n-});\n+block('link').tag()('span');\n+// The template set tag to `span` for all `link` blocks. \n+// And ‘mode’ tag() can be redefined if any condition passed.\n \n-// Apply templates to data context in BEMJSON format and get result as HTML string\n-var html = templates.apply({ block: 'b' });\n-// Result in html: <div class=\"b\">yay</div>\n+block('link').match(function(node, ctx) { return ctx.url; }).tag()('a');\n+// The template set tag to ‘a’ only if block ‘link’ have `url` field. \n+// Otherwise tag will be ‘span’ as previous template says.\n ```\n \n+### Templates are written using [pattern matching](/docs/en/7-runtime.md#how-templates-are-selected-and-applied) for the values and structure of input data\n+\n ```js\n-var bemxjst = require('bem-xjst');\n-var bemtree = bemxjst.bemtree;\n+block('list').tag()('ul');\n+block('item').tag()('li');\n+```\n \n-// Add templates\n-var templates = bemtree.compile(function() {\n-  block('b').content()('yay');\n-});\n+For these two declarative-style templates we can apply data:\n+```js\n+{\n+  block: 'list',\n+  content: [\n+    {\n+      block: 'item',\n+      content: {\n+          block: 'list', \n+          content: [\n+              { block: 'item', content: 'CSS' },\n+              { block: 'item', content: 'HTML' }\n+          ]\n+      }\n+    },\n+    {\n+      block: 'item',\n+      content: {\n+          block: 'list', \n+          content: [\n+              { block: 'item', content: 'JS' }\n+          ]\n+      }\n+    }\n+  ]\n+}\n+```\n \n-// Apply templates to data context in BEMJSON format and get result as BEMJSON\n-var bemjson = templates.apply({ block: 'b' });\n-// Result in bemjson: { block: 'b1', content: 'yay' }\n+The result of apply is:\n+\n+```html\n+<ul class=\"list\">\n+    <li class=\"item\">\n+        <ul class=\"list\">\n+            <li class=\"item\">CSS</li>\n+            <li class=\"item\">HTML</li>\n+        </ul>\n+    </li>\n+    <li class=\"item\">\n+        <ul class=\"list\">\n+            <li class=\"item\">JS</li>\n+        </ul>\n+    </li>\n+</ul>\n ```\n \n-### As a CLI tool\n+As you can see templates as simple as CSS.\n \n-CLI can be used for creation bundles. See [Compiler generate](#generatestring-or-function).\n+### Traverses input data by default\n \n-```bash\n-$ bem-xjst --help\n+In example above you may have noticed that bem-xjst automaticaly traverses input data by `content` fields. This behaviour is default feature of bem-xjst. \n \n-Usage:\n-  bem-xjst [OPTIONS] [ARGS]\n+### Built-in rendering behavior is used by default, even if the user didn’t add templates\n \n+You probably already guessed that bem-xjst will give you result, even if no template has been added. For example from above it will be:\n \n-Options:\n-  -h, --help : Help\n-  -v, --version : Version\n-  -e, --engine : Engine name (default: bemhtml, supported: bemhtml | bemtree)\n-  -i INPUT, --input=INPUT : File with user templates (default: stdin)\n-  -o OUTPUT, --output=OUTPUT : Output bundle file (default: stdout)\n+```html\n+<div class=\"list\">\n+    <div class=\"item\">\n+        <div class=\"list\">\n+            <div class=\"item\">CSS</div>\n+            <div class=\"item\">HTML</div>\n+        </div>\n+    </div>\n+    <div class=\"item\">\n+        <div class=\"list\">\n+            <div class=\"item\">JS</div>\n+        </div>\n+    </div>\n+</div>\n ```\n \n-## API\n+That is more than half the work ;) You will add the salt (couple of templates for tags) and the HTML-soup is very tasty!\n \n-### Compiler\n \n-#### `.compile(string or function)`\n+### Written in JavaScript, so the entire JavaScript infrastructure is available for checking code quality and conforming to best practices\n \n-Compile input templates and return `templates` object.\n-(See documentation below for its methods)\n+Since templates is a regular JavaScript code you can use precommit hooks, automatic syntax validator from your editor and tools like jshint/eslint.\n \n-#### `.generate(string or function)`\n+### Runs on a server and client\n \n-Generate output JavaScript code that might be transferred and executed in\n-browser to get the `templates` object.\n+In any browser (with JS) you can use bem-xjst as well as in any JavaScript VM. We support Node.JS v0.10 and higher.","path":"README.md","position":163,"original_position":163,"commit_id":"b334879e5e4c6a268f067140d0354002b00b8911","original_commit_id":"b334879e5e4c6a268f067140d0354002b00b8911","user":{"login":"tadatuta","id":475746,"avatar_url":"https://avatars.githubusercontent.com/u/475746?v=3","gravatar_id":"","url":"https://api.github.com/users/tadatuta","html_url":"https://github.com/tadatuta","followers_url":"https://api.github.com/users/tadatuta/followers","following_url":"https://api.github.com/users/tadatuta/following{/other_user}","gists_url":"https://api.github.com/users/tadatuta/gists{/gist_id}","starred_url":"https://api.github.com/users/tadatuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tadatuta/subscriptions","organizations_url":"https://api.github.com/users/tadatuta/orgs","repos_url":"https://api.github.com/users/tadatuta/repos","events_url":"https://api.github.com/users/tadatuta/events{/privacy}","received_events_url":"https://api.github.com/users/tadatuta/received_events","type":"User","site_admin":false},"body":"уточнение про with JS, кмк, излишне. те, кто пользуются браузерами без поддержки js и сами все понимают :)\r\n\r\nИ фразу стоит инвертировать:\r\nYou can use `bem-xjst` in any browser as well as in any JavaScript VM.","created_at":"2016-12-06T13:32:58Z","updated_at":"2016-12-06T13:42:28Z","html_url":"https://github.com/bem/bem-xjst/pull/391#discussion_r91077316","pull_request_url":"https://api.github.com/repos/bem/bem-xjst/pulls/391","_links":{"self":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/comments/91077316"},"html":{"href":"https://github.com/bem/bem-xjst/pull/391#discussion_r91077316"},"pull_request":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/391"}}},"pull_request":{"url":"https://api.github.com/repos/bem/bem-xjst/pulls/391","id":96507752,"html_url":"https://github.com/bem/bem-xjst/pull/391","diff_url":"https://github.com/bem/bem-xjst/pull/391.diff","patch_url":"https://github.com/bem/bem-xjst/pull/391.patch","issue_url":"https://api.github.com/repos/bem/bem-xjst/issues/391","number":391,"state":"open","locked":false,"title":"Docs: readme updated (#390 fixed)","user":{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false},"body":"Fixes #390 \r\n\r\n@tadatuta @zxqfox \r\n\r\nguys our README.md is ugly, outdated and non informative. I decide to make it fresh and more attractive.\r\n\r\n * [Before](https://github.com/bem/bem-xjst/blob/master/README.md#bem-xjst) \r\n * [After](https://github.com/bem/bem-xjst/tree/new-readme__issue-390#bem-xjst)\r\n\r\nI use [pug](https://www.npmjs.com/package/pug), [ejs](https://www.npmjs.com/package/ejs) readme as a reference.\r\n\r\nI propose to examine the contents of the english version, after which I will translate it into russian.","created_at":"2016-12-05T10:58:52Z","updated_at":"2016-12-06T13:42:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c87d22dd4ee630352792076061fe979e2408419","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bem/bem-xjst/pulls/391/commits","review_comments_url":"https://api.github.com/repos/bem/bem-xjst/pulls/391/comments","review_comment_url":"https://api.github.com/repos/bem/bem-xjst/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bem/bem-xjst/issues/391/comments","statuses_url":"https://api.github.com/repos/bem/bem-xjst/statuses/b334879e5e4c6a268f067140d0354002b00b8911","head":{"label":"bem:new-readme__issue-390","ref":"new-readme__issue-390","sha":"b334879e5e4c6a268f067140d0354002b00b8911","user":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"repo":{"id":10028367,"name":"bem-xjst","full_name":"bem/bem-xjst","owner":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem/bem-xjst","description":"Declarative template engine for the browser and server","fork":false,"url":"https://api.github.com/repos/bem/bem-xjst","forks_url":"https://api.github.com/repos/bem/bem-xjst/forks","keys_url":"https://api.github.com/repos/bem/bem-xjst/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem/bem-xjst/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem/bem-xjst/teams","hooks_url":"https://api.github.com/repos/bem/bem-xjst/hooks","issue_events_url":"https://api.github.com/repos/bem/bem-xjst/issues/events{/number}","events_url":"https://api.github.com/repos/bem/bem-xjst/events","assignees_url":"https://api.github.com/repos/bem/bem-xjst/assignees{/user}","branches_url":"https://api.github.com/repos/bem/bem-xjst/branches{/branch}","tags_url":"https://api.github.com/repos/bem/bem-xjst/tags","blobs_url":"https://api.github.com/repos/bem/bem-xjst/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem/bem-xjst/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem/bem-xjst/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem/bem-xjst/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem/bem-xjst/statuses/{sha}","languages_url":"https://api.github.com/repos/bem/bem-xjst/languages","stargazers_url":"https://api.github.com/repos/bem/bem-xjst/stargazers","contributors_url":"https://api.github.com/repos/bem/bem-xjst/contributors","subscribers_url":"https://api.github.com/repos/bem/bem-xjst/subscribers","subscription_url":"https://api.github.com/repos/bem/bem-xjst/subscription","commits_url":"https://api.github.com/repos/bem/bem-xjst/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem/bem-xjst/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem/bem-xjst/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem/bem-xjst/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem/bem-xjst/contents/{+path}","compare_url":"https://api.github.com/repos/bem/bem-xjst/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem/bem-xjst/merges","archive_url":"https://api.github.com/repos/bem/bem-xjst/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem/bem-xjst/downloads","issues_url":"https://api.github.com/repos/bem/bem-xjst/issues{/number}","pulls_url":"https://api.github.com/repos/bem/bem-xjst/pulls{/number}","milestones_url":"https://api.github.com/repos/bem/bem-xjst/milestones{/number}","notifications_url":"https://api.github.com/repos/bem/bem-xjst/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem/bem-xjst/labels{/name}","releases_url":"https://api.github.com/repos/bem/bem-xjst/releases{/id}","deployments_url":"https://api.github.com/repos/bem/bem-xjst/deployments","created_at":"2013-05-13T09:22:05Z","updated_at":"2016-11-20T14:05:03Z","pushed_at":"2016-12-06T12:48:56Z","git_url":"git://github.com/bem/bem-xjst.git","ssh_url":"git@github.com:bem/bem-xjst.git","clone_url":"https://github.com/bem/bem-xjst.git","svn_url":"https://github.com/bem/bem-xjst","homepage":"https://bem.github.io/bem-xjst","size":1884,"stargazers_count":83,"watchers_count":83,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":30,"mirror_url":null,"open_issues_count":52,"forks":30,"open_issues":52,"watchers":83,"default_branch":"master"}},"base":{"label":"bem:master","ref":"master","sha":"79b3e4e125b2596debecfe8bae2f0ed2c65858b4","user":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"repo":{"id":10028367,"name":"bem-xjst","full_name":"bem/bem-xjst","owner":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem/bem-xjst","description":"Declarative template engine for the browser and server","fork":false,"url":"https://api.github.com/repos/bem/bem-xjst","forks_url":"https://api.github.com/repos/bem/bem-xjst/forks","keys_url":"https://api.github.com/repos/bem/bem-xjst/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem/bem-xjst/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem/bem-xjst/teams","hooks_url":"https://api.github.com/repos/bem/bem-xjst/hooks","issue_events_url":"https://api.github.com/repos/bem/bem-xjst/issues/events{/number}","events_url":"https://api.github.com/repos/bem/bem-xjst/events","assignees_url":"https://api.github.com/repos/bem/bem-xjst/assignees{/user}","branches_url":"https://api.github.com/repos/bem/bem-xjst/branches{/branch}","tags_url":"https://api.github.com/repos/bem/bem-xjst/tags","blobs_url":"https://api.github.com/repos/bem/bem-xjst/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem/bem-xjst/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem/bem-xjst/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem/bem-xjst/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem/bem-xjst/statuses/{sha}","languages_url":"https://api.github.com/repos/bem/bem-xjst/languages","stargazers_url":"https://api.github.com/repos/bem/bem-xjst/stargazers","contributors_url":"https://api.github.com/repos/bem/bem-xjst/contributors","subscribers_url":"https://api.github.com/repos/bem/bem-xjst/subscribers","subscription_url":"https://api.github.com/repos/bem/bem-xjst/subscription","commits_url":"https://api.github.com/repos/bem/bem-xjst/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem/bem-xjst/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem/bem-xjst/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem/bem-xjst/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem/bem-xjst/contents/{+path}","compare_url":"https://api.github.com/repos/bem/bem-xjst/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem/bem-xjst/merges","archive_url":"https://api.github.com/repos/bem/bem-xjst/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem/bem-xjst/downloads","issues_url":"https://api.github.com/repos/bem/bem-xjst/issues{/number}","pulls_url":"https://api.github.com/repos/bem/bem-xjst/pulls{/number}","milestones_url":"https://api.github.com/repos/bem/bem-xjst/milestones{/number}","notifications_url":"https://api.github.com/repos/bem/bem-xjst/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem/bem-xjst/labels{/name}","releases_url":"https://api.github.com/repos/bem/bem-xjst/releases{/id}","deployments_url":"https://api.github.com/repos/bem/bem-xjst/deployments","created_at":"2013-05-13T09:22:05Z","updated_at":"2016-11-20T14:05:03Z","pushed_at":"2016-12-06T12:48:56Z","git_url":"git://github.com/bem/bem-xjst.git","ssh_url":"git@github.com:bem/bem-xjst.git","clone_url":"https://github.com/bem/bem-xjst.git","svn_url":"https://github.com/bem/bem-xjst","homepage":"https://bem.github.io/bem-xjst","size":1884,"stargazers_count":83,"watchers_count":83,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":30,"mirror_url":null,"open_issues_count":52,"forks":30,"open_issues":52,"watchers":83,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/391"},"html":{"href":"https://github.com/bem/bem-xjst/pull/391"},"issue":{"href":"https://api.github.com/repos/bem/bem-xjst/issues/391"},"comments":{"href":"https://api.github.com/repos/bem/bem-xjst/issues/391/comments"},"review_comments":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/391/comments"},"review_comment":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/391/commits"},"statuses":{"href":"https://api.github.com/repos/bem/bem-xjst/statuses/b334879e5e4c6a268f067140d0354002b00b8911"}}}}
{"actor":{"display_login":"tadatuta"}}