Skip to content
This repository was archived by the owner on Sep 23, 2021. It is now read-only.

Commit 045c5ef

Browse files
authored
Merge pull request #9 from msoedov/pdf-link
Updated reveal.js and link PDF preview
2 parents 045296d + d6d181f commit 045c5ef

File tree

115 files changed

+21810
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+21810
-57
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.git/
22
.idea/
33
*.swp
4-
4+
*.go

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM alpine:3.5
22

33
WORKDIR /app
44

5-
ADD . /app
5+
COPY . /app
66
EXPOSE 8080
77
ENV GIN_MODE=release
8-
CMD ["./main"]
8+
CMD ./main

main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ func NewApp() *gin.Engine {
163163

164164
func main() {
165165
r := NewApp()
166+
port := "8080"
167+
if len(os.Args) > 1 {
168+
port = os.Args[1]
169+
} else {
170+
envPort := os.Getenv("PORT")
171+
if len(envPort) > 0 {
172+
port = envPort
173+
}
174+
}
166175
log.Info("Started http://0.0.0.0:8080")
167-
r.Run(":8080")
176+
r.Run(fmt.Sprintf(":%s", port))
168177
}

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"reveal.js": "^3.4.1"
4+
}
5+
}

static/js/slides.js

Lines changed: 90 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,113 @@
11
function isPreview() {
2-
return !!window.location.search.match(/preview/gi);
2+
return !!window.location.search.match(/preview/gi);
33
}
44

55
function initializeReveal() {
6-
// Full list of configuration options available at:
7-
// https://github.com/hakimel/reveal.js#configuration
8-
Reveal.initialize({
9-
controls: true,
10-
progress: true,
11-
history: true,
12-
center: true,
13-
transition: 'slide', // none/fade/slide/convex/concave/zoom
14-
transitionSpeed: isPreview() ? 'fast' : 'default',
15-
embedded: isPreview() ? true : false,
16-
17-
// Optional reveal.js plugins
18-
dependencies: [
19-
{ src: '/static/revealjs/lib/js/classList.js', condition: function() { return !document.body.classList; } },
20-
{ src: '/static/revealjs/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
21-
{ src: '/static/revealjs/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); }, callback: function() { externalLinksInNewWindow(); } },
22-
{ src: '/static/revealjs/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
23-
{ src: '/static/revealjs/plugin/zoom-js/zoom.js', async: true },
24-
{ src: '/static/revealjs/plugin/notes/notes.js', async: true }
25-
]
26-
});
6+
// Full list of configuration options available at:
7+
// https://github.com/hakimel/reveal.js#configuration
8+
Reveal.initialize({
9+
controls: true,
10+
progress: true,
11+
history: true,
12+
center: true,
13+
transition: 'slide', // none/fade/slide/convex/concave/zoom
14+
transitionSpeed: isPreview() ? 'fast' : 'default',
15+
embedded: isPreview() ? true : false,
16+
17+
// Optional reveal.js plugins
18+
dependencies: [{
19+
src: '/static/reveal.js/lib/js/classList.js',
20+
condition: function() {
21+
return !document.body.classList;
22+
}
23+
},
24+
25+
// Interpret Markdown in <section> elements
26+
{
27+
src: '/static/reveal.js/plugin/markdown/marked.js',
28+
condition: function() {
29+
return !!document.querySelector('[data-markdown]');
30+
}
31+
}, {
32+
src: '/static/reveal.js/plugin/markdown/markdown.js',
33+
condition: function() {
34+
return !!document.querySelector('[data-markdown]');
35+
}
36+
},
37+
38+
// Syntax highlight for <code> elements
39+
{
40+
src: '/static/reveal.js/plugin/highlight/highlight.js',
41+
async: true,
42+
callback: function() {
43+
hljs.initHighlightingOnLoad();
44+
}
45+
},
46+
47+
// Zoom in and out with Alt+click
48+
{
49+
src: '/static/reveal.js/plugin/zoom-js/zoom.js',
50+
async: true
51+
},
52+
53+
// Speaker notes
54+
{
55+
src: '/static/reveal.js/plugin/notes/notes.js',
56+
async: true
57+
},
58+
59+
// MathJax
60+
{
61+
src: '/static/reveal.js/plugin/math/math.js',
62+
async: true
63+
}
64+
65+
{
66+
src: '/static/reveal.js/static/revealjs/lib/js/classList.js',
67+
condition: function() {
68+
return !document.body.classList;
69+
}
70+
}
71+
d
72+
]
73+
});
2774
}
2875

2976
function highlightAnyCodeBlocks() {
30-
$(document).ready(function() {
31-
$('pre code').each(function(i, block) {
32-
hljs.highlightBlock(block);
77+
$(document).ready(function() {
78+
$('pre code').each(function(i, block) {
79+
hljs.highlightBlock(block);
80+
});
3381
});
34-
});
3582
}
3683

3784
function insertMarkdownReference() {
38-
var markdownReference = $('<section/>', {
39-
'data-markdown': "/slides.md",
40-
'data-separator': "^-( *)-( *)-( *-*)*",
41-
'data-separator-notes': "^Note:",
42-
'data-charset': "utf-8"
43-
});
44-
45-
$('.slides').html(markdownReference);
85+
var markdownReference = $('<section/>', {
86+
'data-markdown': "/slides.md",
87+
'data-separator': "^-( *)-( *)-( *-*)*",
88+
'data-separator-notes': "^Note:",
89+
'data-charset': "utf-8"
90+
});
91+
92+
$('.slides').html(markdownReference);
4693
}
4794

4895
function scrollToCurrentSlide() {
49-
var i = Reveal.getIndices();
50-
Reveal.slide(i.h, i.v, i.f);
96+
var i = Reveal.getIndices();
97+
Reveal.slide(i.h, i.v, i.f);
5198
}
5299

53100
function reloadMarkdown() {
54-
insertMarkdownReference();
55-
RevealMarkdown.initialize();
56-
highlightAnyCodeBlocks();
57-
scrollToCurrentSlide();
101+
insertMarkdownReference();
102+
RevealMarkdown.initialize();
103+
highlightAnyCodeBlocks();
104+
scrollToCurrentSlide();
58105
}
59106

60107
function externalLinksInNewWindow() {
61-
$(document.links).filter(function() {
62-
return this.hostname != window.location.hostname;
63-
}).attr('target', '_blank');
108+
$(document.links).filter(function() {
109+
return this.hostname != window.location.hostname;
110+
}).attr('target', '_blank');
64111
}
65112

66113
insertMarkdownReference();

static/reveal.js/.npmignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.idea/
2+
*.iml
3+
*.iws
4+
*.eml
5+
out/
6+
.DS_Store
7+
.svn
8+
log/*.log
9+
tmp/**
10+
node_modules/
11+
.sass-cache
12+
css/reveal.min.css
13+
js/reveal.min.js

static/reveal.js/.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- 4.1.1
4+
before_script:
5+
- npm install -g grunt-cli

static/reveal.js/CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Contributing
2+
3+
Please keep the [issue tracker](http://github.com/hakimel/reveal.js/issues) limited to **bug reports**, **feature requests** and **pull requests**.
4+
5+
6+
### Personal Support
7+
If you have personal support or setup questions the best place to ask those are [StackOverflow](http://stackoverflow.com/questions/tagged/reveal.js).
8+
9+
10+
### Bug Reports
11+
When reporting a bug make sure to include information about which browser and operating system you are on as well as the necessary steps to reproduce the issue. If possible please include a link to a sample presentation where the bug can be tested.
12+
13+
14+
### Pull Requests
15+
- Should follow the coding style of the file you work in, most importantly:
16+
- Tabs to indent
17+
- Single-quoted strings
18+
- Should be made towards the **dev branch**
19+
- Should be submitted from a feature/topic branch (not your master)
20+
21+
22+
### Plugins
23+
Please do not submit plugins as pull requests. They should be maintained in their own separate repository. More information here: https://github.com/hakimel/reveal.js/wiki/Plugin-Guidelines

0 commit comments

Comments
 (0)