Documentation
¶
Index ¶
- Variables
- func ApplyToAText(cs string, atext apool.AText, pool apool.APool) apool.AText
- func ApplyToAttribution(cs string, astr string, pool apool.APool) string
- func ApplyToText(cs string, text string) (*string, error)
- func ApplyZip(in1 string, in2 string, callback func(*Op, *Op) Op) string
- func AttribsFromString(str string, pool apool.APool) []apool.Attribute
- func AttribsToString(attribs []apool.Attribute, pool *apool.APool) (*string, error)
- func AttributeTester(attribPair apool.Attribute, pool *apool.APool) func(arg *string) bool
- func CheckRep(cs string) (*string, error)
- func CloneAText(atext apool.AText) apool.AText
- func Compose(cs1 string, cs2 string, pool apool.APool) string
- func ComposeAttributes(attribs1 string, attribs2 string, resultIsMutation bool, pool apool.APool) string
- func DecodeAttribString(s string) ([]int, error)
- func DeserializeOps(ops string) (*[]Op, error)
- func Follow(c string, rebasedChangeset string, reverseInsertOrder bool, pool *apool.APool) string
- func HasAttrib(attribs AttributeMap) bool
- func Identity(n int) string
- func JoinAttributionLines(theAlines []string) string
- func MakeAText(str string, attribs *string) apool.AText
- func MakeAttribution(text string) string
- func MakeSplice(orig string, start int, ndel int, ins string, attribs *string, ...) (string, error)
- func MoveOpsToNewPool(cs string, oldPool *apool.APool, newPool *apool.APool) string
- func OldLen(cs string) int
- func OpsFromAText(atext apool.AText) *[]Op
- func Pack(oldLen int, newLen int, opStr string, bank string) string
- func SplitAttributionLines(attrOps string, text string) ([]string, error)
- func StringToAttrib(attrib []string) (*apool.Attribute, error)
- type AttributeManager
- type AttributeMap
- func (a *AttributeMap) Get(key string) string
- func (a *AttributeMap) Has(key string) bool
- func (a *AttributeMap) Set(key string, value string) *AttributeMap
- func (a *AttributeMap) Size() int
- func (a *AttributeMap) String() string
- func (a *AttributeMap) Update(entries []apool.Attribute, emptyValueISDelete *bool) *AttributeMap
- func (a *AttributeMap) UpdateFromString(key string, emptyValueIsDelete *bool) *AttributeMap
- type Builder
- func (b Builder) Insert(text string, attribs KeepArgs, pool *apool.APool) Builder
- func (b Builder) Keep(N int, L int, attribs KeepArgs, pool apool.APool) Builder
- func (b Builder) KeepText(text string, attribs KeepArgs, pool *apool.APool) Builder
- func (b Builder) Remove(N, L int) Builder
- func (b Builder) ToString() string
- type Changeset
- type Iterator
- type KeepArgs
- type MergingOpAssembler
- type Op
- type OpAssembler
- type PrepareForWireStruct
- type SmartOpAssembler
- type StringAssembler
- type StringIterator
Constants ¶
This section is empty.
Variables ¶
View Source
var DEFAULT_LINE_ATTRIBUTES = []string{
"author", "lmkr", "insertorder", "start",
}
Some of these attributes are kept for compatibility purposes. Not sure if we need all of them
View Source
var LineAttributes = []string{lineMarkerAttribute, "list"}
If one of these attributes are set to the first character of a line it is considered as a line attribute marker i.e. attributes set on this marker are applied to the whole line. The list attribute is only maintained for compatibility reasons
Functions ¶
func AttribsToString ¶
func AttributeTester ¶
func ComposeAttributes ¶
func DecodeAttribString ¶
func DeserializeOps ¶
func HasAttrib ¶
func HasAttrib(attribs AttributeMap) bool
func JoinAttributionLines ¶
func MakeAttribution ¶
func MakeSplice ¶
func MoveOpsToNewPool ¶
func OpsFromAText ¶
func SplitAttributionLines ¶
Types ¶
type AttributeManager ¶
type AttributeManager struct {
}
type AttributeMap ¶
type AttributeMap struct {
// contains filtered or unexported fields
}
func FromString ¶
func FromString(s string, pool apool.APool) AttributeMap
func NewAttributeMap ¶
func NewAttributeMap(pool *apool.APool) AttributeMap
func (*AttributeMap) Get ¶
func (a *AttributeMap) Get(key string) string
func (*AttributeMap) Has ¶
func (a *AttributeMap) Has(key string) bool
func (*AttributeMap) Set ¶
func (a *AttributeMap) Set(key string, value string) *AttributeMap
func (*AttributeMap) Size ¶
func (a *AttributeMap) Size() int
func (*AttributeMap) String ¶
func (a *AttributeMap) String() string
func (*AttributeMap) Update ¶
func (a *AttributeMap) Update(entries []apool.Attribute, emptyValueISDelete *bool) *AttributeMap
*
- @param {Iterable<Attribute>} entries - [key, value] pairs to insert into this map.
- @param {boolean} [emptyValueIsDelete] - If true and an entry's value is the empty string, the
- key is removed from this map (if present).
- @returns {AttributeMap} `this` (for chaining).
func (*AttributeMap) UpdateFromString ¶
func (a *AttributeMap) UpdateFromString(key string, emptyValueIsDelete *bool) *AttributeMap
*
- @param {AttributeString} str - The attribute string identifying the attributes to insert into
- this map.
- @param {boolean} [emptyValueIsDelete] - If true and an entry's value is the empty string, the
- key is removed from this map (if present).
- @returns {AttributeMap} `this` (for chaining).
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (Builder) Insert ¶
*
- @param {string} text - Text to insert.
- @param {(string|Attribute[])} attribs - Either [[key1,value1],[key2,value2],...] or '*0*1...'
- (no pool needed in latter case).
- @param {?AttributePool} pool - Attribute pool, only required if `attribs` is a list of
- attribute key, value pairs.
- @returns {Builder} this
func (Builder) Keep ¶
*
- @param {number} N - Number of characters to keep.
- @param {number} L - Number of newlines among the `N` characters. If positive, the last
- character must be a newline.
- @param {(string|Attribute[])} attribs - Either [[key1,value1],[key2,value2],...] or '*0*1...'
- (no pool needed in latter case).
- @param {?AttributePool} pool - Attribute pool, only required if `attribs` is a list of
- attribute key, value pairs.
- @returns {Builder} this
func (Builder) KeepText ¶
*
- @param {string} text - Text to keep.
- @param {(string|Attribute[])} attribs - Either [[key1,value1],[key2,value2],...] or '*0*1...'
- (no pool needed in latter case).
- @param {?AttributePool} pool - Attribute pool, only required if `attribs` is a list of
- attribute key, value pairs.
- @returns {Builder} this
type MergingOpAssembler ¶
type MergingOpAssembler struct {
// contains filtered or unexported fields
}
func NewMergingOpAssembler ¶
func NewMergingOpAssembler() MergingOpAssembler
func (*MergingOpAssembler) Append ¶
func (m *MergingOpAssembler) Append(op Op)
func (*MergingOpAssembler) Clear ¶
func (m *MergingOpAssembler) Clear()
func (*MergingOpAssembler) EndDocument ¶
func (m *MergingOpAssembler) EndDocument()
func (*MergingOpAssembler) String ¶
func (m *MergingOpAssembler) String() string
type Op ¶
func OpsFromText ¶
type OpAssembler ¶
type OpAssembler struct {
// contains filtered or unexported fields
}
func NewOpAssembler ¶
func NewOpAssembler() OpAssembler
func (*OpAssembler) Append ¶
func (oa *OpAssembler) Append(op Op)
func (*OpAssembler) Clear ¶
func (oa *OpAssembler) Clear()
func (*OpAssembler) String ¶
func (oa *OpAssembler) String() string
type PrepareForWireStruct ¶
func PrepareForWire ¶
func PrepareForWire(cs string, pool apool.APool) PrepareForWireStruct
type SmartOpAssembler ¶
type SmartOpAssembler struct {
// contains filtered or unexported fields
}
func NewSmartOpAssembler ¶
func NewSmartOpAssembler() *SmartOpAssembler
func (*SmartOpAssembler) Append ¶
func (sm *SmartOpAssembler) Append(op Op)
func (*SmartOpAssembler) Clear ¶
func (sm *SmartOpAssembler) Clear()
func (*SmartOpAssembler) EndDocument ¶
func (sm *SmartOpAssembler) EndDocument()
func (*SmartOpAssembler) FlushKeeps ¶
func (sm *SmartOpAssembler) FlushKeeps()
func (*SmartOpAssembler) LengthChange ¶
func (sm *SmartOpAssembler) LengthChange() int
func (*SmartOpAssembler) String ¶
func (sm *SmartOpAssembler) String() string
type StringAssembler ¶
type StringAssembler struct {
// contains filtered or unexported fields
}
func NewStringAssembler ¶
func NewStringAssembler() StringAssembler
func (*StringAssembler) Append ¶
func (sa *StringAssembler) Append(s string)
func (*StringAssembler) Clear ¶
func (sa *StringAssembler) Clear()
func (*StringAssembler) String ¶
func (sa *StringAssembler) String() string
type StringIterator ¶
type StringIterator struct {
// contains filtered or unexported fields
}
func NewStringIterator ¶
func NewStringIterator(str string) StringIterator
func (*StringIterator) AssertRemaining ¶
func (si *StringIterator) AssertRemaining(n int) error
func (*StringIterator) Peek ¶
func (si *StringIterator) Peek(n int) string
func (*StringIterator) Remaining ¶
func (si *StringIterator) Remaining() int
func (*StringIterator) Skip ¶
func (si *StringIterator) Skip(n int) error
func (*StringIterator) Take ¶
func (si *StringIterator) Take(n int) string
Click to show internal directories.
Click to hide internal directories.