main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1021 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | // Generated by CoffeeScript 2.5.1
|
---|
4 | var AnsiPainter, _common;
|
---|
5 |
|
---|
6 | AnsiPainter = require('../../AnsiPainter');
|
---|
7 | module.exports = _common = {
|
---|
8 | getStyleTagsFor: function getStyleTagsFor(style) {
|
---|
9 | var i, len, ret, tag, tagName, tagsToAdd;
|
---|
10 | tagsToAdd = [];
|
---|
11 |
|
---|
12 | if (style.color != null) {
|
---|
13 | tagName = 'color-' + style.color;
|
---|
14 |
|
---|
15 | if (AnsiPainter.tags[tagName] == null) {
|
---|
16 | throw Error("Unknown color `".concat(style.color, "`"));
|
---|
17 | }
|
---|
18 |
|
---|
19 | tagsToAdd.push(tagName);
|
---|
20 | }
|
---|
21 |
|
---|
22 | if (style.background != null) {
|
---|
23 | tagName = 'bg-' + style.background;
|
---|
24 |
|
---|
25 | if (AnsiPainter.tags[tagName] == null) {
|
---|
26 | throw Error("Unknown background `".concat(style.background, "`"));
|
---|
27 | }
|
---|
28 |
|
---|
29 | tagsToAdd.push(tagName);
|
---|
30 | }
|
---|
31 |
|
---|
32 | ret = {
|
---|
33 | before: '',
|
---|
34 | after: ''
|
---|
35 | };
|
---|
36 |
|
---|
37 | for (i = 0, len = tagsToAdd.length; i < len; i++) {
|
---|
38 | tag = tagsToAdd[i];
|
---|
39 | ret.before = "<".concat(tag, ">") + ret.before;
|
---|
40 | ret.after = ret.after + "</".concat(tag, ">");
|
---|
41 | }
|
---|
42 |
|
---|
43 | return ret;
|
---|
44 | }
|
---|
45 | }; |
---|
Note:
See
TracBrowser
for help on using the repository browser.