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

Reveal JS autoslide problem #367

Closed
lucki1000 opened this issue May 24, 2020 · 10 comments · Fixed by #368
Closed

Reveal JS autoslide problem #367

lucki1000 opened this issue May 24, 2020 · 10 comments · Fixed by #368

Comments

@lucki1000
Copy link

I want to use Reveal JS autoslide for a presentation, and would overwrite this function with :data-autoslide: integer like it is descript in this document but it won't change his first value.

asciidoctor-revealjs -v 
Asciidoctor reveal.js 4.0.1 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
@ggrossetie
Copy link
Member

For reference: asciidoctor/asciidoctor#3673 (comment)

To answer your question, I think this feature is not implemented despite the fact that the documentation mentions it. Maybe it was forgotten sweat_smile
I believe that the syntax would be:

[autoslide=15000]
== Slide

Thanks but unfortunately does not work either, i will create the issue there asciidoctor/asciidoctor-reveal.js

I was only suggesting what the syntax should be but since it's not implemented it won't work.
Are you familiar with Ruby? I think it would be relatively simple to implement if you want to give it a try.
Basically, what we need to do is add the following line:

data-autoslide=(attr "autoslide")

in here:

data-background-opacity=(attr "background-opacity")
data-state=(attr 'state'))

Then test add an example in the examples directory to make sure it's actually working.

@lucki1000
Copy link
Author

I'm not familiar with Ruby,
I have added this data-autoslide=(attr "autoslide") in /var/lib/gems/2.5.0/gems/asciidoctor-revealjs-4.0.1/templates/section.html.slim and tried again asciidoctor-revealjs ./document.adoc -o index.html but still no changes.

@ggrossetie
Copy link
Member

The templates are "compiled" so it won't work if you update locally the template file section.html.slim. You will need to clone this project and build it: https://github.com/asciidoctor/asciidoctor-reveal.js/blob/master/HACKING.adoc

@lucki1000
Copy link
Author

I've cloned this repo and added data-autoslide=(attr "autoslide") to the template section.html.slim then i executed:

bundle exec rake build
bundle --path=.bundle/gems --binstubs=.bundle/.bin

after this i run again asciidoctor-revealjs ./document.adoc -o index.html but nothing changed.

@ggrossetie
Copy link
Member

can you run bundle exec asciidoctor-revealjs ./document.adoc -o index.html from the repository?

@lucki1000
Copy link
Author

lucki1000 commented May 26, 2020

Changed sadly nothing.

@ggrossetie
Copy link
Member

Damn! I will give it a try 😉

@ggrossetie
Copy link
Member

ggrossetie commented May 26, 2020

I just did and it's working:

$ rvm use 2.6.3@asciidoctor-reveal.js --create
$ bundle install

Edit the file:

$ grep -n5 autoslide templates/section.html.slim
52-    data-background-iframe=(attr "background-iframe")
53-    data-background-video=data_background_video
54-    data-background-video-loop=((attr? 'background-video-loop') || (option? 'loop'))
55-    data-background-video-muted=((attr? 'background-video-muted') || (option? 'muted'))
56-    data-background-opacity=(attr "background-opacity")
57:    data-autoslide=(attr "autoslide")
58-    data-state=(attr 'state'))
59-    - unless hide_title
60-      h2=section_title
61-    - if parent_section_with_vertical_slides
62-      - unless (_blocks = blocks - vertical_slides).empty?

Create a presentation:

$ cat presentation.adoc -p
= Presentation


[autoslide=15000]
== Slide

Build and run:

$ bundle exec rake build
$ bundle exec asciidoctor-revealjs ./presentation.adoc -o presentation.html
$ grep "data-autoslide=" presentation.html
document.getElementsByTagName( 'head' )[0].appendChild( link );</script></head><body><div class="reveal"><div class="slides"><section class="title" data-state="title"><h1>Presentation</h1></section><section id="_slide" data-autoslide="15000"><h2>Slide</h2></section></div></div><script src="reveal.js/js/reveal.js"></script><script>Array.prototype.slice.call(document.querySelectorAll('.slides section')).forEach(function(slide) {

@lucki1000
Copy link
Author

I'm Sorry by me it worked too :), had a typo in the -o argument.
Thanks

@ggrossetie
Copy link
Member

No worries 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants