diff options
Diffstat (limited to 'gemini/gemtext/types.go')
-rw-r--r-- | gemini/gemtext/types.go | 26 |
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 |