All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dotty.tools.scaladoc.util.escape.scala Maven / Gradle / Ivy

There is a newer version: 3.6.0-RC1-bin-20240917-6e852d2-NIGHTLY
Show newest version
package dotty.tools.scaladoc.util

object Escape:
  def escapeUrl(url: String) = url
    .replace("#","%23")

  def escapeFilename(filename: String) =
    // from compiler/src/dotty/tools/dotc/util/NameTransformer.scala
    val escaped = filename
      .replace("~", "$tilde")
      .replace("=", "$eq")
      .replace("<", "$less")
      .replace(">", "$greater")
      .replace("!", "$bang")
      .replace("#", "$hash")
      .replace("%", "$percent")
      .replace("^", "$up")
      .replace("&", "$amp")
      .replace("|", "$bar")
      .replace("*", "$times")
      .replace("/", "$div")
      .replace("+", "$plus")
      .replace("-", "$minus")
      .replace(":", "$colon")
      .replace("\\", "$bslash")
      .replace("?", "$qmark")
      .replace("@", "$at")
    if escaped != filename then escaped + "$" else escaped




© 2015 - 2024 Weber Informatics LLC | Privacy Policy