-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from raboof/switch-groups
Switching tabs as well as other fragments
- Loading branch information
Showing
28 changed files
with
697 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright © 2015 - 2017 Lightbend, Inc. <http://www.lightbend.com> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.pegdown.ast; | ||
|
||
public class VerbatimGroupNode extends VerbatimNode { | ||
private final String group; | ||
|
||
public VerbatimGroupNode(String text) { | ||
this(text, "", ""); | ||
} | ||
|
||
public VerbatimGroupNode(String text, String type) { | ||
this(text, type, ""); | ||
} | ||
|
||
public VerbatimGroupNode(String text, String type, String group) { | ||
super(text, type); | ||
this.group = group; | ||
} | ||
|
||
@Override | ||
public void accept(Visitor visitor) { | ||
visitor.visit(this); | ||
} | ||
|
||
public String getGroup() { | ||
return group; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
core/src/main/scala/com/lightbend/paradox/markdown/Groups.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright © 2015 - 2017 Lightbend, Inc. <http://www.lightbend.com> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.lightbend.paradox.markdown | ||
|
||
object Groups { | ||
def html(supergroups: Map[String, Seq[String]]) = { | ||
supergroups.map { | ||
case (supergroup, groups) => | ||
s"""<select class="supergroup" name="$supergroup">""" + | ||
groups.map(group => s"""<option class="group" value="group-${group.toLowerCase}">$group</option>""").mkString + | ||
"</select>" | ||
}.mkString("\n") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
core/src/test/scala/com/lightbend/paradox/markdown/InlineGroupDirectiveSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright © 2015 - 2017 Lightbend, Inc. <http://www.lightbend.com> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.lightbend.paradox.markdown | ||
|
||
import com.lightbend.paradox.tree.Tree.Location | ||
|
||
class InlineGroupDirectiveSpec extends MarkdownBaseSpec { | ||
|
||
"The inline `group` directive" should "render wrapping groups" in { | ||
markdown("@scala[Simple sentence here]") shouldEqual html("""<p><span class="group-scala">Simple sentence here</span></p>""") | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
core/src/test/scala/com/lightbend/paradox/markdown/InlineWrapDirectiveSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright © 2015 - 2017 Lightbend, Inc. <http://www.lightbend.com> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.lightbend.paradox.markdown | ||
|
||
import com.lightbend.paradox.tree.Tree.Location | ||
|
||
class InlineWrapDirectiveSpec extends MarkdownBaseSpec { | ||
|
||
"The inline `wrap` directive" should "render wrapping `span`s" in { | ||
markdown("@span[Simple sentence here]") shouldEqual html("<p><span>Simple sentence here</span></p>") | ||
} | ||
|
||
it should "render the example from the docs" in { | ||
markdown("@span[Scala variant containing ***markdown*** and @ref:[Linking](test.md)] { .group-scala }") shouldEqual html(""" | ||
|<p><span class="group-scala">Scala variant containing <strong><em>markdown</em></strong> and <a href="test.html">Linking</a></span></p>""") | ||
} | ||
|
||
it should "support a custom id and custom CSS classes at the same time" in { | ||
markdown("@span[Simple sentence here.] { #yeah .red .blue }") shouldEqual html("""<p><span id="yeah" class="red blue">Simple sentence here.</div></p>""") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.