Skip to content

Commit

Permalink
Update scalafmt-core to 3.8.0 (#586)
Browse files Browse the repository at this point in the history
* Update scalafmt-core to 3.8.0

* Reformat with scalafmt 3.8.0

Executed command: scalafmt --non-interactive

* Add 'Reformat with scalafmt 3.8.0' to .git-blame-ignore-revs

* reformat with scalafmt 3.8.0

* Add 'reformat with scalafmt 3.8.0' to .git-blame-ignore-revs

---------

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>
Co-authored-by: Jens Halm <[email protected]>
  • Loading branch information
typelevel-steward[bot] and jenshalm authored Mar 27, 2024
1 parent 30ad2b3 commit 6e2c2cd
Show file tree
Hide file tree
Showing 20 changed files with 266 additions and 71 deletions.
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ d533efd3712cdbcc94cfff623dffc43c183f8716

# Scala Steward: Reformat with scalafmt 3.7.3
20e1d4f0d0512236885b44411816a6cf008d8e07

# Scala Steward: Reformat with scalafmt 3.8.0
ee118945759210a8b13e68538947244fd7f77f97

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

runner.dialect = scala212

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ class OperationConfig private[laika] (
val docTypeMatcher = new ExtensionBundle {
val description: String = s"Document Type Matcher for ${parser.description}"
override val origin: BundleOrigin = BundleOrigin.Parser

override val docTypeMatcher: PartialFunction[Path, DocumentType] =
DocumentTypeMatcher.forMarkup(parser.fileSuffixes)

}
copy(bundles = this.bundles ++ parser.extensions :+ docTypeMatcher)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ private[laika] object FORenderer extends ((TagFormatter, Element) => String) {
}

object WithFallback {

def unapply(value: Element): Option[Element] = value match {
case f: Fallback => Some(f.fallback)
case _ => None
}

}

def renderBlockContainer(con: BlockContainer): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ private[laika] class HTMLRenderer(format: String)
}

object WithFallback {

def unapply(value: Element): Option[Element] = value match {
case f: Fallback => Some(f.fallback)
case _ => None
}

}

def renderBlockContainer(con: BlockContainer): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,14 @@ private[rst] object Directives {
): (DirectiveParserBuilder, DirectivePart[Option[T]]) = {
val (key, newBuilder) = build(builder)
val part = new DirectivePart[Option[T]] {

def apply(parsed: ParsedDirective): Result[Option[T]] =
parsed.part(key).map(converter(parsed, _)) match {
case None => Right(None)
case Some(Left(error)) => Left(error)
case Some(Right(result)) => Right(Some(result))
}

}
(newBuilder, part)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,14 @@ private[rst] object TextRoles {
): (RoleDirectiveParserBuilder, RoleDirectivePart[Option[T]]) = {
val (key, newBuilder) = build(builder)
val part = new RoleDirectivePart[Option[T]] {

def apply(parsed: ParsedDirective): Result[Option[T]] =
parsed.part(key).map(converter(parsed, _)) match {
case None => Right(None)
case Some(Left(error)) => Left(error)
case Some(Right(result)) => Right(Some(result))
}

}
(newBuilder, part)
}
Expand Down
4 changes: 3 additions & 1 deletion core/shared/src/test/scala/laika/api/RenderAPISpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ class RenderAPISpec extends FunSuite
test("use Document's configuration for rewrite rules") {
case class TestResolver(options: Options = Options.empty) extends BlockResolver {
type Self = TestResolver
def resolve(cursor: DocumentCursor): Block = {

def resolve(cursor: DocumentCursor): Block = {
cursor.config
.get[String]("testKey")
.fold[Block](e => InvalidBlock(e.message, source), str => Paragraph(str))
}

def runsIn(phase: RewritePhase): Boolean = phase.isInstanceOf[RewritePhase.Render]
def source: SourceFragment = SourceCursor.Generated
def unresolvedMessage: String = "unresolved test block"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ class OperationConfigSpec extends FunSuite {
): OperationConfig = {

object Parser extends MarkupFormat {
val fileSuffixes = Set("foo")
val blockParsers = new MarkupParsers[BlockParserBuilder] {
val fileSuffixes = Set("foo")

val blockParsers = new MarkupParsers[BlockParserBuilder] {
val all: Seq[BlockParserBuilder] = Nil
}
val spanParsers = new MarkupParsers[SpanParserBuilder] {

val spanParsers = new MarkupParsers[SpanParserBuilder] {
val all: Seq[SpanParserBuilder] = Nil
}

lazy val extensions = parserBundles
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ trait ParserSetup {
): MarkupFormat = {

new MarkupFormat {
val fileSuffixes = Set("foo")
val blockParsers = new MarkupParsers[BlockParserBuilder] {
val fileSuffixes = Set("foo")

val blockParsers = new MarkupParsers[BlockParserBuilder] {
val all: Seq[BlockParserBuilder] = blocks
}
val spanParsers = new MarkupParsers[SpanParserBuilder] {

val spanParsers = new MarkupParsers[SpanParserBuilder] {
val all: Seq[SpanParserBuilder] = spans
}

lazy val extensions = bundles
}

Expand Down
Loading

0 comments on commit 6e2c2cd

Please sign in to comment.