Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ e2f5f00ad433f25a24fde3f01927f711deb2442c

# Scala Steward: Reformat with scalafmt 3.8.6
8d82687a7f194fb1e690be3b199d07bc2fc30bf6

# Scala Steward: Reformat with scalafmt 3.11.3
c2592bc54c7b53585daebb39385a7134740200d2
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.6
version = 3.11.3

runner.dialect = scala212

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ private[laika] object FieldRef {
name: String,
subKey: Key,
context: ResolverContext
): Option[ResolvedRef] =
): Option[ResolvedRef] =
resolve(context).selectChild(name, subKey, context)
def withName(name: String): FieldRef = dependent(name, configOrigin, value)
}
Expand Down Expand Up @@ -446,7 +446,7 @@ private[laika] object FieldRef {
name: String,
subKey: Key,
context: ResolverContext
): Option[ResolvedRef] =
): Option[ResolvedRef] =
resolve(context).selectChild(name, subKey, context)
def withName(name: String): FieldRef =
substitution(name, configOrigin, substitutionRef, optional)
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/laika/parse/SourceCursor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class BlockSource(
@tailrec def posFromLine(
remainingLines: List[LineSource],
remainingOffset: Int
): (LineSource, Int) = {
): (LineSource, Int) = {
val lineLength = remainingLines.head.length
if (lineLength >= remainingOffset) (remainingLines.head, remainingOffset)
else if (remainingLines.tail.isEmpty) (remainingLines.head, lineLength)
Expand Down
22 changes: 11 additions & 11 deletions core/shared/src/test/scala/laika/api/ParseAPISpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class ParseAPISpec extends FunSuite

test("parse Markdown into a raw document, without applying the default rewrite rules") {
val input = """[link][id]
|
|[id]: http://foo/""".stripMargin
|
|[id]: http://foo/""".stripMargin
val parser = MarkupParser.of(Markdown).build
assertEquals(
parser.parseUnresolved(input).map(_.document.content),
Expand All @@ -92,15 +92,15 @@ class ParseAPISpec extends FunSuite
|
|[invalid2]""".stripMargin
val msg = """One or more error nodes in result:
| [1]: unresolved link id reference: invalid1
|
| [invalid1]
| ^
|
| [5]: unresolved link id reference: invalid2
|
| [invalid2]
| ^""".stripMargin
| [1]: unresolved link id reference: invalid1
|
| [invalid1]
| ^
|
| [5]: unresolved link id reference: invalid2
|
| [invalid2]
| ^""".stripMargin
assertEquals(MarkupParser.of(Markdown).build.parse(input).leftMap(_.message), Left(msg))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class ImageDirectiveSpec extends FunSuite with ParagraphCompanionShortcuts with

test("block directive - intrinsicWidth and intrinsicHeight attributes") {
val input = """@:image(picture.jpg) {
| intrinsicWidth = 320
| intrinsicHeight = 240
|}""".stripMargin
| intrinsicWidth = 320
| intrinsicHeight = 240
|}""".stripMargin
val result = Image(
resolvedImageTarget,
width = Some(LengthUnit.px(320)),
Expand All @@ -106,9 +106,9 @@ class ImageDirectiveSpec extends FunSuite with ParagraphCompanionShortcuts with

test("span directive - alt and title attributes") {
val input = """aaa @:image(picture.jpg) {
| alt = alt
| title = desc
|} bbb""".stripMargin
| alt = alt
| title = desc
|} bbb""".stripMargin
val result = Image(
resolvedImageTarget,
alt = Some("alt"),
Expand All @@ -120,9 +120,9 @@ class ImageDirectiveSpec extends FunSuite with ParagraphCompanionShortcuts with

test("span directive - intrinsicWidth and intrinsicHeight attributes") {
val input = """aaa @:image(picture.jpg) {
| intrinsicWidth = 320
| intrinsicHeight = 240
|} bbb""".stripMargin
| intrinsicWidth = 320
| intrinsicHeight = 240
|} bbb""".stripMargin
val result = Image(
resolvedImageTarget,
width = Some(LengthUnit.px(320)),
Expand All @@ -134,8 +134,8 @@ class ImageDirectiveSpec extends FunSuite with ParagraphCompanionShortcuts with

test("span directive - style attribute") {
val input = """aaa @:image(picture.jpg) {
| style = small-image
|} bbb""".stripMargin
| style = small-image
|} bbb""".stripMargin
val result = Image(resolvedImageTarget, options = Styles("small-image"))
runSpans(input, result)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ class SelectDirectiveSpec extends FunSuite with ParagraphCompanionShortcuts
|
|@:@""".stripMargin
val input = s"""aa
|
|$directive
|
|bb""".stripMargin
|
|$directive
|
|bb""".stripMargin
val message =
"One or more errors processing directive 'select': too few occurrences of separator directive 'choice': expected min: 2, actual: 1"
val invalid = InvalidBlock(message, source(directive, input, defaultPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ class StandardDirectiveSpec extends FunSuite

test("fragment directive with two paragraphs") {
val input = """aa
|
|@:fragment(foo)
|
|Line 1
|
|Line 2
|
|@:@
|
|bb""".stripMargin
|
|@:fragment(foo)
|
|Line 1
|
|Line 2
|
|@:@
|
|bb""".stripMargin
val expectedFragment = BlockSequence(List(p("Line 1"), p("Line 2")), Styles("foo"))
runFragment(input, expectedFragment)
}
Expand Down
26 changes: 13 additions & 13 deletions core/shared/src/test/scala/laika/internal/rst/APISpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class APISpec extends FunSuite with ParagraphCompanionShortcuts with RenderPhase
})
)
val input = """.. oneArg:: arg
|
|.. twoArgs:: arg arg""".stripMargin
|
|.. twoArgs:: arg arg""".stripMargin
val parser = MarkupParser
.of(ReStructuredText)
.using(ExtensionProvider.forExtensions(blocks = directives))
Expand All @@ -60,10 +60,10 @@ class APISpec extends FunSuite with ParagraphCompanionShortcuts with RenderPhase
})
)
val input = """foo |one| foo |two|
|
|.. |one| oneArg:: arg
|
|.. |two| twoArgs:: arg arg""".stripMargin
|
|.. |one| oneArg:: arg
|
|.. |two| twoArgs:: arg arg""".stripMargin
val parser = MarkupParser
.of(ReStructuredText)
.using(ExtensionProvider.forExtensions(spans = directives))
Expand All @@ -86,13 +86,13 @@ class APISpec extends FunSuite with ParagraphCompanionShortcuts with RenderPhase
}) { (res, text) => Text(res + text) }
)
val input = """foo `one`:one: foo :two:`two`
|
|.. role::one(oneArg)
| :name: val
|
|.. role::two(twoArgs)
| :name1: val1
| :name2: val2""".stripMargin
|
|.. role::one(oneArg)
| :name: val
|
|.. role::two(twoArgs)
| :name1: val1
| :name2: val2""".stripMargin
val parser = MarkupParser
.of(ReStructuredText)
.using(ExtensionProvider.forExtensions(roles = roles))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ class BlockParsersSpec extends FunSuite with ParagraphCompanionShortcuts with Te

test("headers with varying levels") {
val h1 = """==========
| Header 1
|==========""".stripMargin
| Header 1
|==========""".stripMargin
val h2 = """Header 2
|========""".stripMargin
|========""".stripMargin
val h3 = """Header 3
|--------""".stripMargin
|--------""".stripMargin
val h4 = """Header 2b
|=========""".stripMargin
|=========""".stripMargin
val input =
s"""$h1
|
Expand Down Expand Up @@ -228,8 +228,8 @@ class BlockParsersSpec extends FunSuite with ParagraphCompanionShortcuts with Te
val header = """Header
|======""".stripMargin
val input = s""".. _target:
|
|$header""".stripMargin
|
|$header""".stripMargin
run(
input,
DecoratedHeader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,21 +593,21 @@ class StandardBlockDirectivesSpec extends FunSuite with ParagraphCompanionShortc

test("header - creates a fragment in the document") {
val input = """.. header::
| This is
| a header
|
|This isn't""".stripMargin
| This is
| a header
|
|This isn't""".stripMargin
val fragments = Map("header" -> BlockSequence("This is\na header"))
val rootElem = RootElement(p("This isn't"))
runFragments(input, fragments, rootElem)
}

test("footer - creates a fragment in the document") {
val input = """.. footer::
| This is
| a footer
|
|This isn't""".stripMargin
| This is
| a footer
|
|This isn't""".stripMargin
val fragments = Map("footer" -> BlockSequence("This is\na footer"))
val rootElem = RootElement(p("This isn't"))
runFragments(input, fragments, rootElem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,22 @@ class StandardSpanDirectivesSpec extends FunSuite with ParagraphCompanionShortcu

test("image - with width and height options") {
val input = """.. |subst| image:: picture.jpg
| :width: 200px
| :height: 120px
|
|Some |subst|""".stripMargin
| :width: 200px
| :height: 120px
|
|Some |subst|""".stripMargin
val expectedWidth = Some(LengthUnit.px(200))
val expectedHeight = Some(LengthUnit.px(120))
run(input, p(Text("Some "), Image(imgTarget, width = expectedWidth, height = expectedHeight)))
}

test("image - with scale option") {
val input = """.. |subst| image:: picture.jpg
| :width: 200 px
| :height: 120 px
| :scale: 50%
|
|Some |subst|""".stripMargin
| :width: 200 px
| :height: 120 px
| :scale: 50%
|
|Some |subst|""".stripMargin
val expectedWidth = Some(LengthUnit.px(100))
val expectedHeight = Some(LengthUnit.px(60))
run(input, p(Text("Some "), Image(imgTarget, width = expectedWidth, height = expectedHeight)))
Expand Down Expand Up @@ -163,8 +163,8 @@ class StandardSpanDirectivesSpec extends FunSuite with ParagraphCompanionShortcu

val format = "yyyy-MM-dd HH:mm:ss"
val input = s""".. |subst| date:: $format
|
|Some |subst|""".stripMargin
|
|Some |subst|""".stripMargin
val date = PlatformDateTime.format(PlatformDateTime.now, format).toOption.get
val result = stripMinutesAndSeconds(RootElement(p(Text(s"Some $date"))))
assertEquals(parse(input).map(stripMinutesAndSeconds), Right(result))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class StandardTextRolesSpec extends FunSuite with ParagraphCompanionShortcuts

test("raw - disabled by default") {
val role = """.. role:: foo(raw)
| :format: AML BML CML""".stripMargin
| :format: AML BML CML""".stripMargin
val input = s"""$role
|
|some :foo:`text`""".stripMargin
Expand Down
30 changes: 15 additions & 15 deletions core/shared/src/test/scala/laika/markdown/BlockParsersSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ class BlockParsersSpec extends FunSuite with ParagraphCompanionShortcuts {

test("enum lists - items prefixed by numbers containing multiple paragraphs in a single item") {
val input = """1. aaa
|
| bbb
| bbb
|
|2. ccc
|
|3. ddd""".stripMargin
|
| bbb
| bbb
|
|2. ccc
|
|3. ddd""".stripMargin
val expected = EnumList(
Seq(p("aaa"), p("bbb\nbbb")),
Seq(fp("ccc")),
Expand Down Expand Up @@ -536,10 +536,10 @@ class BlockParsersSpec extends FunSuite with ParagraphCompanionShortcuts {

test("code block nested inside a list") {
val input = """* aaa
|* bbb
|
| code
|* ccc""".stripMargin
|* bbb
|
| code
|* ccc""".stripMargin
val expected = BulletList(
Seq(p("aaa")),
Seq(p("bbb"), LiteralBlock("code")),
Expand All @@ -550,10 +550,10 @@ class BlockParsersSpec extends FunSuite with ParagraphCompanionShortcuts {

test("blockquote nested inside a list") {
val input = """* aaa
|* bbb
|
| >quote
|* ccc""".stripMargin
|* bbb
|
| >quote
|* ccc""".stripMargin
val expected = BulletList(
Seq(p("aaa")),
Seq(p("bbb"), QuotedBlock("quote")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ class HTMLBlockParserSpec extends FunSuite

test("recognize a script tag as a root element") {
val input = """aaa
|
|<script type="text/javascript" defer>
| var x = [1, 2, 3];
| var y = 'foo';
|</script>
|
|bbb""".stripMargin
|
|<script type="text/javascript" defer>
| var x = [1, 2, 3];
| var y = 'foo';
|</script>
|
|bbb""".stripMargin
val script = HTMLScriptElement(
List(
HTMLAttribute("type", List(Text("text/javascript")), Some('"')),
Expand Down
Loading
Loading