-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc.toHtmlSnippet based on Html (#2025)
* Doc.toHtmlSnippet based on Html * Fix imports
- Loading branch information
Showing
5 changed files
with
127 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package zio.http.html | ||
|
||
private[html] sealed trait EncodingState { | ||
def nextElemSeparator: String | ||
def inner: EncodingState | ||
} | ||
|
||
object EncodingState { | ||
case object NoIndentation extends EncodingState { | ||
val nextElemSeparator: String = "" | ||
def inner: EncodingState = NoIndentation | ||
} | ||
|
||
final case class Indentation(current: Int, spaces: Int) extends EncodingState { | ||
lazy val nextElemSeparator: String = "\n" + (" " * (current * spaces)) | ||
def inner: EncodingState = Indentation(current + 1, spaces) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters