summaryrefslogtreecommitdiff
path: root/gemini/gemtext/types.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-04-29 18:10:50 -0600
committertjpcc <tjp@ctrl-c.club>2023-04-29 18:10:50 -0600
commit3ff04cf88571f8ed1aca78da4efe4929ad583ca6 (patch)
treebb2bc248f4049d3c7833a8d6661d17c91f03e642 /gemini/gemtext/types.go
parent9e09825537e4ae91119987f979ec4272d1727a2e (diff)
spartan =: prompt line support in gemtext
Diffstat (limited to 'gemini/gemtext/types.go')
-rw-r--r--gemini/gemtext/types.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/gemini/gemtext/types.go b/gemini/gemtext/types.go
index 440fed4..3965b11 100644
--- a/gemini/gemtext/types.go
+++ b/gemini/gemtext/types.go
@@ -16,6 +16,13 @@ const (
// The line is a LinkLine.
LineTypeLink
+ // LineTypePrompt is a spartan =: prompt line.
+ //
+ // =:[<ws>]<url>[<ws><label>][\r]\n
+ //
+ // The line is a PromptLine.
+ LineTypePrompt
+
// LineTypePreformatToggle switches the document between pre-formatted text or not.
//
// ```[<alt-text>][\r]\n
@@ -111,6 +118,25 @@ 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