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

Tab-group switching for snippets #95

Closed
wants to merge 4 commits into from

Conversation

gsechaud
Copy link
Contributor

@gsechaud gsechaud commented Feb 1, 2017

Resolve #11
Resolve #63

Note: update paradox version for paradox in the next release to include the working example in documentation.

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, did not check in action though :-)
Thanks a ton!

@dwijnand dwijnand added this to the 0.3.0 milestone Feb 6, 2017
@dwijnand dwijnand self-assigned this Feb 8, 2017
@@ -311,7 +311,8 @@ case class SnipDirective(page: Page, variables: Map[String, String])
} else new File(page.file.getParentFile, source)
val text = Snippet(file, labels)
val lang = Option(node.attributes.value("type")).getOrElse(Snippet.language(file))
new VerbatimNode(text, lang).accept(visitor)
val group = Option(node.attributes.value("group")).getOrElse("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should use the tab name for a group if the group is not explicitly defined. This would allow easier feature use for the documentation writers making docs less verbose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tab name doesn't seem too easy to reach at this point, but defaulting to the lang seems reasonable, too - applied to #107

: @@snip [example-second.java](../../resources/tab-switching/examples.java) { #java_second group=java }

Second-scala
: @@snip [example-second.scala](../../resources/tab-switching/examples.scala) { #scala_second group=scala }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIC there is not way to provide grouping for tabs which contain inline text (not a snippet).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, would be good to have an approach that supports anything in the tab, rather than relying on the group attribute in snippets.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the current tab grouping allow different types of groups? For example, Java/Scala and sbt/Maven/Gradle on the same page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed tabs with inline text are still not supported, but switching arbitrary text is now available in #107.

Different types of groups on the same page should be no problem.

@2m
Copy link
Contributor

2m commented Feb 9, 2017

This looks like a great start. One more thing that would be awesome, if we could add support for @javadoc[Actor](akka.actor.Actor) and @scaladoc[Actor](akka.actor.Actor) having implicit group names of java and scala. That would allow switching the links to the API docs. If that is too much for this PR, I can create a separate ticket.

@@ -0,0 +1,3 @@
@@ snip [Group A](../../test/scala/Multiple.scala) { #multiple-something-else group=a }

@@ snip [Group B](../../test/scala/Multiple.scala) { #parseint-imports group=b }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests if the generated HTML is correct, but will the group=b snippet be hidden by default? I have tried it on a project and it looks like that both snippets are always visible.

Also if there are no tabbed snippets in the page, then a user will have no way of switching between the two. I think we should add a hover box or other interactive control that would allow switching between the alternatives.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a selectbox for switching in #107

Actually selecting tabs/alternatives is done in javascript, so isn't easy to incorporate in a test...

@dwijnand dwijnand removed this from the 0.3.0 milestone Feb 10, 2017
@dwijnand dwijnand removed their assignment Feb 22, 2017
@raboof raboof mentioned this pull request Apr 18, 2017
raboof added a commit to raboof/paradox that referenced this pull request Apr 19, 2017
Expanding on the proposal in lightbend#95, added support for having other parts of the
documentation change as well when changing a group.
@ktoso ktoso modified the milestone: allpapers Apr 20, 2017
@2m
Copy link
Contributor

2m commented Apr 24, 2017

Superseded by #107.

@2m 2m closed this Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants