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

Register this converter for "reveal.js" #253

Closed
ggrossetie opened this issue Apr 1, 2019 · 13 comments
Closed

Register this converter for "reveal.js" #253

ggrossetie opened this issue Apr 1, 2019 · 13 comments

Comments

@ggrossetie
Copy link
Member

Since the project name is "reveal.js" I think this converter should be registered for "revealjs" (for backward compatibility) and "reveal.js".

ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Apr 1, 2019
@mojavelinux
Copy link
Member

To provide context, is the current backend name for the converter "revealjs"?

@ggrossetie
Copy link
Member Author

To provide context, is the current backend name for the converter "revealjs"?

Yes 😉

@mojavelinux
Copy link
Member

Then I agree.

@ggrossetie
Copy link
Member Author

@mojavelinux What about the attribute backend-revealjs? Should we replace invalid characters when the processor adds this attribute? backend-reveal.js is invalid right?

https://github.com/asciidoctor/asciidoctor/blob/2acdcece395a8327373b5f7ebf01c71dcd80ec24/lib/asciidoctor/document.rb#L1321

So it should produce backend-reveal-js? Another idea is to use ifeval::["{backend}" == "reveal.js"] but it's verbose.

With the benefit of hindsight, I don't think it's worth it. It will most likely add confusion and it has no real benefit for the end-user.

@obilodeau obilodeau added this to the 3.0.0 milestone Dec 23, 2019
@obilodeau
Copy link
Member

It's unclear to me what should happen here. Is the 3.0.0 release an opportunity to improve things or not?

@mojavelinux
Copy link
Member

What about the attribute backend-revealjs?

That's a really good point. That's a strong case for leaving "revealjs" as the official backend name.

Though the following would still work:

ifdef::backend-reveal.js[]

In the end, this comes down to a usability issue. Do you think people will try to use -b reveal.js and be confused when it doesn't work?

You can register under multiple names:

register_for 'revealjs', 'reveal.js'

As of now, though, the converter can't normalize the backend so that you get consistent value out of it. It might be nice if you could do:

def initialize backend, opts
  backend = 'revealjs' if backend == 'reveal.js'
  super
end

But that doesn't work.

So maybe it's best to just stick with a consistent name. If revealjs is fine for users, then I suppose it's not worth the cost to change it.

@mojavelinux
Copy link
Member

So the real question is, should the converter work with a parallel backend alias named reveal.js? The user would have to know to consistently use this name when checking the value of the backend.

@obilodeau
Copy link
Member

Doing the register_for trick is fairly easy and, to me, seems without foreseeable adverse effects. What I'm worried about here is breaking backward compatibility.

The backend test is clearly documented in the README as being revealjs. As long as this one work still works I'm not that worried.

I'm going to do some tests. Expect a PR.

@obilodeau
Copy link
Member

So, with this patch, tests fails:

diff --git a/Rakefile b/Rakefile
index 414f5aa..4560ed1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -71,7 +71,7 @@ def build_converter(mode = :pretty)
     Asciidoctor::TemplatesCompiler::RevealjsSlim.compile_converter(
       templates_dir: TEMPLATES_DIR,
       class_name: 'Asciidoctor::Revealjs::Converter',
-      register_for: ['revealjs'],
+      register_for: ['revealjs', 'reveal.js'],
       backend_info: {
         basebackend: 'html',
         outfilesuffix: '.html',
diff --git a/examples/multi-destination-content.adoc b/examples/multi-destination-content.adoc
index 1530ed6..b01b945 100644
--- a/examples/multi-destination-content.adoc
+++ b/examples/multi-destination-content.adoc
@@ -49,7 +49,7 @@ Some overview
 +-------------------------------------------------+
 ----
 
-ifdef::backend-revealjs[=== !]
+ifdef::backend-reveal.js[=== !]
 
 Detailed view
 

Meaning that registering the backend is not enough for it to change the ifdef backend syntax. So, we are silently going to accept the dotted name for the back-end to reduce surprises if someone use this but we are not going to document it or say it is the preferred form. Existing advanced users keep functionality and we reduce surprises for new users. New users who want advanced ifdef on this backend can search for the documentation if things don't work out of the box.

@mojavelinux
Copy link
Member

I think that's a very fair description of what it should be. Users get an early win by accidentally using -b reveal.js instead of -b revealjs. But they will have to learn to use -b revealjs for it to work consistently with what the test suite is verifying.

@ggrossetie
Copy link
Member Author

ggrossetie commented Dec 24, 2019

Yes I think that's a great compromise.

On a side note, why does an attribute name cannot contain dots? Is there an usage where it would be confusing for the parser? Spaces should definitely not be allowed.

@mojavelinux
Copy link
Member

On a side note, why does an attribute name cannot contain dots?

Historical reasons.

We also kept it reserved just in case we want to do something like: asciidoctor/asciidoctor#528

@obilodeau
Copy link
Member

This is resolved now that #297 is merged.

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

No branches or pull requests

3 participants