pageref

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pageref parses the ways a caller can name a Confluence page — the URL as copied from the browser, the short link from the Share dialog, or a bare page ID — and builds page URLs from the pieces the API returns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChildPageURL

func ChildPageURL(site, parentWebUI, childID string) string

ChildPageURL builds the URL of a page sitting in the same space as the page parentWebUI links to, which every child of that page does. Child listings carry no web link of their own, so the parent's is what they are assembled from.

When parentWebUI yields no space key it falls back to the page-ID query form, which needs none: a URL built from an empty key is a 404, so the key never reaches spacePageURL unless it is real.

func HostOf

func HostOf(pageURL string) string

HostOf returns the host of a stored page URL, or "" if it has none. It is how `update` picks a profile from the URL its sidecar recorded.

func PageURL

func PageURL(site, webui, pageID string) string

PageURL builds a page's absolute URL from the site base and the relative web link the API returned. When the API returned no link, it falls back to the page-ID query form, which needs no space key.

func SpaceKeyOf

func SpaceKeyOf(webui string) string

SpaceKeyOf returns the space key embedded in the relative web link the API returns for a page, or "" when the link is empty or not in that shape. Every key the API has been observed to emit — including the ~accountid form of a personal space — is made of characters that SpacePageURL's path escaping leaves alone, so the captured segment is returned undecoded.

func SpacePageURL

func SpacePageURL(site, spaceKey, pageID string) string

SpacePageURL builds a page's URL from its space key. The result is in the form Parse accepts, so a link built with it can be fed straight back to `cflio read`.

Types

type Ref

type Ref struct {
	PageID string
	Host   string
}

Ref is a parsed page reference. Host is empty when the caller passed a bare page ID, in which case there is nothing to auto-select a profile from and the default profile applies.

func Parse

func Parse(arg string) (Ref, error)

Parse accepts a page URL, a short link, or a bare page ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL