refactor: rename padLeft to indent
This commit is contained in:
parent
add8e9a714
commit
38632a992d
copret/src
|
@ -3,31 +3,32 @@ package de.qwertyuiop.copret
|
|||
object syntax extends Templates with TerminalSyntax with SlideSyntax:
|
||||
import Format.*
|
||||
extension (str: String)
|
||||
def code(using theme: Theme) = Format.ticks.replaceAllIn(str, m => theme.style("code")("$1").render)
|
||||
def text(using Theme) = Paragraph(str)
|
||||
def par(using Theme) = Paragraph(str.stripMargin.code.padLeft(2))
|
||||
def code(using theme: Theme) = Format.ticks.replaceAllIn(str, m => theme.style("code")("$1").render)
|
||||
def text(using Theme) = Paragraph(str)
|
||||
def par(using Theme) = Paragraph(str.stripMargin.code.indent(2))
|
||||
def style(key: String, default: fansi.Attrs)(using theme: Theme) = theme.style(key, default)(str)
|
||||
|
||||
def centered = center(str)
|
||||
def block = centerBlock(str)
|
||||
def right = alignRight(str)
|
||||
def right(padding: Int) = alignRight(str, padding)
|
||||
def padLeft(padding: Int) =
|
||||
def centered = center(str)
|
||||
def block = centerBlock(str)
|
||||
def right = alignRight(str)
|
||||
def right(padding: Int) = alignRight(str, padding)
|
||||
def indent(padding: Int) =
|
||||
val pad = " " * padding
|
||||
str.linesIterator.map(pad + _).mkString("\n")
|
||||
|
||||
def blue = fansi.Color.Blue(str)
|
||||
def green = fansi.Color.Green(str)
|
||||
def blue = fansi.Color.Blue(str)
|
||||
def green = fansi.Color.Green(str)
|
||||
def yellow = fansi.Color.Yellow(str)
|
||||
def red = fansi.Color.Red(str)
|
||||
def red = fansi.Color.Red(str)
|
||||
|
||||
extension (str: fansi.Str)
|
||||
def text(using Theme) = Paragraph(str.toString)
|
||||
def text(using Theme) = Paragraph(str.toString)
|
||||
def style(key: String, default: fansi.Attrs)(using theme: Theme) = theme.style(key, default)(str)
|
||||
|
||||
def blue = fansi.Color.Blue(str)
|
||||
def green = fansi.Color.Green(str)
|
||||
def blue = fansi.Color.Blue(str)
|
||||
def green = fansi.Color.Green(str)
|
||||
def yellow = fansi.Color.Yellow(str)
|
||||
def red = fansi.Color.Red(str)
|
||||
def red = fansi.Color.Red(str)
|
||||
end syntax
|
||||
|
||||
/* vim:set tw=120: */
|
||||
|
|
|
@ -32,7 +32,8 @@ trait Templates:
|
|||
),
|
||||
)
|
||||
|
||||
lazy val --- = Paragraph(("═" * columns).yellow.toString)
|
||||
lazy val --- = Paragraph("\n" + ("-" * columns).yellow.toString + "\n")
|
||||
lazy val === = Paragraph("\n" + ("═" * columns).yellow.toString + "\n")
|
||||
end Templates
|
||||
|
||||
/* vim:set tw=120: */
|
||||
|
|
Loading…
Reference in a new issue