-
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.
For snippets, the group now defaults to the type of snippet (e.g. java/scala).
- Loading branch information
Showing
16 changed files
with
209 additions
and
59 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
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
8 changes: 4 additions & 4 deletions
8
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
8 changes: 4 additions & 4 deletions
8
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
81 changes: 81 additions & 0 deletions
81
core/src/test/scala/com/lightbend/paradox/markdown/SnipDirectiveSpec.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,81 @@ | ||
/* | ||
* 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 SnipDirectiveSpec extends MarkdownBaseSpec { | ||
|
||
val testProperties = Map("version" -> "1.2.3") | ||
|
||
implicit val context: Location[Page] => Writer.Context = { loc => | ||
writerContext(loc).copy(properties = testProperties) | ||
} | ||
|
||
"The `snip` directive" should "render code snippets" in { | ||
markdown("""@@snip[example.scala](core/src/test/scala/com/lightbend/paradox/markdown/example.scala) {#example }""") shouldEqual html(""" | ||
|<pre class="prettyprint group-scala"> | ||
|<code class="language-scala"> | ||
|object example extends App { | ||
| println("Hello, World!") | ||
|}</code> | ||
|</pre>""") | ||
} | ||
|
||
it should "render code snippets in definition lists" in { | ||
markdown(""" | ||
|Scala | ||
|: @@snip[example.scala](core/src/test/scala/com/lightbend/paradox/markdown/example.scala) { #example } | ||
| | ||
|Java | ||
|: @@snip[example2.java](core/src/test/scala/com/lightbend/paradox/markdown/example2.java) { #example2 } | ||
|""") shouldEqual html(""" | ||
|<dl> | ||
|<dt>Scala</dt> | ||
|<dd> | ||
|<pre class="prettyprint group-scala"> | ||
|<code class="language-scala"> | ||
|object example extends App { | ||
| println("Hello, World!") | ||
|}</code> | ||
|</pre> | ||
|</dd> | ||
|<dt>Java</dt> | ||
|<dd> | ||
|<pre class="prettyprint group-java"> | ||
|<code class="language-java"> | ||
|public class example2 { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello, World"); | ||
| } | ||
|}</code> | ||
|</pre> | ||
|</dd> | ||
|</dl>""") | ||
} | ||
|
||
it should "support a custom id and custom CSS classes at the same time" in { | ||
markdown(""" | ||
|@@@ div { #yeah .red .blue } | ||
|Simple sentence here. | ||
|@@@""") shouldEqual html(""" | ||
|<div id="yeah" class="red blue"> | ||
|<p>Simple sentence here.</p> | ||
|</div>""") | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
core/src/test/scala/com/lightbend/paradox/markdown/example.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,23 @@ | ||
/* | ||
* 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 | ||
|
||
//#example | ||
object example extends App { | ||
println("Hello, World!") | ||
} | ||
//#example |
25 changes: 25 additions & 0 deletions
25
core/src/test/scala/com/lightbend/paradox/markdown/example2.java
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,25 @@ | ||
/* | ||
* 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; | ||
|
||
//#example2 | ||
public class example2 { | ||
public static void main(String[] args) { | ||
System.out.println("Hello, World"); | ||
} | ||
} | ||
//#example2 |
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
8 changes: 4 additions & 4 deletions
8
plugin/src/sbt-test/paradox/snippets/expected/configured-bases.html
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<pre class="prettyprint"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint group-scala"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint group-scala"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint group-scala"><code class="language-scala">val foo = 42</code></pre> | ||
<pre class="prettyprint group-scala"><code class="language-scala">val foo = 42</code></pre> |
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
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<pre class="prettyprint"><code class="language-conf"># This should be included | ||
<pre class="prettyprint group-conf"><code class="language-conf"># This should be included | ||
#and this as well | ||
|
||
snippets { | ||
# this snip is a snap | ||
snip = "snap" | ||
}</code></pre> | ||
<pre class="prettyprint"><code class="language-conf"># this snip is a snap | ||
<pre class="prettyprint group-conf"><code class="language-conf"># this snip is a snap | ||
snip = "snap"</code></pre> |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<pre class="prettyprint"><code class="language-scala">def indented = { | ||
<pre class="prettyprint group-scala"><code class="language-scala">def indented = { | ||
1 + 2 | ||
}</code></pre> | ||
<pre class="prettyprint"><code class="language-conf">snippets { | ||
<pre class="prettyprint group-conf"><code class="language-conf">snippets { | ||
test = 1 | ||
}</code></pre> | ||
<pre class="prettyprint"><code class="language-scala">val symbols = Seq('symbols, Symbol("@"), 'EOL)</code></pre> | ||
<pre class="prettyprint"><code class="language-scala">val spacy = "Please do not remove ending spaces after these markers"</code></pre> | ||
<pre class="prettyprint group-scala"><code class="language-scala">val symbols = Seq('symbols, Symbol("@"), 'EOL)</code></pre> | ||
<pre class="prettyprint group-scala"><code class="language-scala">val spacy = "Please do not remove ending spaces after these markers"</code></pre> |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<pre class="prettyprint"><code class="language-xml"><bar> | ||
<pre class="prettyprint group-xml"><code class="language-xml"><bar> | ||
XML FTW | ||
</bar></code></pre> |
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