Documentation ¶
Index ¶
- Constants
- Variables
- func Rtos(runes ...rune) string
- type AttributeReferenceRxres
- type DoubleQuotedMultiRxres
- type DoubleQuotedRxres
- type EmailInlineMacroRxres
- type FootnoteInlineMacroRxres
- type ImageInlineMacroRxres
- type IndextermInlineMacroRxres
- type InlineAnchorRxres
- type InlineBiblioAnchorRxres
- type KbdBtnInlineMacroRxres
- type KbdDelimiterRxres
- type LinkInlineMacroRxres
- type LinkInlineRxres
- type MathInlineMacroRxres
- type MenuInlineMacroRxres
- type MenuInlineRxres
- type PassInlineLiteralRxres
- type PassInlineMacroRxres
- func (pr *PassInlineMacroRxres) HasPassSub() bool
- func (pr *PassInlineMacroRxres) HasPassText() bool
- func (pr *PassInlineMacroRxres) InlineSub() string
- func (pr *PassInlineMacroRxres) InlineText() string
- func (pr *PassInlineMacroRxres) PassSub() string
- func (pr *PassInlineMacroRxres) PassText() string
- type Qualifier
- type Replacement
- type Reres
- func (rr *Reres) FirstChar() uint8
- func (rr *Reres) FullMatch() string
- func (rr *Reres) Group(i int) string
- func (rr *Reres) HasAnyMatch() bool
- func (rr *Reres) HasGroup(j int) bool
- func (rr *Reres) HasNext() bool
- func (rr *Reres) IsEscaped() bool
- func (rr *Reres) Next()
- func (rr *Reres) Prefix() string
- func (rr *Reres) ResetNext()
- func (r *Reres) String() string
- func (rr *Reres) Suffix() string
- func (rr *Reres) Text() string
- type XrefInlineMacroRxres
Constants ¶
const ( CC_ALPHA = `a-zA-Z` CC_ALNUM = `a-zA-Z0-9` CC_BLANK = `[ \t]` // non-blank character CC_GRAPH = `[\x21-\x7E]` CC_EOL = `(?=\n|$)` )
Variables ¶
var ADMONITION_STYLES utils.Arr = []string{"NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"}
var AdmonitionParagraphRx, _ = regexp.Compile(fmt.Sprintf("^(%v):%v", ADMONITION_STYLES.Mult("|"), CC_BLANK))
Matches an admonition label at the start of a paragraph.
Examples NOTE: Just a little note. TIP: Don't forget!
var AttributeReferenceRx, _ = regexp.Compile(`(\\)?\{((set|counter2?):.+?|\w+(?:[\-]\w+)*)(\\)?\}`)
Matches an inline attribute reference.
Examples
{foo} {counter:pcount:1} {set:foo:bar} {set:name!} AttributeReferenceRx = /(\\)?\{((set|counter2?):.+?|\w+(?:[\-]\w+)*)(\\)?\}/
var DoubleQuotedMultiRx, _ = regexp.Compile(`(?s)^("|)(.*?)("|)$`)
Matches multiple lines of text enclosed in double quotes,
capturing the quote char and text.
# Examples # "I am a run-on sentence and I like # to take up multiple lines and I # still want to be matched."
DoubleQuotedMultiRx = /^("|)(.*)\1$/
var DoubleQuotedRx, _ = regexp.Compile(`(?m)^("|)(.*?)("|)$`)
Matches a single-line of text enclosed in double quotes,
capturing the quote char and text.
Examples "Who goes there?"
DoubleQuotedRx = /^("|)(.*)\1$/
var EmailInlineMacroRx, _ = regexp.Compile(`([\\>:\/])?\w[\w.%+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,4}`)
var EolRx, _ = regexp.Compile(`[\r\n]+`)
var EscapedBracketRx, _ = regexp.Compile(`\\\]`)
Detects escaped brackets
var FootnoteInlineMacroRx, _ = regexp.Compile(`\\?(footnote(?:ref)?):\[(.*?[^\\])\]`)
var ImageInlineMacroRx, _ = regexp.Compile(`\\?(?:image|icon):([^:\[][^\[]*)\[((?:\\\]|[^\]])*?)\]`)
var IndextermInlineMacroRx, _ = regexp.Compile(`\\?(?:(indexterm2?):\[(.*?[^\\])\]|\(\((.+?)\)\)([^\)]|$))`)
var InlineAnchorRx, _ = regexp.Compile(`\\?(?:\[\[([a-zA-Z:_][\w:.-]*)(?:,[\t ]*(\S.*?))?\]\]|anchor:(\S+)\[(.*?[^\\])?\])`)
var InlineBiblioAnchorRx, _ = regexp.Compile(`\\?\[\[\[([\w:][\w:.-]*?)\]\]\]`)
var KbdBtnInlineMacroRx, _ = regexp.Compile(`\\?(?:kbd|btn):\[((?:\\\]|[^\]])+?)\]`)
Matches either the kbd or btn inline macro. Examples
kbd:[F3] kbd:[Ctrl+Shift+T] kbd:[Ctrl+\]] kbd:[Ctrl,T] btn:[Save]
KbdBtnInlineMacroRx = /\\?(?:kbd|btn):\[((?:\\\]|[^\]])+?)\]/
var KbdDelimiterRx, _ = regexp.Compile(`(?:\+|,)([ \t]*[^ \t])`)
Matches the delimiter used for kbd value.
Examples
Ctrl + Alt+T Ctrl,T
KbdDelimiterRx = /(?:\+|,)(?=#{CC_BLANK}*[^\1])/
var LinkInlineMacroRx, _ = regexp.Compile(`\\?(?:link|mailto):([^\s\[]+)(?:\[((?:\\\]|[^\]])*?)\])`)
Match a link or e-mail inline macro. Examples link:path[label] mailto:doc.writer@example.com[]
LinkInlineMacroRx = /\\?(?:link|mailto):([^\s\[]+)(?:\[((?:\\\]|[^\]])*?)\])/
var LinkInlineRx, _ = regexp.Compile(`(^|link:|<|[\s>\(\)\[\];])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*[^\s.,\[\]<])(?:\[((?:\\\]|[^\]])*?)\])?`)
Matches an implicit link and some of the link inline macro. Examples http://github.com http://github.com[GitHub] FIXME revisit! the main issue is we need different rules for implicit vs explicit
LinkInlineRx = %r{(^|link:|<|[\s>\(\)\[\];])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*[^\s.,\[\]<])(?:\[((?:\\\]|[^\]])*?)\])?}
var MathInlineMacroRx, _ = regexp.Compile(`(?sm)\\?((?:latex|ascii)?math):([a-z,]*)\[(.*?[^\\])\]`)
Matches a math inline macro, which may span multiple lines.
Examples
math:[x != 0] asciimath:[x != 0] latexmath:[\sqrt{4} = 2]
MathInlineMacroRx = /\\?((?:latex|ascii)?math):([a-z,]*)\[(.*?[^\\])\]/m
var MenuInlineMacroRx, _ = regexp.Compile(`(?sm)\\?menu:(\w|\w.*?\S)\[[ \t]*(.+?)?\]`)
Matches a menu inline macro.
# Examples menu:File[New...] menu:View[Page Style > No Style] menu:View[Page Style, No Style] MenuInlineMacroRx = /\\?menu:(\w|\w.*?\S)\[#{CC_BLANK}*(.+?)?\]/
var MenuInlineRx, _ = regexp.Compile(`(?sm)\\?"(\w[^"]*?[ \t]*>[ \t]*[^" \t][^"]*)"`)
# Matches an implicit menu inline macro. Examples "File > New..."
MenuInlineRx = /\\?"(\w[^"]*?#{CC_BLANK}*>#{CC_BLANK}*[^" \t][^"]*)"/
var ORDERED_LIST_KEYWORDS = map[string]rune{
"loweralpha": 'a',
"lowerroman": 'i',
"upperalpha": 'A',
"upperroman": 'I',
}
var PassInlineLiteralRx, _ = regexp.Compile("(?sm)(^|[^`\\w])(?:\\[([^\\]]+?)\\])?(\\\\?`([^`\\s]|[^`\\s].*?\\S)`)([^`\\w])")
var PassInlineMacroRx, _ = regexp.Compile(`(?s)\\?(?:(\+{3})(.*?)\+{3}|(\${2})(.*?)\${2}|pass:([a-z,]*)\[(.*?[^\\])\])`)
Matches several variants of the passthrough inline macro,
which may span multiple lines.
Examples +++text+++ $$text$$ pass:quotes[text]
http://stackoverflow.com/questions/6770898/unknown-escape-sequence-error-in-go
var Replacements []*Replacement = iniReplacements()
var UriSniffRx, _ = regexp.Compile(fmt.Sprintf("^([%v][%v.+-]*:/{0,2}).*", CC_ALPHA, CC_ALNUM))
Detects strings that resemble URIs.
Examples http://domain https://domain data:info
var UriTerminator, _ = regexp.Compile(`[);:]$`)
Detects the end of an implicit URI in the text Examples (http://google.com) >http://google.com< (See http://google.com):
UriTerminator = /[);:]$/
var XrefInlineMacroRx, _ = regexp.Compile(`(?s)\\?(?:<<([\w":].*?)>>|xref:([\w":].*?)\[(.*?)\])`)
Functions ¶
Types ¶
type AttributeReferenceRxres ¶
type AttributeReferenceRxres struct {
*Reres
}
func NewAttributeReferenceRxres ¶
func NewAttributeReferenceRxres(s string) *AttributeReferenceRxres
Results for AttributeReferenceRx
func (*AttributeReferenceRxres) Directive ¶
func (arr *AttributeReferenceRxres) Directive() string
Return directive of the reference, as 'counter' in '{counter:pcount:1}'
func (*AttributeReferenceRxres) PostEscaped ¶
func (arr *AttributeReferenceRxres) PostEscaped() bool
Return true if last group is non empty and include an '\'
func (*AttributeReferenceRxres) PreEscaped ¶
func (arr *AttributeReferenceRxres) PreEscaped() bool
Return true if first group is non empty and include an '\'
func (*AttributeReferenceRxres) Reference ¶
func (arr *AttributeReferenceRxres) Reference() string
Return reference, as in 'counter:pcount:1' in {counter:pcount:1}'
type DoubleQuotedMultiRxres ¶
type DoubleQuotedMultiRxres struct {
*Reres
}
func NewDoubleQuotedMultiRxres ¶
func NewDoubleQuotedMultiRxres(s string) *DoubleQuotedMultiRxres
Results for DoubleQuotedMultiRx
func (*DoubleQuotedMultiRxres) DQMQuote ¶
func (dqr *DoubleQuotedMultiRxres) DQMQuote() string
Return quote used for 'xxx' or '"yyy"'
func (*DoubleQuotedMultiRxres) DQMText ¶
func (dqr *DoubleQuotedMultiRxres) DQMText() string
Return quoted text in 'xxx' or '"yyy"'
type DoubleQuotedRxres ¶
type DoubleQuotedRxres struct {
*Reres
}
func NewDoubleQuotedRxres ¶
func NewDoubleQuotedRxres(s string) *DoubleQuotedRxres
Results for DoubleQuotedRx
func (*DoubleQuotedRxres) DQQuote ¶
func (dqr *DoubleQuotedRxres) DQQuote() string
Return quote used for 'xxx' or '"yyy"'
func (*DoubleQuotedRxres) DQText ¶
func (dqr *DoubleQuotedRxres) DQText() string
Return quoted text in 'xxx' or '"yyy"'
type EmailInlineMacroRxres ¶
type EmailInlineMacroRxres struct {
*Reres
}
func NewEmailInlineMacroRxres ¶
func NewEmailInlineMacroRxres(s string) *EmailInlineMacroRxres
Results for EmailInlineMacroRx
func (*EmailInlineMacroRxres) EmailLead ¶
func (eimr *EmailInlineMacroRxres) EmailLead() string
Return lead of the macro in '>xx:@yyy.com'
type FootnoteInlineMacroRxres ¶
type FootnoteInlineMacroRxres struct {
*Reres
}
func NewFootnoteInlineMacroRxres ¶
func NewFootnoteInlineMacroRxres(s string) *FootnoteInlineMacroRxres
Results for FootnoteInlineMacroRx
func (*FootnoteInlineMacroRxres) FootnotePrefix ¶
func (fimr *FootnoteInlineMacroRxres) FootnotePrefix() string
Return prefix 'footnote' of the macro in 'footnote:[xxx]'
func (*FootnoteInlineMacroRxres) FootnoteText ¶
func (fimr *FootnoteInlineMacroRxres) FootnoteText() string
Return text 'xxx' of the macro in 'footnote:[xxx]'
type ImageInlineMacroRxres ¶
type ImageInlineMacroRxres struct {
*Reres
}
func NewImageInlineMacroRxres ¶
func NewImageInlineMacroRxres(s string) *ImageInlineMacroRxres
Results for ImageInlineMacroRx
func (*ImageInlineMacroRxres) ImageAttributes ¶
func (iimr *ImageInlineMacroRxres) ImageAttributes() string
Return attributes of the macro in 'image:target[attr1 attr2]'
func (*ImageInlineMacroRxres) ImageTarget ¶
func (iimr *ImageInlineMacroRxres) ImageTarget() string
Return target of the macro in 'image:target[attr1 attr2]'
type IndextermInlineMacroRxres ¶
type IndextermInlineMacroRxres struct {
*Reres
}
func NewIndextermInlineMacroRxres ¶
func NewIndextermInlineMacroRxres(s string) *IndextermInlineMacroRxres
Results for IndextermInlineMacroRx
func (*IndextermInlineMacroRxres) IndextermMacroName ¶
func (itimr *IndextermInlineMacroRxres) IndextermMacroName() string
Return name indexterm of the macro in 'indexterm:[Tigers,Big cats]'
func (*IndextermInlineMacroRxres) IndextermTextInBrackets ¶
func (itimr *IndextermInlineMacroRxres) IndextermTextInBrackets() string
Return text in brackets of the macro in '((Tigers))'
func (*IndextermInlineMacroRxres) IndextermTextOrTerms ¶
func (itimr *IndextermInlineMacroRxres) IndextermTextOrTerms() string
Return terms of the macro in 'indexterm:[Tigers,Big cats]'
type InlineAnchorRxres ¶
type InlineAnchorRxres struct {
*Reres
}
func NewInlineAnchorRxres ¶
func NewInlineAnchorRxres(s string) *InlineAnchorRxres
Results for InlineAnchorRx
func (*InlineAnchorRxres) BibAnchorId ¶
func (iar *InlineAnchorRxres) BibAnchorId() string
Return id of the macro in '[[idname]]' or 'anchor:idname[]'
func (*InlineAnchorRxres) BibAnchorText ¶
func (iar *InlineAnchorRxres) BibAnchorText() string
Return text of the macro in '[[idname,Reference Text]]' or 'anchor:idname[Reference Text]'
type InlineBiblioAnchorRxres ¶
type InlineBiblioAnchorRxres struct {
*Reres
}
func NewInlineBiblioAnchorRxres ¶
func NewInlineBiblioAnchorRxres(s string) *InlineBiblioAnchorRxres
Results for InlineBiblioAnchorRx
func (*InlineBiblioAnchorRxres) BibId ¶
func (ibar *InlineBiblioAnchorRxres) BibId() string
Return id of the macro in '[[[id]]]'
type KbdBtnInlineMacroRxres ¶
type KbdBtnInlineMacroRxres struct {
*Reres
}
func NewKbdBtnInlineMacroRxres ¶
func NewKbdBtnInlineMacroRxres(s string) *KbdBtnInlineMacroRxres
Results for KbdBtnInlineMacroRx
func (*KbdBtnInlineMacroRxres) Key ¶
func (kbimr *KbdBtnInlineMacroRxres) Key() string
Return key of the macro xxx in ':[xxx]'
type KbdDelimiterRxres ¶
type KbdDelimiterRxres struct {
*Reres
}
func NewKbdDelimiterRxres ¶
func NewKbdDelimiterRxres(s string) *KbdDelimiterRxres
Results for KbdDelimiterRx
type LinkInlineMacroRxres ¶
type LinkInlineMacroRxres struct {
*Reres
}
func NewLinkInlineMacroRxres ¶
func NewLinkInlineMacroRxres(s string) *LinkInlineMacroRxres
Results for LinkInlineMacroRx
func (*LinkInlineMacroRxres) LinkInlineTarget ¶
func (limr *LinkInlineMacroRxres) LinkInlineTarget() string
Return 'xxx' in 'link:xxx[yyy]'
func (*LinkInlineMacroRxres) LinkInlineText ¶
func (limr *LinkInlineMacroRxres) LinkInlineText() string
Return 'yyy' in 'link:xxx[yyy]'
type LinkInlineRxres ¶
type LinkInlineRxres struct {
*Reres
}
func NewLinkInlineRxres ¶
func NewLinkInlineRxres(s string) *LinkInlineRxres
Results for LinkInlineRx
func (*LinkInlineRxres) IsLinkEscaped ¶
func (lir *LinkInlineRxres) IsLinkEscaped() bool
Return true if '\' found in 'link:\http:xxx[yyy]'
func (*LinkInlineRxres) LinkPrefix ¶
func (lir *LinkInlineRxres) LinkPrefix() string
Return 'link:' in 'link:http:xxx[yyy]'
func (*LinkInlineRxres) LinkTarget ¶
func (lir *LinkInlineRxres) LinkTarget() string
Return 'xxx' in 'link:http:xxx[yyy]'
func (*LinkInlineRxres) LinkText ¶
func (lir *LinkInlineRxres) LinkText() string
Return 'yyy' in 'link:http:xxx[yyy]'
type MathInlineMacroRxres ¶
type MathInlineMacroRxres struct {
*Reres
}
func NewMathInlineMacroRxres ¶
func NewMathInlineMacroRxres(s string) *MathInlineMacroRxres
Results for MathInlineMacroRx
func (*MathInlineMacroRxres) MathSub ¶
func (mimr *MathInlineMacroRxres) MathSub() string
Return sub 'xx' in 'math:xx[yyy]'
func (*MathInlineMacroRxres) MathText ¶
func (mimr *MathInlineMacroRxres) MathText() string
Return text 'yyy' in 'math:xx[yyy]'
func (*MathInlineMacroRxres) MathType ¶
func (mimr *MathInlineMacroRxres) MathType() string
Return type 'math' in 'math:xx[yyy]'
type MenuInlineMacroRxres ¶
type MenuInlineMacroRxres struct {
*Reres
}
func NewMenuInlineMacroRxres ¶
func NewMenuInlineMacroRxres(s string) *MenuInlineMacroRxres
Results for KbdBtnInlineMacroRx
func (*MenuInlineMacroRxres) MenuItems ¶
func (mimr *MenuInlineMacroRxres) MenuItems() string
Return items of the macro xxx in 'menu:name[xxx]'
func (*MenuInlineMacroRxres) MenuName ¶
func (mimr *MenuInlineMacroRxres) MenuName() string
Return name of the macro in 'menu:name[xxx]'
type MenuInlineRxres ¶
type MenuInlineRxres struct {
*Reres
}
func NewMenuInlineRxres ¶
func NewMenuInlineRxres(s string) *MenuInlineRxres
Results for MenuInlineRx
func (*MenuInlineRxres) MenuInput ¶
func (mir *MenuInlineRxres) MenuInput() string
Return input of the macro in '"File > New"'
type PassInlineLiteralRxres ¶
type PassInlineLiteralRxres struct {
*Reres
}
func NewPassInlineLiteralRxres ¶
func NewPassInlineLiteralRxres(s string) *PassInlineLiteralRxres
Results for PassInlineLiteralRx
func (*PassInlineLiteralRxres) Attributes ¶
func (pilr *PassInlineLiteralRxres) Attributes() string
func (*PassInlineLiteralRxres) FirstChar ¶
func (pilr *PassInlineLiteralRxres) FirstChar() string
func (*PassInlineLiteralRxres) Literal ¶
func (pilr *PassInlineLiteralRxres) Literal() string
func (*PassInlineLiteralRxres) LiteralText ¶
func (pilr *PassInlineLiteralRxres) LiteralText() string
type PassInlineMacroRxres ¶
type PassInlineMacroRxres struct {
*Reres
}
func NewPassInlineMacroRxres ¶
func NewPassInlineMacroRxres(s string) *PassInlineMacroRxres
Results for PassInlineMacroRx
func (*PassInlineMacroRxres) HasPassSub ¶
func (pr *PassInlineMacroRxres) HasPassSub() bool
Check if has sub 'xx' in 'pass:xx[yyy]'
func (*PassInlineMacroRxres) HasPassText ¶
func (pr *PassInlineMacroRxres) HasPassText() bool
Check if has text 'yyy' in 'pass:xx[yyy]'
func (*PassInlineMacroRxres) InlineSub ¶
func (pr *PassInlineMacroRxres) InlineSub() string
Return text 'xx' in 'xxyyyxx'
func (*PassInlineMacroRxres) InlineText ¶
func (pr *PassInlineMacroRxres) InlineText() string
Return text 'yyy' in 'xxyyyxx'
func (*PassInlineMacroRxres) PassSub ¶
func (pr *PassInlineMacroRxres) PassSub() string
Return sub 'xx' in 'pass:xx[yyy]'
func (*PassInlineMacroRxres) PassText ¶
func (pr *PassInlineMacroRxres) PassText() string
Return text 'yyy' in 'pass:xx[yyy]'
type Replacement ¶
type Replacement struct {
// contains filtered or unexported fields
}
func (*Replacement) Bounding ¶
func (r *Replacement) Bounding() bool
func (*Replacement) EndsWithLookAhead ¶
func (r *Replacement) EndsWithLookAhead() bool
func (*Replacement) Leading ¶
func (r *Replacement) Leading() bool
func (*Replacement) None ¶
func (r *Replacement) None() bool
func (*Replacement) Repl ¶
func (r *Replacement) Repl() string
func (*Replacement) Reres ¶
func (r *Replacement) Reres(text string) *Reres
func (*Replacement) Rx ¶
func (r *Replacement) Rx() *regexp.Regexp
type Reres ¶
type Reres struct {
// contains filtered or unexported fields
}
Encapsulate a regex and a string,
for managing results from FindAllStringSubmatchIndex
func NewReresLAGroup ¶
Build new result from FindAllStringSubmatchIndex on a string,
validated by last group being a lookahead after each match
func NewReresLAQual ¶
Build new result from FindAllStringSubmatchIndex on a string,
validated by last group being a lookahead after each match, if that last group match qualifies
type XrefInlineMacroRxres ¶
type XrefInlineMacroRxres struct {
*Reres
}
func NewXrefInlineMacroRxres ¶
func NewXrefInlineMacroRxres(s string) *XrefInlineMacroRxres
Results for XrefInlineMacroRx
func (*XrefInlineMacroRxres) XId ¶
func (ximr *XrefInlineMacroRxres) XId() string
Return id of '<<id,reftext>>' or xref:id[reftext]'
func (*XrefInlineMacroRxres) XrefText ¶
func (ximr *XrefInlineMacroRxres) XrefText() string
Return reftext of '<<id,reftext>>' or xref:id[reftext]'