Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update revealjs #28

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,24 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
-
name: Set up Go
uses: actions/setup-go@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
-
name: Lint
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
-
name: Test
skip-go-installation: true
- name: Test
run: |
go test ./...
-
name: Check goreleaser configuration
- name: Check goreleaser configuration
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "assets/socketio"]
path = assets/socketio
url = https://github.com/socketio/socket.io-client.git
[submodule "assets/multiplex"]
path = assets/multiplex
url = https://github.com/reveal/multiplex
1 change: 1 addition & 0 deletions assets/multiplex
Submodule multiplex added at e2f74f
2 changes: 1 addition & 1 deletion assets/revealjs
Submodule revealjs updated 186 files
39 changes: 12 additions & 27 deletions assets/templates/slide.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,18 @@
<meta charset="utf-8" />
<base href="/" />
<!-- Force all the relative paths to lookup from / -->
<link rel="stylesheet" href="revealjs/css/reveal.css" />
<link rel="stylesheet" href="revealjs/dist/reveal.css" />
<link
rel="stylesheet"
{{if
.OriginalTheme}}
href="{{.Theme}}"
{{else}}
href="revealjs/css/theme/{{.Theme}}"
href="revealjs/dist/theme/{{.Theme}}"
{{end}}
id="theme"
/>
<link rel="stylesheet" href="revealjs/lib/css/zenburn.css" />
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write(
'<link rel="stylesheet" href="revealjs/css/print/' +
(window.location.search.match(/print-pdf/gi) ? "pdf" : "paper") +
'.css" type="text/css" media="print">'
)
</script>
<!--[if lt IE 9]>
<script src="revealjs/lib/js/html5shiv.js"></script>
<![endif]-->
<link rel="stylesheet" href="revealjs/plugin/highlight/zenburn.css" />
</head>
<body>
<div class="reveal">
Expand All @@ -46,37 +35,33 @@
</section>
</div>
</div>
<script src="revealjs/js/reveal.js"></script>
<script src="revealjs/dist/reveal.js"></script>
<script src="revealjs/plugin/markdown/markdown.js"></script>
<script src="revealjs/plugin/highlight/highlight.js"></script>
<script src="revealjs/plugin/notes/notes.js"></script>
<script>
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || '{{.Transition}}', // default/cube/page/concave/zoom/linear/fade/none
transition: '{{.Transition}}',
plugins: [RevealMarkdown, RevealHighlight, RevealNotes],

{{if (ne .Multiplex.Secret "") -}}
multiplex: {
secret: {{if .Multiplex.IsMaster}}'{{.Multiplex.Secret}}'{{else}}null{{end}},
id: '{{.Multiplex.Identifier}}',
url: '/'
},
{{end -}}

// Optional libraries used to extend on reveal.js
dependencies: [
{{if (ne .Multiplex.Secret "") -}}
{ src: 'socketio/socket.io.js', async: true },
{ src: '{{if .Multiplex.IsMaster}}revealjs/plugin/multiplex/master.js{{else}}revealjs/plugin/multiplex/client.js{{end}}', async: true },
{ src: '{{if .Multiplex.IsMaster}}multiplex/master.js{{else}}multiplex/client.js{{end}}', async: true },
{{end -}}
{ src: 'revealjs/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'revealjs/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'revealjs/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'revealjs/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'revealjs/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'revealjs/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
})
</script>
</body>
</html>
4 changes: 4 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ var revealjs embed.FS
//go:embed assets/socketio
var socketiojs embed.FS

//go:embed assets/multiplex
var multiplex embed.FS

//go:embed assets/templates/slide.html
var slideTemplate string

Expand Down Expand Up @@ -73,6 +76,7 @@ func (server *Server) Serve(param ServerParam) {
param.Multiplex.IsMaster = true
http.Handle("/master/", http.StripPrefix("/master", contentHandler(param, http.FileServer(http.Dir(".")))))
http.Handle("/socketio/", assetsHandler("/assets/", http.FileServer(http.FS(socketiojs))))
http.Handle("/multiplex/", assetsHandler("/assets/", http.FileServer(http.FS(multiplex))))
http.Handle("/socket.io/", socketioServer)
fmt.Printf("master slides can be found at http://*:%d/master/\n", port)
}
Expand Down
2 changes: 1 addition & 1 deletion server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestContentHandler(t *testing.T) {
matches := []struct {
regexp string
}{
{regexp: "revealjs/css/theme/beige.css"},
{regexp: "revealjs/dist/theme/beige.css"},
{regexp: `data-markdown="testdata/example.md"`},
{regexp: `|| 'zoom',`},
{regexp: `data-separator="\^==="`},
Expand Down