Prevent other packages from implementing Line
This commit is contained in:
parent
5f4b225f0d
commit
e9db805160
43
text.go
43
text.go
@ -10,6 +10,7 @@ import (
|
|||||||
// Line represents a line of a Gemini text response.
|
// Line represents a line of a Gemini text response.
|
||||||
type Line interface {
|
type Line interface {
|
||||||
String() string
|
String() string
|
||||||
|
line() // private function to prevent other packages from implementing Line
|
||||||
}
|
}
|
||||||
|
|
||||||
// A link line.
|
// A link line.
|
||||||
@ -17,14 +18,30 @@ type LineLink struct {
|
|||||||
URL string
|
URL string
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
type LinePreformattingToggle string // A preformatting toggle line.
|
|
||||||
type LinePreformattedText string // A preformatted text line.
|
// A preformatting toggle line.
|
||||||
type LineHeading1 string // A first-level heading line.
|
type LinePreformattingToggle string
|
||||||
type LineHeading2 string // A second-level heading line.
|
|
||||||
type LineHeading3 string // A third-level heading line.
|
// A preformatted text line.
|
||||||
type LineListItem string // An unordered list item line.
|
type LinePreformattedText string
|
||||||
type LineQuote string // A quote line.
|
|
||||||
type LineText string // A text line.
|
// A first-level heading line.
|
||||||
|
type LineHeading1 string
|
||||||
|
|
||||||
|
// A second-level heading line.
|
||||||
|
type LineHeading2 string
|
||||||
|
|
||||||
|
// A third-level heading line.
|
||||||
|
type LineHeading3 string
|
||||||
|
|
||||||
|
// An unordered list item line.
|
||||||
|
type LineListItem string
|
||||||
|
|
||||||
|
// A quote line.
|
||||||
|
type LineQuote string
|
||||||
|
|
||||||
|
// A text line.
|
||||||
|
type LineText string
|
||||||
|
|
||||||
func (l LineLink) String() string {
|
func (l LineLink) String() string {
|
||||||
if l.Name != "" {
|
if l.Name != "" {
|
||||||
@ -57,6 +74,16 @@ func (l LineText) String() string {
|
|||||||
return string(l)
|
return string(l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l LineLink) line() {}
|
||||||
|
func (l LinePreformattingToggle) line() {}
|
||||||
|
func (l LinePreformattedText) line() {}
|
||||||
|
func (l LineHeading1) line() {}
|
||||||
|
func (l LineHeading2) line() {}
|
||||||
|
func (l LineHeading3) line() {}
|
||||||
|
func (l LineListItem) line() {}
|
||||||
|
func (l LineQuote) line() {}
|
||||||
|
func (l LineText) line() {}
|
||||||
|
|
||||||
// Text represents a Gemini text response.
|
// Text represents a Gemini text response.
|
||||||
type Text []Line
|
type Text []Line
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user