From 51500951364b3d34c0f9563b8525804a6234b9e7 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 31 Aug 2016 17:41:13 +0100 Subject: [PATCH 1/2] Assert current H2 behaviour with a CA test page --- .../src/sbt-test/paradox/site/expected/a.html | 5 +++ .../sbt-test/paradox/site/expected/a/a.html | 1 + .../sbt-test/paradox/site/expected/a/b.html | 1 + .../sbt-test/paradox/site/expected/a/c.html | 1 + .../sbt-test/paradox/site/expected/b/a.html | 1 + .../sbt-test/paradox/site/expected/b/a/a.html | 1 + .../sbt-test/paradox/site/expected/b/b.html | 2 ++ .../sbt-test/paradox/site/expected/c/a.html | 35 +++++++++++++++++++ .../paradox/site/src/main/paradox/a.md | 1 + .../paradox/site/src/main/paradox/c/a.md | 5 +++ plugin/src/sbt-test/paradox/site/test | 1 + 11 files changed, 54 insertions(+) create mode 100644 plugin/src/sbt-test/paradox/site/expected/c/a.html create mode 100644 plugin/src/sbt-test/paradox/site/src/main/paradox/c/a.md diff --git a/plugin/src/sbt-test/paradox/site/expected/a.html b/plugin/src/sbt-test/paradox/site/expected/a.html index cb49bf11..c239740c 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/a.html @@ -24,6 +24,7 @@
  • BAA
  • BB
  • +
  • c/a.html
  • AA

    A

    @@ -66,6 +67,10 @@

    A<
  • BB4
  • +
  • c/a.html +
  • Followed by the index of a select number of pages.

    diff --git a/plugin/src/sbt-test/paradox/site/expected/a/a.html b/plugin/src/sbt-test/paradox/site/expected/a/a.html index ee95beaa..696faa03 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/a/a.html @@ -25,6 +25,7 @@
  • BAA
  • BB
  • +
  • c/a.html
  • A AB diff --git a/plugin/src/sbt-test/paradox/site/expected/a/b.html b/plugin/src/sbt-test/paradox/site/expected/a/b.html index 4e53d8e6..49bfeccf 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a/b.html +++ b/plugin/src/sbt-test/paradox/site/expected/a/b.html @@ -26,6 +26,7 @@
  • BAA
  • BB
  • +
  • c/a.html
  • AA AC diff --git a/plugin/src/sbt-test/paradox/site/expected/a/c.html b/plugin/src/sbt-test/paradox/site/expected/a/c.html index 9e6ba3cc..c91407f0 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a/c.html +++ b/plugin/src/sbt-test/paradox/site/expected/a/c.html @@ -26,6 +26,7 @@
  • BAA
  • BB
  • +
  • c/a.html
  • AB BA diff --git a/plugin/src/sbt-test/paradox/site/expected/b/a.html b/plugin/src/sbt-test/paradox/site/expected/b/a.html index 63a99e40..1e574937 100644 --- a/plugin/src/sbt-test/paradox/site/expected/b/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/b/a.html @@ -25,6 +25,7 @@
  • BAA
  • BB
  • +
  • c/a.html
  • AC BAA diff --git a/plugin/src/sbt-test/paradox/site/expected/b/a/a.html b/plugin/src/sbt-test/paradox/site/expected/b/a/a.html index 62b085ef..82aaa746 100644 --- a/plugin/src/sbt-test/paradox/site/expected/b/a/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/b/a/a.html @@ -26,6 +26,7 @@
  • BAA
  • BB
  • +
  • c/a.html
  • BA BB diff --git a/plugin/src/sbt-test/paradox/site/expected/b/b.html b/plugin/src/sbt-test/paradox/site/expected/b/b.html index 24c8e8f3..7e473ee3 100644 --- a/plugin/src/sbt-test/paradox/site/expected/b/b.html +++ b/plugin/src/sbt-test/paradox/site/expected/b/b.html @@ -26,8 +26,10 @@
  • BAA
  • BB
  • +
  • c/a.html
  • BAA +c/a.html

    BB

    This is the “BB” page.

    BB2

    diff --git a/plugin/src/sbt-test/paradox/site/expected/c/a.html b/plugin/src/sbt-test/paradox/site/expected/c/a.html new file mode 100644 index 00000000..a0a8190b --- /dev/null +++ b/plugin/src/sbt-test/paradox/site/expected/c/a.html @@ -0,0 +1,35 @@ + + + + · Paradox Test + + + +base +A +0.1-SNAPSHOT + + +BB +

    CA

    +

    This is the “CA” page.

    +

    It starts with a H2 header instead of an H1.

    + + diff --git a/plugin/src/sbt-test/paradox/site/src/main/paradox/a.md b/plugin/src/sbt-test/paradox/site/src/main/paradox/a.md index ca97840f..8e3e03ac 100644 --- a/plugin/src/sbt-test/paradox/site/src/main/paradox/a.md +++ b/plugin/src/sbt-test/paradox/site/src/main/paradox/a.md @@ -14,4 +14,5 @@ Followed by the index of a select number of pages. - [aa](a/a.md) - [ba](b/a.md) - [baa](b/a/a.md) + - [ca](c/a.md) @@@ diff --git a/plugin/src/sbt-test/paradox/site/src/main/paradox/c/a.md b/plugin/src/sbt-test/paradox/site/src/main/paradox/c/a.md new file mode 100644 index 00000000..169f2e33 --- /dev/null +++ b/plugin/src/sbt-test/paradox/site/src/main/paradox/c/a.md @@ -0,0 +1,5 @@ +## CA + +This is the "CA" page. + +It starts with a H2 header instead of an H1. diff --git a/plugin/src/sbt-test/paradox/site/test b/plugin/src/sbt-test/paradox/site/test index 1a4421cd..cd900eb8 100644 --- a/plugin/src/sbt-test/paradox/site/test +++ b/plugin/src/sbt-test/paradox/site/test @@ -7,5 +7,6 @@ $ must-mirror target/paradox/site/a/c.html expected/a/c.html $ must-mirror target/paradox/site/b/a.html expected/b/a.html $ must-mirror target/paradox/site/b/a/a.html expected/b/a/a.html $ must-mirror target/paradox/site/b/b.html expected/b/b.html +$ must-mirror target/paradox/site/c/a.html expected/c/a.html $ must-mirror target/paradox/site/css/page.css expected/css/page.css $ must-mirror target/paradox/site/images/a.png expected/images/a.png From 3dd576fe2edc612439784fbb0e776ad1b209ea92 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 31 Aug 2016 18:12:08 +0100 Subject: [PATCH 2/2] Allow for non-H1 headers Fixes #17 --- .../main/scala/com/lightbend/paradox/markdown/Page.scala | 4 ++-- plugin/src/sbt-test/paradox/site/expected/a.html | 7 ++----- plugin/src/sbt-test/paradox/site/expected/a/a.html | 2 +- plugin/src/sbt-test/paradox/site/expected/a/b.html | 2 +- plugin/src/sbt-test/paradox/site/expected/a/c.html | 2 +- plugin/src/sbt-test/paradox/site/expected/b/a.html | 2 +- plugin/src/sbt-test/paradox/site/expected/b/a/a.html | 2 +- plugin/src/sbt-test/paradox/site/expected/b/b.html | 4 ++-- plugin/src/sbt-test/paradox/site/expected/c/a.html | 6 +++--- 9 files changed, 14 insertions(+), 17 deletions(-) diff --git a/core/src/main/scala/com/lightbend/paradox/markdown/Page.scala b/core/src/main/scala/com/lightbend/paradox/markdown/Page.scala index 420793ab..4e2120a9 100644 --- a/core/src/main/scala/com/lightbend/paradox/markdown/Page.scala +++ b/core/src/main/scala/com/lightbend/paradox/markdown/Page.scala @@ -89,8 +89,8 @@ object Page { // TODO: get default label node from page index link? val targetPath = convertPath(page.path) val (h1, subheaders) = page.headers match { - case h :: hs if h.label.level == 1 => (Header(h.label.path, h.label.markdown), h.children ++ hs) - case hs => (Header(targetPath, new SpecialTextNode(targetPath)), hs) + case h :: hs => (Header(h.label.path, h.label.markdown), h.children ++ hs) + case hs => (Header(targetPath, new SpecialTextNode(targetPath)), hs) } val headers = subheaders map (_ map (h => Header(h.path, h.markdown))) Page(page.file, targetPath, h1.label, h1, headers, page.markdown) diff --git a/plugin/src/sbt-test/paradox/site/expected/a.html b/plugin/src/sbt-test/paradox/site/expected/a.html index c239740c..cede2fd5 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/a.html @@ -24,7 +24,7 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • AA

    A

    @@ -67,10 +67,7 @@

    A<
  • BB4
  • -
  • c/a.html -
  • +
  • CA
  • Followed by the index of a select number of pages.

    diff --git a/plugin/src/sbt-test/paradox/site/expected/a/a.html b/plugin/src/sbt-test/paradox/site/expected/a/a.html index 696faa03..76f35188 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/a/a.html @@ -25,7 +25,7 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • A AB diff --git a/plugin/src/sbt-test/paradox/site/expected/a/b.html b/plugin/src/sbt-test/paradox/site/expected/a/b.html index 49bfeccf..ecbaa37a 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a/b.html +++ b/plugin/src/sbt-test/paradox/site/expected/a/b.html @@ -26,7 +26,7 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • AA AC diff --git a/plugin/src/sbt-test/paradox/site/expected/a/c.html b/plugin/src/sbt-test/paradox/site/expected/a/c.html index c91407f0..fb4170ee 100644 --- a/plugin/src/sbt-test/paradox/site/expected/a/c.html +++ b/plugin/src/sbt-test/paradox/site/expected/a/c.html @@ -26,7 +26,7 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • AB BA diff --git a/plugin/src/sbt-test/paradox/site/expected/b/a.html b/plugin/src/sbt-test/paradox/site/expected/b/a.html index 1e574937..940e4155 100644 --- a/plugin/src/sbt-test/paradox/site/expected/b/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/b/a.html @@ -25,7 +25,7 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • AC BAA diff --git a/plugin/src/sbt-test/paradox/site/expected/b/a/a.html b/plugin/src/sbt-test/paradox/site/expected/b/a/a.html index 82aaa746..061774c9 100644 --- a/plugin/src/sbt-test/paradox/site/expected/b/a/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/b/a/a.html @@ -26,7 +26,7 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • BA BB diff --git a/plugin/src/sbt-test/paradox/site/expected/b/b.html b/plugin/src/sbt-test/paradox/site/expected/b/b.html index 7e473ee3..eadbaef7 100644 --- a/plugin/src/sbt-test/paradox/site/expected/b/b.html +++ b/plugin/src/sbt-test/paradox/site/expected/b/b.html @@ -26,10 +26,10 @@
  • BAA
  • BB
  • -
  • c/a.html
  • +
  • CA
  • BAA -c/a.html +CA

    BB

    This is the “BB” page.

    BB2

    diff --git a/plugin/src/sbt-test/paradox/site/expected/c/a.html b/plugin/src/sbt-test/paradox/site/expected/c/a.html index a0a8190b..2028a0ff 100644 --- a/plugin/src/sbt-test/paradox/site/expected/c/a.html +++ b/plugin/src/sbt-test/paradox/site/expected/c/a.html @@ -1,7 +1,7 @@ - · Paradox Test +CA · Paradox Test @@ -12,7 +12,7 @@
  • Alphabet
  • Google
  • A
  • -
  • c/a.html
  • +
  • CA
  • -
  • c/a.html
  • +
  • CA
  • BB

    CA