summaryrefslogtreecommitdiff
path: root/gemini/gemtext/types.go
diff options
context:
space:
mode:
authortjp <tjp@ctrl-c.club>2024-01-04 12:49:44 -0700
committertjp <tjp@ctrl-c.club>2024-01-04 12:49:44 -0700
commit1352f915a62676959f4d7832e7763cbe2589b680 (patch)
tree49edb13355a9c8445901e107e4fcb26d2996b0b4 /gemini/gemtext/types.go
parent69c5336ea11aa51e2b47526f7d6108ac42ddcef1 (diff)
unify spartan prompt lines with gemini link lines
Diffstat (limited to 'gemini/gemtext/types.go')
-rw-r--r--gemini/gemtext/types.go24
1 files changed, 3 insertions, 21 deletions
diff --git a/gemini/gemtext/types.go b/gemini/gemtext/types.go
index 3965b11..71f3242 100644
--- a/gemini/gemtext/types.go
+++ b/gemini/gemtext/types.go
@@ -20,7 +20,7 @@ const (
//
// =:[<ws>]<url>[<ws><label>][\r]\n
//
- // The line is a PromptLine.
+ // The line is a LinkLine.
LineTypePrompt
// LineTypePreformatToggle switches the document between pre-formatted text or not.
@@ -104,9 +104,10 @@ type LinkLine struct {
raw []byte
url []byte
label []byte
+ typ LineType
}
-func (ll LinkLine) Type() LineType { return LineTypeLink }
+func (ll LinkLine) Type() LineType { return ll.typ }
func (ll LinkLine) Raw() []byte { return ll.raw }
func (ll LinkLine) String() string { return string(ll.raw) }
@@ -118,25 +119,6 @@ func (ll LinkLine) URL() string { return string(ll.url) }
// Label returns the label portion of the line.
func (ll LinkLine) Label() string { return string(ll.label) }
-// PromptLine is a Spartan =: prompt line.
-type PromptLine struct {
- raw []byte
- url []byte
- label []byte
-}
-
-func (pl PromptLine) Type() LineType { return LineTypePrompt }
-func (pl PromptLine) Raw() []byte { return pl.raw }
-func (pl PromptLine) String() string { return string(pl.raw) }
-
-// URL returns the original url portion of the line.
-//
-// It is not guaranteed to be a valid URL.
-func (pl PromptLine) URL() string { return string(pl.url) }
-
-// Label retrns the label portion of the line.
-func (pl PromptLine) Label() string { return string(pl.label) }
-
// PreformatToggleLine is a preformatted text toggle line.
type PreformatToggleLine struct {
raw []byte