hyla 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.adoc +30 -2
- data/lib/hyla.rb +4 -0
- data/lib/hyla/commands/generate.rb +102 -71
- data/lib/hyla/project.rb +1 -1
- data/lib/resources/backends/slim/html5/document.html.slim +2 -0
- data/lib/resources/backends/slim/revealjs/document.html.slim +4 -1
- data/lib/resources/backends/slim/revealjs/section.html.slim +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDFkMzdiMWQyZmI5ODlhOWUwYzM5MDQ3NDViMTllOWEyMmNlMDBjNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzYyMjU2ZjRlOWExYzQ4YjA3YjdhNjExZjc2YzliNTA1ZDlkNjk3OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzdkZGE4NmYzYWRiMDM4YmQ3ZjdhZDg2Y2YxN2ZiOTkyNWUxMTEzZGVkMGIw
|
10
|
+
M2E2YzlhNjlmYTMyMDZjZmFkMmY0NmI1NWM2MmNmMTNmMGQxODZlMmVjMmQ0
|
11
|
+
NTEyODY2ZWM5MmI5ZjVjMzE2NThjOTA4OGI3ODAyMGQ2YWRlODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWQ3ZTFhYTliMDBmOWY0ODE1Yjk5ZjUzMjNmY2IxNDY0MjFmMTJlYjMyZmI0
|
14
|
+
MmVmOGI4ZGZlMzQ3YjRkZWZkNTM3MzBlNzk2YjY3ZWZjMGUyZWUxNmFhYzQx
|
15
|
+
OWQ3YWNjMmI1ZjMxMjM4ZDgyN2YzYTI2NmIxZjQ5MjI4ODA2MjI=
|
data/README.adoc
CHANGED
@@ -67,7 +67,7 @@ And then execute:
|
|
67
67
|
|
68
68
|
**Or** install it yourself as:
|
69
69
|
|
70
|
-
$ gem install hyla -v 1.0.
|
70
|
+
$ gem install hyla -v 1.0.6
|
71
71
|
|
72
72
|
== For Developer's only
|
73
73
|
|
@@ -79,9 +79,23 @@ And then execute:
|
|
79
79
|
|
80
80
|
gem build hyla.gemspec
|
81
81
|
gem install hyla-1.0.x.gem -l
|
82
|
-
gem yank hyla -v 1.0.x
|
83
82
|
gem push hyla-1.0.x.gem
|
84
83
|
|
84
|
+
== To delete a release pushed to RubyGems (= yank)
|
85
|
+
|
86
|
+
gem yank hyla -v 1.0.x
|
87
|
+
|
88
|
+
== To create a release, generate a tagged release and publish it to Gem Repo
|
89
|
+
|
90
|
+
gem build hyla.gemspec
|
91
|
+
gem install hyla-1.0.6.gem
|
92
|
+
git commit -m "Release Hyla 1.0.6" -a
|
93
|
+
git push
|
94
|
+
git tag -a hyla-1.0.6 -m "Release hyla 1.0.6"
|
95
|
+
git push origin hyla-1.0.6
|
96
|
+
|
97
|
+
gem push hyla-1.0.6.gem
|
98
|
+
|
85
99
|
== Usage
|
86
100
|
|
87
101
|
Open a terminal and move to the folder where you would like to create a new project or develop an existing. As Hyla is command line tool, it will be used with one of the following commands :
|
@@ -121,6 +135,20 @@ Issue tracker (GitHub):: {issues}
|
|
121
135
|
|
122
136
|
== Changelog
|
123
137
|
|
138
|
+
=== v1.0.6 - @cmoulliard
|
139
|
+
|
140
|
+
Enhancements / Improvements::
|
141
|
+
|
142
|
+
* Add attribute to include additional <scripts/> tags within the HTML generated(link:{issues}74[#74])
|
143
|
+
* Exclude lab_assets & lab_assets_solution(link:{issues}73[#73])
|
144
|
+
* Add data-state attribute to revealjs slim backend(link:{issues}72[#72])
|
145
|
+
* Add possibility to definie the transition style for revealjs(link:{issues}69[#69])
|
146
|
+
* It should be possible to define custom theme for revealjs(link:{issues}68[#68])
|
147
|
+
|
148
|
+
Bug fixes::
|
149
|
+
|
150
|
+
* Snippet tag is added to the parent include file bug(link:{issues}67[#67])
|
151
|
+
|
124
152
|
=== v1.0.5 - @cmoulliard
|
125
153
|
|
126
154
|
New Features::
|
data/lib/hyla.rb
CHANGED
@@ -23,6 +23,10 @@ require 'safe_yaml'
|
|
23
23
|
require 'asciidoctor'
|
24
24
|
require 'asciidoctor/backends/html5'
|
25
25
|
# require 'asciidoctor/backends/_stylesheets'
|
26
|
+
|
27
|
+
# Added to fix issue with Ruby 2.0 on Windows machine
|
28
|
+
require 'em/pure_ruby'
|
29
|
+
|
26
30
|
require 'eventmachine'
|
27
31
|
require 'em-websocket'
|
28
32
|
require 'http/parser'
|
@@ -41,9 +41,10 @@ module Hyla
|
|
41
41
|
|
42
42
|
merged_options = Configuration[options].deep_merge(new_asciidoctor_option)
|
43
43
|
|
44
|
-
extensions = 'adoc
|
44
|
+
extensions = 'adoc,ad,asciidoc'
|
45
|
+
excludes = 'lab_assets|lab_assets_solution|code|snippets|templates|generated_content|generated_content_instructor|generated_content_snippet|generated_slideshow|generated_content_pdf|generated_content_students'
|
45
46
|
|
46
|
-
self.asciidoc_to_html(@source, @destination, extensions, merged_options)
|
47
|
+
self.asciidoc_to_html(@source, @destination, extensions, excludes, merged_options)
|
47
48
|
|
48
49
|
when 'index2html'
|
49
50
|
Hyla.logger.info "Rendering : Asciidoctor Indexed Files to HTML"
|
@@ -62,10 +63,13 @@ module Hyla
|
|
62
63
|
|
63
64
|
merged_options = Configuration[options].deep_merge(new_asciidoctor_option)
|
64
65
|
|
66
|
+
#
|
65
67
|
# Extension(s) of the files containing include directives
|
68
|
+
#
|
66
69
|
extensions = 'txt'
|
70
|
+
excludes = 'lab_assets|lab_assets_solution|code|snippets|templates|generated_content|generated_content_instructor|generated_content_snippet|generated_slideshow|generated_content_pdf|generated_content_students'
|
67
71
|
|
68
|
-
self.asciidoc_to_html(@source, @destination, extensions, merged_options)
|
72
|
+
self.asciidoc_to_html(@source, @destination, extensions, excludes, merged_options)
|
69
73
|
|
70
74
|
when 'html2pdf'
|
71
75
|
|
@@ -144,7 +148,7 @@ module Hyla
|
|
144
148
|
#
|
145
149
|
# Call Asciidoctor.render function
|
146
150
|
#
|
147
|
-
def self.asciidoc_to_html(source, destination, extensions, options)
|
151
|
+
def self.asciidoc_to_html(source, destination, extensions, excludes, options)
|
148
152
|
|
149
153
|
# Move to Source directory & Retrieve Asciidoctor files to be processed
|
150
154
|
source = File.expand_path source
|
@@ -173,74 +177,80 @@ module Hyla
|
|
173
177
|
# Delete destination directory (generated_content, ...)
|
174
178
|
# FileUtils.rm_rf(Dir.glob(@destination))
|
175
179
|
|
176
|
-
# Search for files using extensions parameter and do the rendering
|
177
180
|
adoc_file_paths = []
|
178
|
-
Find.find(current_dir) do |f|
|
179
|
-
if f =~ /.*\.(?:#{extensions})$/
|
180
181
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
182
|
+
#
|
183
|
+
# Search for files into the current directory using extensions parameter as filter key
|
184
|
+
# Reject directory specified and do the rendering
|
185
|
+
#
|
186
|
+
files = Dir[current_dir + "/**/*.{" + extensions + "}"].reject { |f| f =~ /\/#{excludes}\// }
|
186
187
|
|
187
|
-
|
188
|
-
|
188
|
+
#
|
189
|
+
# Check if companion parameter is defined
|
190
|
+
# as we have to modify the AllSlides.txt file
|
191
|
+
# containing as tag name this value [tag=snippet]
|
192
|
+
#
|
193
|
+
if options[:snippet_content] == true
|
194
|
+
files.each do |f|
|
195
|
+
add_tag_to_index_file(f)
|
196
|
+
end
|
197
|
+
end
|
189
198
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
# Copy Fonts
|
198
|
-
# TODO : Verify if we still need to do that as the FONTS liberation have been moved
|
199
|
-
# TODO : under local lib directory of revealjs
|
200
|
-
# self.cp_resources_to_dir(File.dirname(html_dir), 'fonts')
|
201
|
-
|
202
|
-
# Copy Resources for Slideshow
|
203
|
-
case options[:backend]
|
204
|
-
when 'deckjs'
|
205
|
-
# Copy css, js files to destination directory
|
206
|
-
self.cp_resources_to_dir(File.dirname(html_dir), 'deck.js')
|
207
|
-
when 'revealjs'
|
208
|
-
self.cp_resources_to_dir(File.dirname(html_dir), 'revealjs')
|
209
|
-
end
|
199
|
+
files.each do |f|
|
200
|
+
path_to_source = Pathname.new(source)
|
201
|
+
path_to_adoc_file = Pathname.new(f)
|
202
|
+
relative_path = path_to_adoc_file.relative_path_from(path_to_source).to_s
|
203
|
+
Hyla.logger.debug ">> Relative path: #{relative_path}"
|
204
|
+
adoc_file_paths << relative_path
|
210
205
|
|
211
|
-
|
212
|
-
|
213
|
-
# as we have to generate a new AllSlides.txt file
|
214
|
-
# containing as tag name this value [snippet]
|
215
|
-
#
|
216
|
-
if options[:snippet_content] == true
|
217
|
-
Hyla.logger.info "Snippet content has been selected. Index file will be modified and modifications will be reverted after asciidoctor processing"
|
218
|
-
add_tag_to_index_file(f)
|
219
|
-
end
|
206
|
+
# Get asciidoc file name
|
207
|
+
file_name_processed = path_to_adoc_file.basename
|
220
208
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
209
|
+
#
|
210
|
+
# Create destination dir relative to the path calculated
|
211
|
+
#
|
212
|
+
html_dir = @destination + '/' + File.dirname(relative_path)
|
213
|
+
Hyla.logger.info ">> Dir of html: #{html_dir}"
|
214
|
+
FileUtils.mkdir_p html_dir
|
215
|
+
|
216
|
+
# Copy Fonts
|
217
|
+
# TODO : Verify if we still need to do that as the FONTS liberation have been moved
|
218
|
+
# TODO : under local lib directory of revealjs
|
219
|
+
# self.cp_resources_to_dir(File.dirname(html_dir), 'fonts')
|
220
|
+
|
221
|
+
# Copy Resources for Slideshow
|
222
|
+
case options[:backend]
|
223
|
+
when 'deckjs'
|
224
|
+
# Copy css, js files to destination directory
|
225
|
+
self.cp_resources_to_dir(File.dirname(html_dir), 'deck.js')
|
226
|
+
when 'revealjs'
|
227
|
+
self.cp_resources_to_dir(File.dirname(html_dir), 'revealjs')
|
228
|
+
end
|
225
229
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
options[:to_dir] = html_dir
|
231
|
-
options[:to_file] = html_file_name
|
232
|
-
options[:attributes] = @attributes_bk
|
233
|
-
Asciidoctor.render_file(f, options)
|
230
|
+
#
|
231
|
+
# Render asciidoc to HTML
|
232
|
+
#
|
233
|
+
Hyla.logger.info ">> File to be rendered : #{file_name_processed}"
|
234
234
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
235
|
+
#
|
236
|
+
# Convert asciidoc file name to html file name
|
237
|
+
#
|
238
|
+
html_file_name = file_name_processed.to_s.gsub(/.adoc$|.ad$|.asciidoc$|.index$|.txt$/, '.html')
|
239
|
+
options[:to_dir] = html_dir
|
240
|
+
options[:to_file] = html_file_name
|
241
|
+
options[:attributes] = @attributes_bk
|
242
|
+
Asciidoctor.render_file(f, options)
|
243
243
|
|
244
|
+
# end
|
245
|
+
end
|
246
|
+
|
247
|
+
#
|
248
|
+
# Check if companion parameter is defined
|
249
|
+
# and remove the companion tag from indexed files
|
250
|
+
#
|
251
|
+
if options[:snippet_content] == true
|
252
|
+
files.each do |f|
|
253
|
+
remove_tag_from_index_file(f)
|
244
254
|
end
|
245
255
|
end
|
246
256
|
|
@@ -252,6 +262,7 @@ module Hyla
|
|
252
262
|
|
253
263
|
end
|
254
264
|
|
265
|
+
|
255
266
|
#
|
256
267
|
# CSS Style to be used
|
257
268
|
# Default is : asciidoctor.css
|
@@ -485,7 +496,7 @@ module Hyla
|
|
485
496
|
file_to_processed = [File.expand_path(Dir.getwd), file_name] * '/'
|
486
497
|
result = self.extract_file_names(file_to_processed, source)
|
487
498
|
|
488
|
-
result.each do |
|
499
|
+
result.each do |file_path|
|
489
500
|
if file_path.downcase.include?('title') || file_path.downcase.include?('cover')
|
490
501
|
@cover_path = file_path
|
491
502
|
next
|
@@ -562,21 +573,41 @@ module Hyla
|
|
562
573
|
end
|
563
574
|
|
564
575
|
#
|
565
|
-
# Add snippet tag index file
|
576
|
+
# Add snippet tag to index file with extension .ad[]
|
577
|
+
# as this is not yet the case
|
566
578
|
#
|
567
579
|
def self.add_tag_to_index_file(index_file)
|
568
|
-
|
569
|
-
|
570
|
-
|
580
|
+
content = File.read(index_file)
|
581
|
+
#
|
582
|
+
# Modify the content of an index file if
|
583
|
+
# it contains include::file with extension .ad, .adoc or .asciidoc
|
584
|
+
#
|
585
|
+
if content =~ /(\.ad)|(\.adoc)|(\.asciidoc)/
|
586
|
+
replace = content.gsub(/\[/, '[tag=' + Configuration::SNIPPET_TAG)
|
587
|
+
replace_content(index_file, replace)
|
588
|
+
end
|
571
589
|
end
|
572
590
|
|
573
591
|
#
|
574
592
|
# Remove snippet tag from index file
|
575
593
|
#
|
576
594
|
def self.remove_tag_from_index_file(index_file)
|
577
|
-
|
578
|
-
|
579
|
-
|
595
|
+
content = File.read(index_file)
|
596
|
+
#
|
597
|
+
# Modify the content of an index file if
|
598
|
+
# it contains include::file with extension .ad, .adoc or .asciidoc
|
599
|
+
#
|
600
|
+
if content =~ /(\.ad)|(\.adoc)|(\.asciidoc)/
|
601
|
+
replace = content.gsub('[tag=' + Configuration::SNIPPET_TAG, '[')
|
602
|
+
replace_content(index_file, replace)
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
#
|
607
|
+
# Replace content of a File
|
608
|
+
#
|
609
|
+
def self.replace_content(f, content)
|
610
|
+
File.open(f, "w") { |f| f.puts content } if !content.empty?
|
580
611
|
end
|
581
612
|
|
582
613
|
#
|
data/lib/hyla/project.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Hyla
|
2
|
-
VERSION = '1.0.
|
2
|
+
VERSION = '1.0.6'
|
3
3
|
DESCRIPTION = 'Asciidoctor Hyla - Command Line tool to create new project, watch modifications, generate content, publish or consult it live !'
|
4
4
|
SUMMARY = 'Asciidoctor Hyla - builder/generator of HTML5, slideshow. Watch modifications, generate content, publish or consult it live !'
|
5
5
|
end
|
@@ -60,6 +60,8 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
|
|
60
60
|
script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML'
|
61
61
|
script type='text/javascript'
|
62
62
|
|document.addEventListener('DOMContentLoaded', MathJax.Hub.TypeSet)
|
63
|
+
- if attr? :script
|
64
|
+
script type='text/javascript' href=normalize_web_path((attr :script), (attr :scriptsdir, ''))
|
63
65
|
- unless (docinfo_content = docinfo).empty?
|
64
66
|
=docinfo_content
|
65
67
|
body id=@id class=[(attr :doctype),((attr? 'toc-class') && (attr? :toc) && (attr? 'toc-placement', 'auto') ? "#{attr 'toc-class'} toc-#{attr 'toc-position', 'left'}" : nil)] style=("max-width: #{attr 'max-width'};" if attr? 'max-width')
|
@@ -1,6 +1,7 @@
|
|
1
1
|
- slide_vertical_alignment = (attr? :revealjs_vertical_alignment) ? (attr :revealjs_vertical_alignment) : true
|
2
2
|
- browser_history = (attr? :revealjs_history) ? (attr :revealjs_history) : true
|
3
3
|
- display_slide_number = (attr? :revealjs_display_slide_number) ? (attr :revealjs_display_slide_number) : false
|
4
|
+
- transition = (attr? :revealjs_transition) ? (attr :revealjs_transition) : 'default'
|
4
5
|
doctype 5
|
5
6
|
html lang=(attr :lang, 'en' unless attr? :nolang)
|
6
7
|
head
|
@@ -18,6 +19,8 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
|
|
18
19
|
|
19
20
|
- if attr? :revealjs_theme
|
20
21
|
link rel='stylesheet' href='revealjs/css/theme/#{attr :revealjs_theme}.css' id='theme'
|
22
|
+
- elsif attr? :revealjs_customtheme
|
23
|
+
link rel='stylesheet' href='#{attr :revealjs_customtheme}' id='theme'
|
21
24
|
- else
|
22
25
|
link rel='stylesheet' href='revealjs/css/theme/gpe.css' id='theme'
|
23
26
|
|
@@ -117,7 +120,7 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
|
|
117
120
|
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
|
118
121
|
|
119
122
|
// Transition style
|
120
|
-
transition: Reveal.getQueryHash().transition || '
|
123
|
+
transition: Reveal.getQueryHash().transition || '#{transition}', // default/cube/page/concave/zoom/linear/fade/none
|
121
124
|
|
122
125
|
// Parallax scrolling
|
123
126
|
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
- resize_text = (attr? :resize_section) ? (attr :resize_section) : false
|
2
2
|
- if resize_text == 'true'
|
3
3
|
div style="position:absolute; top:150px; left:10px; right:10px;"
|
4
|
-
section id=@id data-transition=(attr 'data-transition') data-transition-speed=(attr 'data-transition-speed') data-background=(attr 'data-background') data-background-size=(attr 'data-background-size') data-background-repeat=(attr 'data-background-repeat') data-background-transition=(attr 'data-background-transition')
|
4
|
+
section id=@id class=(attr 'data-state') data-transition=(attr 'data-transition') data-transition-speed=(attr 'data-transition-speed') data-background=(attr 'data-background') data-background-size=(attr 'data-background-size') data-background-repeat=(attr 'data-background-repeat') data-background-transition=(attr 'data-background-transition')
|
5
5
|
h2=title
|
6
6
|
- if attr? :scrollbar
|
7
7
|
.scrollbar
|
@@ -9,7 +9,7 @@
|
|
9
9
|
- else
|
10
10
|
=content.chomp
|
11
11
|
- else
|
12
|
-
section id=@id data-transition=(attr 'data-transition') data-transition-speed=(attr 'data-transition-speed') data-background=(attr 'data-background') data-background-size=(attr 'data-background-size') data-background-repeat=(attr 'data-background-repeat') data-background-transition=(attr 'data-background-transition')
|
12
|
+
section id=@id class=(attr 'data-state') data-transition=(attr 'data-transition') data-transition-speed=(attr 'data-transition-speed') data-background=(attr 'data-background') data-background-size=(attr 'data-background-size') data-background-repeat=(attr 'data-background-repeat') data-background-transition=(attr 'data-background-transition')
|
13
13
|
h2=title
|
14
14
|
- if attr? :scrollbar
|
15
15
|
.scrollbar
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Mouliard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|