Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove all deprecated APIs and their documentation #429

Merged
merged 1 commit into from
Jun 25, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Build and test
run: |
sbt -v +test +mimaReportBinaryIssues scalafmtCheckAll docs/mdoc docs/laikaSite scripted
sbt -v +test scalafmtCheckAll docs/mdoc docs/laikaSite scripted
rm -rf "$HOME/.ivy2/local" || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,4 @@ trait TransformerBuilderOps[FMT] extends ParserBuilderOps with RendererBuilderOp

})

@deprecated("use buildingRules", "0.19.0")
def buildingRule(newRules: RewriteRulesBuilder): ThisType = buildingRules(newRules)

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import laika.directive._
import laika.rewrite.link.{ InvalidTarget, RecoveredTarget, ValidTarget }
import laika.time.PlatformDateTime

import scala.annotation.nowarn
import scala.collection.immutable.TreeSet

/** Provides the implementation for the standard directives included in Laika.
Expand Down Expand Up @@ -71,7 +70,6 @@ import scala.collection.immutable.TreeSet
* - `target`: Translates a link target.
* External targets will be rendered verbatim, internal targets (absolute or relative paths) will be resolved
* from the perspective of a template to a path relative to the document the template had been applied to.
* - `path`: Deprecated, use the newer target directive instead which is a superset of its functionality
* - `date`: renders a date with a specified formatting pattern
* - `attribute`: renders an HTML attribute if the specified config value is defined
*
Expand Down Expand Up @@ -124,29 +122,6 @@ object StandardDirectives extends DirectiveRegistry {
}
}

@deprecated("use target directive instead", "0.19.0")
lazy val path: Templates.Directive = Templates.eval("path") {
import Templates.dsl._

(attribute(0).as[Path], attribute(0).as[String], cursor).mapN {
(literalPath, pathKey, cursor) =>
def resolvePath(path: Path): Either[String, TemplateSpan] = {
val it = InternalTarget(path)
cursor.validate(it) match {
case ValidTarget =>
Right(TemplateElement(RawLink.internal(path.relativeTo(cursor.path))))
case InvalidTarget(message) => Left(message)
case RecoveredTarget(message, _) => Left(message)
}
}

val config = cursor.resolver.config
if (config.hasKey(pathKey))
config.get[Path](pathKey).leftMap(_.message).flatMap(resolvePath)
else resolvePath(literalPath)
}
}

lazy val target: Templates.Directive = Templates.eval("target") {
import Templates.dsl._

Expand Down Expand Up @@ -323,7 +298,6 @@ object StandardDirectives extends DirectiveRegistry {

/** The complete list of standard directives for templates.
*/
@nowarn("cat=deprecation")
lazy val templateDirectives: Seq[Templates.Directive] = List(
BreadcrumbDirectives.forTemplates,
NavigationTreeDirectives.forTemplates,
Expand All @@ -335,7 +309,6 @@ object StandardDirectives extends DirectiveRegistry {
HTMLHeadDirectives.linkJS,
iconTemplate,
target,
path,
date,
attr
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ object ReferenceResolver {
rootKey.child("currentDocument"),
ObjectValue(
Seq(
Field("path", StringValue(document.path.toString)), // deprecated since 0.19.0
Field("sourcePath", StringValue(document.path.toString)),
Field("content", ASTValue(document.content), config.origin),
Field("title", ASTValue(document.title.getOrElse(emptyTitle)), config.origin),
Expand Down Expand Up @@ -129,11 +128,6 @@ object ReferenceResolver {
Seq(
Field("path", ASTValue(RawLink.internal(doc.path))),
Field("sourcePath", sourcePath),
Field("absolutePath", sourcePath), // deprecated since 0.19.0
Field(
"relativePath",
StringValue(doc.path.relativeTo(document.path).toString)
), // deprecated since 0.19.0
Field("title", ASTValue(doc.title.getOrElse(emptyTitle)))
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,3 @@ object NoOpPathTranslator extends PathTranslator {
def translate(input: RelativePath): RelativePath = input
def forReferencePath(path: Path): PathTranslator = this
}

@deprecated("use NoOpPathTranslator for transforming a single input", "0.19.2")
case class BasicPathTranslator(outputSuffix: String) extends PathTranslator {
private val defaultAttributes = Some(PathAttributes(isStatic = false, isVersioned = false))
def getAttributes(path: Path): Option[PathAttributes] = defaultAttributes
def translate(input: Path): Path = input.withSuffix(outputSuffix)
def translate(input: RelativePath): RelativePath = input.withSuffix(outputSuffix)
def forReferencePath(path: Path): PathTranslator = this
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,42 +112,6 @@ class StandardDirectiveSpec extends FunSuite
run(input, p(Text("aa "), SpanSequence(Nil), Text(" bb")))
}

test("path directive - translate a relative path") {
val input = """aa @:path(theme.css) bb"""
runTemplate(
input,
"laika.links.excludeFromValidation = [\"/\"]",
TemplateString("aa "),
TemplateElement(RawLink.internal("../theme/theme.css")),
TemplateString(" bb")
)
}

test("path directive - translate an absolute path") {
val input = """aa @:path(/theme/theme.css) bb"""
runTemplate(
input,
"laika.links.excludeFromValidation = [\"/\"]",
TemplateString("aa "),
TemplateElement(RawLink.internal("../theme/theme.css")),
TemplateString(" bb")
)
}

test("path directive - fail with an invalid target") {
val dirSrc = "@:path(/theme/theme.css)"
val input = s"""aa $dirSrc bb"""
val msg =
"One or more errors processing directive 'path': unresolved internal reference: ../theme/theme.css"
runTemplate(
input,
"",
TemplateString("aa "),
TemplateElement(InvalidSpan(msg, source(dirSrc, input)).copy(fallback = Literal(dirSrc))),
TemplateString(" bb")
)
}

private val resolvedTarget = ResolvedInternalTarget(
absolutePath = Path.parse("/theme/theme.css"),
relativePath = RelativePath.parse("../theme/theme.css")
Expand Down
8 changes: 0 additions & 8 deletions docs/src/07-reference/01-standard-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ Example:
See [Disabling Validation] when you only want the path translation without the validation.


### `@:path`

Can only be used in templates.

Deprecated since version 0.19.0 - use the `@:target` directive which is a superset of the functionality
of the old `@:path` directive which did not support external targets.


Inclusions
----------

Expand Down
6 changes: 0 additions & 6 deletions docs/src/07-reference/02-substitution-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ This is a complete list of values exposed in the `cursor` namespace:

* `sourcePath`: the absolute (virtual) path of the document in the input tree.

* `path` (deprecated since 0.19.0): use `sourcePath`.

* Access to surrounding documents via `cursor.parentDocument`, `cursor.previousDocument`, `cursor.nextDocument`,
`cursor.flattenedSiblings.previousDocument` and `cursor.flattenedSiblings.nextDocument`.
Any of these references may be empty, depending on the position of the current document.
Expand All @@ -87,10 +85,6 @@ This is a complete list of values exposed in the `cursor` namespace:

* `sourcePath`: the absolute (virtual) path of the document in the input tree, e.g. `/herbs/parsley.md`.

* `absolutePath` (deprecated since 0.19.0): use `sourcePath`.

* `relativePath` (deprecated since 0.19.0): use `sourcePath`.

* `root.title`: The title of the root node, usually the title of the website or e-book.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
]
}

<p class="footer">@:for(helium.site.pageNavigation.sourceEditLinks)<a href="${_.baseURL}${cursor.currentDocument.path}">${_.icon}${_.text}</a>@:@</p>
<p class="footer">@:for(helium.site.pageNavigation.sourceEditLinks)<a href="${_.baseURL}${cursor.currentDocument.sourcePath}">${_.icon}${_.text}</a>@:@</p>
</nav>
@:@
21 changes: 0 additions & 21 deletions io/src/main/scala/laika/helium/config/settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -633,21 +633,6 @@ private[helium] trait SiteOps extends SingleConfigOps with CopyOps {
copyWith(helium.siteSettings.copy(content = newContent))
}

@deprecated
def pageNavigation(
enabled: Boolean,
depth: Int,
sourceBaseURL: Option[String],
sourceLinkText: String
): Helium =
pageNavigation(
enabled,
depth,
sourceBaseURL,
sourceLinkText,
currentContent.pageNavigation.keepOnSmallScreens
)

/** Adds a dedicated page for a table of content, in addition to the left navigation bar.
*
* @param title the title to display on the page and in navigation that links to the page
Expand Down Expand Up @@ -685,12 +670,6 @@ private[helium] trait SiteOps extends SingleConfigOps with CopyOps {
copyWith(helium.siteSettings.copy(content = newContent))
}

@deprecated("use the corresponding properties of the new pageNavigation method", "0.19.0")
def markupEditLinks(text: String, baseURL: String): Helium = pageNavigation(
sourceLinkText = text,
sourceBaseURL = Some(baseURL)
)

/** Adds a dedicated landing page to the site that is tailored for software documentation sites.
* By default no landing page will be included and the site will render the homepage (if present)
* with the same default template as the main content pages.
Expand Down
6 changes: 0 additions & 6 deletions io/src/main/scala/laika/io/model/DirectoryInput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import laika.ast.{ DocumentType, Path }
import laika.ast.Path.Root
import laika.bundle.DocumentTypeMatcher

import java.io.File
import scala.io.Codec

/** A directory in the file system containing input documents for a tree transformation.
Expand All @@ -46,11 +45,6 @@ object DirectoryInput {
def filter[F[_]: Async](file: FilePath) = Files.forAsync[F].isHidden(file.toFS2Path)
}

@deprecated("use apply(FilePath)", "0.19.0")
def apply(directory: File)(implicit codec: Codec): DirectoryInput = apply(
FilePath.fromJavaFile(directory)
)

/** Creates a new instance using the library's defaults for the `docTypeMatcher` and
* `fileFilter` properties.
*/
Expand Down
25 changes: 1 addition & 24 deletions io/src/main/scala/laika/io/model/InputTreeBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import laika.io.runtime.TreeResultBuilder.{
TemplateResult
}

import java.io.{ File, InputStream }
import java.io.InputStream
import scala.io.Codec
import scala.reflect.ClassTag

Expand Down Expand Up @@ -146,19 +146,11 @@ class InputTreeBuilder[F[_]](
def addDirectory(name: String, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F] =
addDirectory(FilePath.parse(name), mountPoint)

@deprecated("use addDirectory(String) or addDirectory(FilePath)", "0.19.0")
def addDirectory(dir: File)(implicit codec: Codec): InputTreeBuilder[F] =
addDirectory(FilePath.fromJavaFile(dir), Root)

/** Adds the specified directories to the input tree, placing it in the virtual root.
*/
def addDirectory(dir: FilePath)(implicit codec: Codec): InputTreeBuilder[F] =
addDirectory(dir, Root)

@deprecated("use addDirectory(String, Path) or addDirectory(FilePath, Path)", "0.19.0")
def addDirectory(dir: File, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F] =
addDirectory(FilePath.fromJavaFile(dir), mountPoint)

/** Adds the specified directories to the input tree, placing it at the specified mount point in the virtual tree.
*/
def addDirectory(dir: FilePath, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F] =
Expand All @@ -183,10 +175,6 @@ class InputTreeBuilder[F[_]](
def addFile(name: String, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F] =
addFile(FilePath.parse(name), mountPoint)

@deprecated("use addFile(String) or addFile(FilePath)", "0.19.0")
def addFile(file: File, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F] =
addFile(FilePath.fromJavaFile(file), mountPoint)

/** Adds the specified file to the input tree, placing it at the specified mount point in the virtual tree.
*
* The content type of the stream will be determined by the suffix of the virtual path, e.g.
Expand Down Expand Up @@ -237,17 +225,6 @@ class InputTreeBuilder[F[_]](
_ + TextInput.fromClassLoaderResource(name, mountPoint, docType, classLoader)
}

@deprecated("Use addClassResource or addClassLoaderResource", "0.19.0")
def addClasspathResource(name: String, mountPoint: Path)(implicit
codec: Codec
): InputTreeBuilder[F] =
addClassLoaderResource(name, mountPoint)

@deprecated("use addInputStream", "0.19.0")
def addStream(stream: F[InputStream], mountPoint: Path, autoClose: Boolean = true)(implicit
codec: Codec
): InputTreeBuilder[F] = addInputStream(stream, mountPoint, autoClose)

/** Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
*
* The content type of the stream will be determined by the suffix of the virtual path, e.g.
Expand Down
5 changes: 1 addition & 4 deletions io/src/main/scala/laika/io/ops/BinaryOutputOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import cats.effect.Async
import laika.ast.Path.Root
import laika.io.model.{ BinaryOutput, FilePath }

import java.io.{ File, OutputStream }
import java.io.OutputStream

/** API for specifying the output for a binary format like EPUB or PDF.
*
Expand All @@ -42,9 +42,6 @@ trait BinaryOutputOps[F[_]] {
*/
def toFile(name: String): Result = toFile(FilePath.parse(name))

@deprecated("use toFile(String) or toFile(FilePath)", "0.19.0")
def toFile(file: File): Result = toFile(FilePath.fromJavaFile(file))

/** Builder step that instructs the runtime to render
* to the specified file.
*
Expand Down
21 changes: 0 additions & 21 deletions io/src/main/scala/laika/io/ops/InputOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import cats.effect.Async
import laika.api.builder.OperationConfig
import laika.io.model.{ DirectoryInput, FileFilter, FilePath, InputTree, InputTreeBuilder }

import java.io.File
import scala.io.Codec

/** API for specifying the tree of character inputs for a parsing operation.
Expand Down Expand Up @@ -70,10 +69,6 @@ trait InputOps[F[_]] {
def fromDirectory(dir: FilePath)(implicit codec: Codec): Result =
fromDirectory(dir, DirectoryInput.hiddenFileFilter)(codec)

@deprecated("use fromDirectory(String) or fromDirectory(FilePath)", "0.19.0")
def fromDirectory(dir: File)(implicit codec: Codec): Result =
fromDirectory(FilePath.fromJavaFile(dir), DirectoryInput.hiddenFileFilter)(codec)

/** Builder step that instructs the runtime to parse files from the
* specified directory and its subdirectories.
*
Expand All @@ -84,13 +79,6 @@ trait InputOps[F[_]] {
def fromDirectory(dir: FilePath, exclude: FileFilter)(implicit codec: Codec): Result =
fromDirectories(Seq(dir), exclude)(codec)

@deprecated(
"use fromDirectory(String, FileFilter) or fromDirectory(FilePath, FileFilter)",
"0.19.0"
)
def fromDirectory(dir: File, exclude: FileFilter)(implicit codec: Codec): Result =
fromDirectories(Seq(FilePath.fromJavaFile(dir)), exclude)(codec)

/** Builder step that instructs the runtime to parse files from the
* specified directories and its subdirectories, merging them into
* a tree with a single root.
Expand All @@ -112,15 +100,6 @@ trait InputOps[F[_]] {
def fromDirectories(roots: Seq[FilePath], exclude: FileFilter)(implicit codec: Codec): Result =
fromInput(InputTree[F](exclude)(F).addDirectories(roots))

@deprecated(
"use fromDirectory(String) or fromDirectory(FilePath) using a relative path",
"0.19.0"
)
def fromWorkingDirectory(exclude: FileFilter = DirectoryInput.hiddenFileFilter)(implicit
codec: Codec
): Result =
fromDirectories(Seq(FilePath.parse(System.getProperty("user.dir"))), exclude)

/** Builder step that instructs the runtime to use the specified input builder for all parsing operations.
*
* This is the most generic way to specify the input as it allows to freely compose inputs from multiple
Expand Down
Loading