references

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAllMentionsMarkdown

func FindAllMentionsMarkdown(content string) []string

FindAllMentionsMarkdown matches mention patterns in given content and returns a list of found unvalidated user names **not including** the @ prefix.

func IsXrefActionable added in v1.11.0

func IsXrefActionable(ref *RenderizableReference, extTracker, alphaNum bool) bool

IsXrefActionable returns true if the xref action is actionable (i.e. produces a result when resolved)

Types

type IssueReference

type IssueReference struct {
	Index   int64
	Owner   string
	Name    string
	Action  XRefAction
	TimeLog string
}

IssueReference contains an unverified cross-reference to a local issue or pull request

func FindAllIssueReferences

func FindAllIssueReferences(content string) []IssueReference

FindAllIssueReferences returns a list of unvalidated references found in a string.

func FindAllIssueReferencesMarkdown

func FindAllIssueReferencesMarkdown(content string) []IssueReference

FindAllIssueReferencesMarkdown strips content from markdown markup and returns a list of unvalidated references found in it.

type RefSpan

type RefSpan struct {
	Start int
	End   int
}

RefSpan is the position where the reference was found within the parsed text

func FindAllMentionsBytes

func FindAllMentionsBytes(content []byte) []RefSpan

FindAllMentionsBytes matches mention patterns in given content and returns a list of locations for the unvalidated user names, including the @ prefix.

func FindFirstMentionBytes

func FindFirstMentionBytes(content []byte) (bool, RefSpan)

FindFirstMentionBytes matches the first mention in then given content and returns the location of the unvalidated user name, including the @ prefix.

type RenderizableReference

type RenderizableReference struct {
	Issue          string
	Owner          string
	Name           string
	IsPull         bool
	RefLocation    *RefSpan
	Action         XRefAction
	ActionLocation *RefSpan
}

RenderizableReference contains an unverified cross-reference to with rendering information The IsPull member means that a `!num` reference was used instead of `#num`. This kind of reference is used to make pulls available when an external issue tracker is used. Otherwise, `#` and `!` are completely interchangeable.

func FindRenderizableReferenceAlphanumeric

func FindRenderizableReferenceAlphanumeric(content string) (bool, *RenderizableReference)

FindRenderizableReferenceAlphanumeric returns the first alphanumeric unvalidated references found in a string.

func FindRenderizableReferenceNumeric

func FindRenderizableReferenceNumeric(content string, prOnly bool) (bool, *RenderizableReference)

FindRenderizableReferenceNumeric returns the first unvalidated reference found in a string.

type XRefAction

type XRefAction int64

XRefAction represents the kind of effect a cross reference has once is resolved

const (
	// XRefActionNone means the cross-reference is simply a comment
	XRefActionNone XRefAction = iota // 0
	// XRefActionCloses means the cross-reference should close an issue if it is resolved
	XRefActionCloses // 1
	// XRefActionReopens means the cross-reference should reopen an issue if it is resolved
	XRefActionReopens // 2
	// XRefActionNeutered means the cross-reference will no longer affect the source
	XRefActionNeutered // 3
)

func (XRefAction) String added in v1.16.0

func (a XRefAction) String() string

Jump to

Keyboard shortcuts

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