references

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 7 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.

Types

type IssueReference

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

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
	RefLocation    *RefSpan
	Action         XRefAction
	ActionLocation *RefSpan
}

RenderizableReference contains an unverified cross-reference to with rendering information

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) (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
)

Jump to

Keyboard shortcuts

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