showoff 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0b7ee2b970fed6e27a9500ff363c1ef95e013d5
4
- data.tar.gz: c25a95a3c11e3d87f832771e92396204080cc645
3
+ metadata.gz: 604368cbb77db12fb0528dac9cb0155bebeff3be
4
+ data.tar.gz: 4129294c1e8c011521510f0496844b087247d52b
5
5
  SHA512:
6
- metadata.gz: d052efc4428ce380f7197d3bac6895c9eb9965a5cb9d8becb632240aeeb7b88492cfc5005a751e66ba67e1443e0f9a1f00cc38bc2327c4a9e16ff86fcb818ef7
7
- data.tar.gz: 4bee8156a5c67f568f2c8b49e7c88dcf0c905bc74ccf5c16f6ec0f0f550951c76c750e1e7558e8a666bc89f6658e7263e9ef39bfd390814f4a0f20f5c9aa62a1
6
+ metadata.gz: 76e812ebaef4a6bd9279042bbfda4b02242cece988974506a9be49a097a6fd38696f40f68b0dce344c8354c0dcc4072a7ea21b1a7e247f2a399d601ce8fee4da
7
+ data.tar.gz: 850bf03967777e5d5101d6c7e8f44a5207a92086301d58f1ad95a99af6e2c6d62c95c7faf48226b1a85b302b9b117b948147fc4487a8cb97e12779003909e14b
@@ -254,11 +254,15 @@ class ShowOff < Sinatra::Application
254
254
 
255
255
  helpers do
256
256
  def css_files
257
- Dir.glob("#{settings.pres_dir}/*.css").map { |path| File.basename(path) }
257
+ base = Dir.glob("#{settings.pres_dir}/*.css").map { |path| File.basename(path) }
258
+ extra = Array(settings.showoff_config['styles'])
259
+ base + extra
258
260
  end
259
261
 
260
262
  def js_files
261
- Dir.glob("#{settings.pres_dir}/*.js").map { |path| File.basename(path) }
263
+ base = Dir.glob("#{settings.pres_dir}/*.js").map { |path| File.basename(path) }
264
+ extra = Array(settings.showoff_config['scripts'])
265
+ base + extra
262
266
  end
263
267
 
264
268
  def preshow_files
@@ -586,7 +590,7 @@ class ShowOff < Sinatra::Application
586
590
  result.gsub!(match[0], "<pre class=\"highlight\"><code class=\"#{css}\">#{file}</code></pre>")
587
591
  end
588
592
 
589
- result.gsub!(/\[(fa-.*)\]/, '<i class="fa \1"></i>')
593
+ result.gsub!(/\[(fa\w?)-(\S*)\]/, '<i class="\1 fa-\2"></i>')
590
594
 
591
595
  # For fenced code blocks, translate the space separated classes into one
592
596
  # colon separated string so Commonmarker doesn't ignore the rest
@@ -1309,9 +1313,14 @@ class ShowOff < Sinatra::Application
1309
1313
  content
1310
1314
  end
1311
1315
 
1312
- def print(section=nil)
1316
+ def print(section=nil, munged=false)
1313
1317
  @slides = get_slides_html(:static=>true, :toc=>true, :print=>true, :section=>section)
1314
1318
  @favicon = settings.showoff_config['favicon']
1319
+
1320
+ unless munged
1321
+ @baseurl = '../' * section.split('/').count
1322
+ end
1323
+
1315
1324
  erb :onepage
1316
1325
  end
1317
1326
 
@@ -1475,7 +1484,7 @@ class ShowOff < Sinatra::Application
1475
1484
  data = showoff.send(what, opt)
1476
1485
  when 'print'
1477
1486
  opt ||= 'handouts'
1478
- data = showoff.send(what, opt)
1487
+ data = showoff.send(what, opt, true)
1479
1488
  else
1480
1489
  data = showoff.send(what, true)
1481
1490
  end
@@ -1509,8 +1518,10 @@ class ShowOff < Sinatra::Application
1509
1518
  pres_dir = showoff.settings.pres_dir
1510
1519
 
1511
1520
  # ..., copy all user-defined styles and javascript files
1512
- Dir.glob("#{pres_dir}/*.{css,js}").each { |path|
1513
- FileUtils.copy(path, File.join(file_dir, File.basename(path)))
1521
+ showoff.css_files.each { |path|
1522
+ dest = File.join(file_dir, path)
1523
+ FileUtils.mkdir_p(File.dirname(dest))
1524
+ FileUtils.copy(path, dest)
1514
1525
  }
1515
1526
 
1516
1527
  # ... and copy all needed image files
@@ -1526,12 +1537,16 @@ class ShowOff < Sinatra::Application
1526
1537
  end
1527
1538
  end
1528
1539
  # copy images from css too
1529
- Dir.glob("#{pres_dir}/*.css").each do |css_path|
1540
+ showoff.css_files.each do |css_path|
1530
1541
  File.open(css_path) do |file|
1531
1542
  data = file.read
1532
1543
  data.scan(/url\([\"\']?(?!https?:\/\/)(.*?)[\"\']?\)/).flatten.each do |path|
1533
1544
  path.gsub!(/(\#.*)$/, '') # get rid of the anchor
1534
1545
  path.gsub!(/(\?.*)$/, '') # get rid of the query
1546
+
1547
+ # resolve relative paths in the stylesheet
1548
+ path = "#{File.dirname(css_path)}/#{path}" unless path.start_with? '/'
1549
+
1535
1550
  logger.debug path
1536
1551
  dir = File.dirname(path)
1537
1552
  FileUtils.makedirs(File.join(file_dir, dir))
@@ -1,3 +1,3 @@
1
1
  # No namespace here since ShowOff is a class and I'd have to inherit from
2
2
  # Sinatra::Application (which we don't want to load here)
3
- SHOWOFF_VERSION = '0.20.0'
3
+ SHOWOFF_VERSION = '0.20.1'
@@ -192,6 +192,7 @@
192
192
  }
193
193
  #timerSection #pauseTimer {
194
194
  float: left;
195
+ position: absolute;
195
196
  display: none;
196
197
  }
197
198
  #timerSection #stopTimer {
@@ -512,7 +512,7 @@ img#disconnected {
512
512
  background-color: #dedede;
513
513
  }
514
514
  #askedQuestions li:hover:after {
515
- font-family: FontAwesome;
515
+ font-family: "Font Awesome 5 Free";
516
516
  font-style: normal;
517
517
  font-weight: normal;
518
518
  text-decoration: inherit;
@@ -652,7 +652,7 @@ pre.highlight tr:not(:last-child) {
652
652
  }
653
653
 
654
654
  .execute:after {
655
- font-family: FontAwesome;
655
+ font-family: "Font Awesome 5 Free";
656
656
  content: "\F144";
657
657
  position: absolute;
658
658
  right: .5em;
@@ -815,7 +815,7 @@ form .element {
815
815
  .slide.answerkey input::before {
816
816
  margin-left: -1em;
817
817
  vertical-align: top;
818
- font-family: FontAwesome;
818
+ font-family: "Font Awesome 5 Free";
819
819
  font-weight: bold;
820
820
  text-decoration: none;
821
821
  }
@@ -1065,7 +1065,7 @@ form .element {
1065
1065
 
1066
1066
  /* Add the disclosure triangles */
1067
1067
  #stats div.row:before {
1068
- font-family: FontAwesome;
1068
+ font-family: "Font Awesome 5 Free";
1069
1069
  font-style: normal;
1070
1070
  font-weight: normal;
1071
1071
  font-size: 1.25em;
@@ -1230,7 +1230,7 @@ form .element {
1230
1230
  .callout.exercise:before { content: "\f41b"; } /* fa-pencil-square */
1231
1231
  .callout.stop:before { content: "\f05e"; } /* fa-ban */
1232
1232
  .callout.thumbsup:before { content: "\f164"; } /* fa-thumbs-up */
1233
- .callout.conversation:before { content: "\f0e5"; } /* fa-comment */
1233
+ .callout.conversation:before { content: "\f075"; } /* fa-comment */
1234
1234
  .callout.glossary:before { content: "\f02d"; } /* fa-book */
1235
1235
 
1236
1236
  .callout.terminal:before { content: "\f0c8"; } /* fa-square */
@@ -1265,7 +1265,7 @@ a.term {
1265
1265
  text-decoration: none;
1266
1266
  }
1267
1267
  a.term:after {
1268
- font-family: FontAwesome;
1268
+ font-family: "Font Awesome 5 Free";;
1269
1269
  font-size: 0.8em;
1270
1270
  vertical-align: super;
1271
1271
  content: "\f27b";
@@ -36,7 +36,7 @@ $(document).ready(function(){
36
36
  $("#notes-wrapper .fa-minus").click( function() {
37
37
  notesFontSize('decrease');
38
38
  });
39
- $("#notes-wrapper .fa-dot-circle-o").click( function() {
39
+ $("#notes-wrapper .fa-circle").click( function() {
40
40
  notesFontSize('reset');
41
41
  });
42
42
  $("#notes-wrapper .fa-plus").click( function() {
@@ -509,7 +509,9 @@ function printSlides(section)
509
509
  {
510
510
  try {
511
511
  var printWindow = window.open('print/'+section);
512
- printWindow.window.print();
512
+ $(printWindow).on('load', function(){
513
+ printWindow.window.print();
514
+ });
513
515
  }
514
516
  catch(e) {
515
517
  console.log('Failed to open print window. Popup blocker?');
@@ -1847,14 +1847,14 @@ var removeResults = function() {
1847
1847
  try { slaveWindow.removeResults() } catch (e) {};
1848
1848
  };
1849
1849
 
1850
- var print = function(text) {
1850
+ var displayHUD = function(text) {
1851
1851
  removeResults();
1852
1852
  var _results = $('<div>').addClass('results').html('<pre>' + String(text).substring(0, 1500) + '</pre>');
1853
1853
  $('body').append(_results);
1854
1854
  _results.click(removeResults);
1855
1855
 
1856
1856
  // if we're a presenter, mirror this on the display window
1857
- try { slaveWindow.print(text) } catch (e) {};
1857
+ try { slaveWindow.displayHUD(text) } catch (e) {};
1858
1858
  };
1859
1859
 
1860
1860
  // Execute the first visible executable code block
@@ -1910,7 +1910,7 @@ function executeLocalCode(lang, codeDiv) {
1910
1910
  catch(e) {
1911
1911
  result = e.message;
1912
1912
  };
1913
- if (result != null) print(result);
1913
+ if (result != null) displayHUD(result);
1914
1914
  }
1915
1915
 
1916
1916
  // request the server to execute a code block by path and index
@@ -1921,7 +1921,7 @@ function executeRemoteCode(lang, codeDiv) {
1921
1921
 
1922
1922
  setExecutionSignal(true, codeDiv);
1923
1923
  $.get('execute/'+lang, {path: path, index: index}, function(result) {
1924
- if (result != null) print(result);
1924
+ if (result != null) displayHUD(result);
1925
1925
  setExecutionSignal(false, codeDiv);
1926
1926
  });
1927
1927
  }
@@ -3,6 +3,7 @@
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <% if @baseurl %><base href="<%= @baseurl %>" /> <% end %>
6
7
  <title><%= @title %></title>
7
8
 
8
9
  <% if @favicon %>
@@ -10,8 +11,7 @@
10
11
  <% end %>
11
12
 
12
13
  <% if @inline %>
13
-
14
- <%= inline_css(['font-awesome-4.4.0/css/font-awesome.min.css', 'mermaid-6.0.0.css', "highlight/#{@highlightStyle}.css"], 'public/css') %>
14
+ <%= inline_css(['font-awesome-5.6.1/css/all.min.css', 'mermaid-6.0.0.css', "highlight/#{@highlightStyle}.css"], 'public/css') %>
15
15
  <%= inline_css(['showoff.css', 'onepage.css'], 'public/css') %>
16
16
  <%= inline_css(css_files) %>
17
17
 
@@ -22,7 +22,7 @@
22
22
  <%= inline_js(js_files) %>
23
23
 
24
24
  <% else %>
25
- <% ['font-awesome-4.4.0/css/font-awesome.min.css', 'mermaid-6.0.0.css', "highlight/#{@highlightStyle}.css",
25
+ <% ['font-awesome-5.6.1/css/all.min.css', 'mermaid-6.0.0.css', "highlight/#{@highlightStyle}.css",
26
26
  'showoff.css', 'onepage.css'].each do |css_file| %>
27
27
  <link rel="stylesheet" href="css/<%= css_file %>" type="text/css"/>
28
28
  <% end %>
@@ -130,7 +130,7 @@
130
130
  <ul class="section-selector"></ul>
131
131
  <div class="controls" id="notes-controls">
132
132
  <a class="no-mobile fa fa-minus small" aria-hidden="true" href="#"></a>
133
- <a class="no-mobile fa fa-dot-circle-o small" aria-hidden="true" href="#"></a>
133
+ <a class="no-mobile fa fa-circle small" aria-hidden="true" href="#"></a>
134
134
  <a class="no-mobile fa fa-plus small" aria-hidden="true" href="#"></a>
135
135
  <span class="spacer"> </span>
136
136
  <a id="notesToggle" class="no-mobile fa fa-external-link-square" aria-hidden="true" href="#"></a>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-18 00:00:00.000000000 Z
12
+ date: 2019-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra