rhet-butler 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/bin/rhet-butler +5 -0
  2. data/default-configuration/assets/apple-touch-icon-precomposed.png +0 -0
  3. data/default-configuration/assets/apple-touch-icon.png +0 -0
  4. data/default-configuration/assets/favicon.ico +0 -0
  5. data/default-configuration/assets/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNSonF5uFdDttMLvmWuJdhhgs.ttf +0 -0
  6. data/default-configuration/assets/fonts/opensans/v6/PRmiXeptR36kaC0GEAetxi8cqLH4MEiSE0ROcU-qHOA.ttf +0 -0
  7. data/default-configuration/assets/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf +0 -0
  8. data/default-configuration/assets/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBp0EAVxt0G0biEntp43Qt6E.ttf +0 -0
  9. data/default-configuration/assets/fonts/ptsans/v5/0XxGQsSc1g4rdRdjJKZrNC3USBnSvpkopQaUR-2r7iU.ttf +0 -0
  10. data/default-configuration/assets/fonts/ptsans/v5/FUDHvzEKSJww3kCxuiAo2A.ttf +0 -0
  11. data/default-configuration/assets/fonts/ptsans/v5/PIPMHY90P7jtyjpXuZ2cLKCWcynf_cDxXwCLxiixG1c.ttf +0 -0
  12. data/default-configuration/assets/fonts/ptsans/v5/lILlYDvubYemzYzN7GbLkInF5uFdDttMLvmWuJdhhgs.ttf +0 -0
  13. data/default-configuration/assets/fonts/ptserif/v5/03aPdn7fFF3H6ngCgAlQzC3USBnSvpkopQaUR-2r7iU.ttf +0 -0
  14. data/default-configuration/assets/fonts/ptserif/v5/EgBlzoNBIHxNPCMwXaAhYPesZW2xOQ-xsNqO47m55DA.ttf +0 -0
  15. data/default-configuration/assets/fonts/ptserif/v5/Foydq9xJp--nfYIx2TBz9fEr6Hm6RMS0v1dtXsGir4g.ttf +0 -0
  16. data/default-configuration/assets/fonts/ptserif/v5/QABk9IxT-LFTJ_dQzv7xpJ0EAVxt0G0biEntp43Qt6E.ttf +0 -0
  17. data/default-configuration/assets/javascript/highlight.js/LICENSE +24 -0
  18. data/default-configuration/assets/javascript/highlight.js/README.md +143 -0
  19. data/default-configuration/assets/javascript/highlight.js/README.ru.md +149 -0
  20. data/default-configuration/assets/javascript/highlight.js/classref.txt +568 -0
  21. data/default-configuration/assets/javascript/highlight.pack.js +1 -0
  22. data/default-configuration/assets/javascript/impress.js +800 -0
  23. data/default-configuration/assets/javascript/sockjs-0.2.1.js +2014 -0
  24. data/default-configuration/assets/javascript/sockjs-0.3.js +2314 -0
  25. data/default-configuration/assets/rhet-butler.jpg +0 -0
  26. data/default-configuration/assets/stylesheets/google-open-sans.css +72 -0
  27. data/default-configuration/assets/stylesheets/highlight/solarized_dark.css +88 -0
  28. data/default-configuration/assets/stylesheets/presentation.css +483 -0
  29. data/default-configuration/assets/stylesheets/presenter/presentation.css +477 -0
  30. data/default-configuration/assets/stylesheets/setup.css +0 -0
  31. data/default-configuration/common/config.yaml +4 -0
  32. data/default-configuration/common/templates/header-javascript.html +3 -0
  33. data/default-configuration/common/templates/presentation.html.erb +44 -0
  34. data/default-configuration/common/templates/presenter-qr.html.erb +77 -0
  35. data/default-configuration/common/templates/stylesheets.html.erb +3 -0
  36. data/default-configuration/presenter/config.yaml +7 -0
  37. data/default-configuration/presenter/templates/live-javascript.html.erb +26 -0
  38. data/default-configuration/presenter/templates/slide-notes.html.erb +3 -0
  39. data/default-configuration/presenter/templates/stylesheets.html.erb +3 -0
  40. data/default-configuration/viewer/config.yaml +7 -0
  41. data/default-configuration/viewer/templates/live-javascript.html.erb +16 -0
  42. data/default-configuration/viewer/templates/slide-notes.html.erb +0 -0
  43. data/lib/rhet-butler/arrangement.rb +78 -0
  44. data/lib/rhet-butler/command-line.rb +49 -0
  45. data/lib/rhet-butler/configuration.rb +76 -0
  46. data/lib/rhet-butler/file-manager.rb +126 -0
  47. data/lib/rhet-butler/html-generator.rb +29 -0
  48. data/lib/rhet-butler/layout-rule.rb +57 -0
  49. data/lib/rhet-butler/messaging.rb +58 -0
  50. data/lib/rhet-butler/slide-group.rb +56 -0
  51. data/lib/rhet-butler/slide-includer.rb +34 -0
  52. data/lib/rhet-butler/slide-loader.rb +361 -0
  53. data/lib/rhet-butler/slide.rb +164 -0
  54. data/lib/rhet-butler/static-generator.rb +44 -0
  55. data/lib/rhet-butler/web/assets-app.rb +40 -0
  56. data/lib/rhet-butler/web/main-app.rb +139 -0
  57. data/lib/rhet-butler/web/presentation-app.rb +50 -0
  58. data/lib/rhet-butler/web/qr-display-app.rb +37 -0
  59. data/lib/rhet-butler/yaml-schema.rb +9 -0
  60. data/lib/rhet-butler/yaml-type.rb +23 -0
  61. data/lib/rhet-butler.rb +2 -0
  62. data/spec/arrangements.rb +76 -0
  63. data/spec/html-generation.rb +48 -0
  64. data/spec/presentation-view.rb +72 -0
  65. data/spec/rhet-butler.rb +59 -0
  66. data/spec/slide-loader.rb +51 -0
  67. data/spec/slide-processing.rb +73 -0
  68. data/spec_support/gem_test_suite.rb +17 -0
  69. metadata +324 -0
data/bin/rhet-butler ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # vim: set ft=ruby :
3
+ require 'rhet-butler/command-line'
4
+
5
+ RhetButler::CommandLine.start
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2006, Ivan Sagalaev
2
+ All rights reserved.
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of highlight.js nor the names of its contributors
12
+ may be used to endorse or promote products derived from this software
13
+ without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
16
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,143 @@
1
+ # Highlight.js
2
+
3
+ Highlight.js highlights syntax in code examples on blogs, forums and,
4
+ in fact, on any web page. It's very easy to use because it works
5
+ automatically: finds blocks of code, detects a language, highlights it.
6
+
7
+ Autodetection can be fine tuned when it fails by itself (see "Heuristics").
8
+
9
+
10
+ ## Basic usage
11
+
12
+ Link the library and a stylesheet from your page and hook highlighting to
13
+ the page load event:
14
+
15
+ ```html
16
+ <link rel="stylesheet" href="styles/default.css">
17
+ <script src="highlight.pack.js"></script>
18
+ <script>hljs.initHighlightingOnLoad();</script>
19
+ ```
20
+
21
+ This will highlight all code on the page marked up as `<pre><code> .. </code></pre>`.
22
+ If you use different markup or need to apply highlighting dynamically, read
23
+ "Custom initialization" below.
24
+
25
+ - You can download your own customized version of "highlight.pack.js" or
26
+ use the hosted one as described on the download page:
27
+ <http://softwaremaniacs.org/soft/highlight/en/download/>
28
+
29
+ - Style themes are available in the download package or as hosted files.
30
+ To create a custom style for your site see the class reference in the file
31
+ [classref.txt][cr] from the downloaded package.
32
+
33
+ [cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt
34
+
35
+
36
+ ## node.js
37
+
38
+ Highlight.js can be used under node.js. The package with all supported languages is
39
+ installable from NPM:
40
+
41
+ npm install highlight.js
42
+
43
+ Alternatively, you can build it from the source with only languages you need:
44
+
45
+ python tools/build.py -tnode lang1 lang2 ..
46
+
47
+ Using the library:
48
+
49
+ ```javascript
50
+ var hljs = require('highlight.js');
51
+
52
+ // If you know the language
53
+ hljs.highlight(lang, code).value;
54
+
55
+ // Automatic language detection
56
+ hljs.highlightAuto(code).value;
57
+ ```
58
+
59
+ ## Tab replacement
60
+
61
+ You can replace TAB ('\x09') characters used for indentation in your code
62
+ with some fixed number of spaces or with a `<span>` to give them special
63
+ styling:
64
+
65
+ ```html
66
+ <script type="text/javascript">
67
+ hljs.tabReplace = ' '; // 4 spaces
68
+ // ... or
69
+ hljs.tabReplace = '<span class="indent">\t</span>';
70
+
71
+ hljs.initHighlightingOnLoad();
72
+ </script>
73
+ ```
74
+
75
+ ## Custom initialization
76
+
77
+ If you use different markup for code blocks you can initialize them manually
78
+ with `highlightBlock(code, tabReplace, useBR)` function. It takes a DOM element
79
+ containing the code to highlight and optionally a string with which to replace
80
+ TAB characters.
81
+
82
+ Initialization using, for example, jQuery might look like this:
83
+
84
+ ```javascript
85
+ $(document).ready(function() {
86
+ $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
87
+ });
88
+ ```
89
+
90
+ You can use `highlightBlock` to highlight blocks dynamically inserted into
91
+ the page. Just make sure you don't do it twice for already highlighted
92
+ blocks.
93
+
94
+ If your code container relies on `<br>` tags instead of line breaks (i.e. if
95
+ it's not `<pre>`) pass `true` into the third parameter of `highlightBlock`
96
+ to make highlight.js use `<br>` in the output:
97
+
98
+ ```javascript
99
+ $('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)});
100
+ ```
101
+
102
+
103
+ ## Heuristics
104
+
105
+ Autodetection of a code's language is done using a simple heuristic:
106
+ the program tries to highlight a fragment with all available languages and
107
+ counts all syntactic structures that it finds along the way. The language
108
+ with greatest count wins.
109
+
110
+ This means that in short fragments the probability of an error is high
111
+ (and it really happens sometimes). In this cases you can set the fragment's
112
+ language explicitly by assigning a class to the `<code>` element:
113
+
114
+ ```html
115
+ <pre><code class="html">...</code></pre>
116
+ ```
117
+
118
+ You can use class names recommended in HTML5: "language-html",
119
+ "language-php". Classes also can be assigned to the `<pre>` element.
120
+
121
+ To disable highlighting of a fragment altogether use "no-highlight" class:
122
+
123
+ ```html
124
+ <pre><code class="no-highlight">...</code></pre>
125
+ ```
126
+
127
+
128
+ ## Export
129
+
130
+ File export.html contains a little program that allows you to paste in a code
131
+ snippet and then copy and paste the resulting HTML code generated by the
132
+ highlighter. This is useful in situations when you can't use the script itself
133
+ on a site.
134
+
135
+
136
+ ## Meta
137
+
138
+ - Version: 7.3
139
+ - URL: http://softwaremaniacs.org/soft/highlight/en/
140
+ - Author: Ivan Sagalaev (<maniac@softwaremaniacs.org>)
141
+
142
+ For the license terms see LICENSE files.
143
+ For the list of contributors see AUTHORS.en.txt file.
@@ -0,0 +1,149 @@
1
+ # Highlight.js
2
+
3
+ Highlight.js нужен для подсветки синтаксиса в примерах кода в блогах,
4
+ форумах и вообще на любых веб-страницах. Пользоваться им очень просто,
5
+ потому что работает он автоматически: сам находит блоки кода, сам
6
+ определяет язык, сам подсвечивает.
7
+
8
+ Автоопределением языка можно управлять, когда оно не справляется само (см.
9
+ дальше "Эвристика").
10
+
11
+
12
+ ## Простое использование
13
+
14
+ Подключите библиотеку и стиль на страницу и повесть вызов подсветки на
15
+ загрузку страницы:
16
+
17
+ ```html
18
+ <link rel="stylesheet" href="styles/default.css">
19
+ <script src="highlight.pack.js"></script>
20
+ <script>hljs.initHighlightingOnLoad();</script>
21
+ ```
22
+
23
+ Весь код на странице, обрамлённый в теги `<pre><code> .. </code></pre>`
24
+ будет автоматически подсвечен. Если вы используете другие теги или хотите
25
+ подсвечивать блоки кода динамически, читайте "Инициализацию вручную" ниже.
26
+
27
+ - Вы можете скачать собственную версию "highlight.pack.js" или сослаться
28
+ на захостенный файл, как описано на странице загрузки:
29
+ <http://softwaremaniacs.org/soft/highlight/download/>
30
+
31
+ - Стилевые темы можно найти в загруженном архиве или также использовать
32
+ захостенные. Чтобы сделать собственный стиль для своего сайта, вам
33
+ будет полезен справочник классов в файле [classref.txt][cr], который тоже
34
+ есть в архиве.
35
+
36
+ [cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt
37
+
38
+
39
+ ## node.js
40
+
41
+ Highlight.js можно использовать в node.js. Библиотеку со всеми возможными языками можно
42
+ установить с NPM:
43
+
44
+ npm install highlight.js
45
+
46
+ Также её можно собрать из исходников с только теми языками, которые нужны:
47
+
48
+ python tools/build.py -tnode lang1 lang2 ..
49
+
50
+ Использование библиотеки:
51
+
52
+ ```javascript
53
+ var hljs = require('highlight.js');
54
+
55
+ // Если вы знаете язык
56
+ hljs.highlight(lang, code).value;
57
+
58
+ // Автоопределение языка
59
+ hljs.highlightAuto(code).value;
60
+ ```
61
+
62
+
63
+ ## Замена TABов
64
+
65
+ Также вы можете заменить символы TAB ('\x09'), используемые для отступов, на
66
+ фиксированное количество пробелов или на отдельный `<span>`, чтобы задать ему
67
+ какой-нибудь специальный стиль:
68
+
69
+ ```html
70
+ <script type="text/javascript">
71
+ hljs.tabReplace = ' '; // 4 spaces
72
+ // ... or
73
+ hljs.tabReplace = '<span class="indent">\t</span>';
74
+
75
+ hljs.initHighlightingOnLoad();
76
+ </script>
77
+ ```
78
+
79
+
80
+ ## Инициализация вручную
81
+
82
+ Если вы используете другие теги для блоков кода, вы можете инициализировать их
83
+ явно с помощью функции `highlightBlock(code, tabReplace, useBR)`. Она принимает
84
+ DOM-элемент с текстом расцвечиваемого кода и опционально - строчку для замены
85
+ символов TAB.
86
+
87
+ Например с использованием jQuery код инициализации может выглядеть так:
88
+
89
+ ```javascript
90
+ $(document).ready(function() {
91
+ $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
92
+ });
93
+ ```
94
+
95
+ `highlightBlock` можно также использовать, чтобы подсветить блоки кода,
96
+ добавленные на страницу динамически. Только убедитесь, что вы не делаете этого
97
+ повторно для уже раскрашенных блоков.
98
+
99
+ Если ваш блок кода использует `<br>` вместо переводов строки (т.е. если это не
100
+ `<pre>`), передайте `true` третьим параметром в `highlightBlock`:
101
+
102
+ ```javascript
103
+ $('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)});
104
+ ```
105
+
106
+
107
+ ## Эвристика
108
+
109
+ Определение языка, на котором написан фрагмент, делается с помощью
110
+ довольно простой эвристики: программа пытается расцветить фрагмент всеми
111
+ языками подряд, и для каждого языка считает количество подошедших
112
+ синтаксически конструкций и ключевых слов. Для какого языка нашлось больше,
113
+ тот и выбирается.
114
+
115
+ Это означает, что в коротких фрагментах высока вероятность ошибки, что
116
+ периодически и случается. Чтобы указать язык фрагмента явно, надо написать
117
+ его название в виде класса к элементу `<code>`:
118
+
119
+ ```html
120
+ <pre><code class="html">...</code></pre>
121
+ ```
122
+
123
+ Можно использовать рекомендованные в HTML5 названия классов:
124
+ "language-html", "language-php". Также можно назначать классы на элемент
125
+ `<pre>`.
126
+
127
+ Чтобы запретить расцветку фрагмента вообще, используется класс "no-highlight":
128
+
129
+ ```html
130
+ <pre><code class="no-highlight">...</code></pre>
131
+ ```
132
+
133
+
134
+ ## Экспорт
135
+
136
+ В файле export.html находится небольшая программка, которая показывает и дает
137
+ скопировать непосредственно HTML-код подсветки для любого заданного фрагмента кода.
138
+ Это может понадобится например на сайте, на котором нельзя подключить сам скрипт
139
+ highlight.js.
140
+
141
+
142
+ ## Координаты
143
+
144
+ - Версия: 7.3
145
+ - URL: http://softwaremaniacs.org/soft/highlight/
146
+ - Автор: Иван Сагалаев (<maniac@softwaremaniacs.org>)
147
+
148
+ Лицензионное соглашение читайте в файле LICENSE.
149
+ Список соавторов читайте в файле AUTHORS.ru.txt