-
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 #115 from pvlugter/directives
Allow custom directives to be added to sbt setting
- Loading branch information
Showing
10 changed files
with
56 additions
and
23 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
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,9 @@ | ||
lazy val docs = project | ||
.in(file(".")) | ||
.enablePlugins(ParadoxPlugin) | ||
.settings( | ||
name := "Paradox Directives Test", | ||
paradoxTheme := None, | ||
paradoxDirectives += CustomDirective, | ||
paradoxProperties += "custom.content" -> "directive" | ||
) |
1 change: 1 addition & 0 deletions
1
plugin/src/sbt-test/paradox/custom-directive/expected/test.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
directive |
13 changes: 13 additions & 0 deletions
13
plugin/src/sbt-test/paradox/custom-directive/project/CustomDirective.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,13 @@ | ||
import com.lightbend.paradox.markdown.{ Directive, LeafBlockDirective, Writer } | ||
import org.pegdown.Printer | ||
import org.pegdown.ast.{ DirectiveNode, Visitor } | ||
|
||
object CustomDirective extends (Writer.Context => CustomDirective) { | ||
def apply(context: Writer.Context): CustomDirective = CustomDirective(context.properties) | ||
} | ||
|
||
case class CustomDirective(properties: Map[String, String]) extends LeafBlockDirective("custom") { | ||
def render(node: DirectiveNode, visitor: Visitor, printer: Printer): Unit = { | ||
printer.println.print(properties.getOrElse("custom.content", "")) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
plugin/src/sbt-test/paradox/custom-directive/project/plugins.sbt
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 @@ | ||
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % sys.props("project.version")) |
1 change: 1 addition & 0 deletions
1
plugin/src/sbt-test/paradox/custom-directive/src/main/paradox/_template/page.st
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 @@ | ||
$page.content$ |
1 change: 1 addition & 0 deletions
1
plugin/src/sbt-test/paradox/custom-directive/src/main/paradox/test.md
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 @@ | ||
@@custom |
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,3 @@ | ||
> paradox | ||
|
||
$ must-mirror target/paradox/site/main/test.html expected/test.html |