1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add FeedIcon API call and update dependencies

This commit is contained in:
Frédéric Guillot 2017-12-16 11:25:18 -08:00
parent 231ebf2daa
commit 27196589fb
262 changed files with 83830 additions and 30061 deletions

View file

@ -33,8 +33,19 @@ const (
NumSymbolTypes
)
const hasNonLatnMask = 0x8000
// symOffset is an offset into altSymData if the bit indicated by hasNonLatnMask
// is not 0 (with this bit masked out), and an offset into symIndex otherwise.
//
// TODO: this type can be a byte again if we use an indirection into altsymData
// and introduce an alt -> offset slice (the length of this will be number of
// alternatives plus 1). This also allows getting rid of the compactTag field
// in altSymData. In total this will save about 1K.
type symOffset uint16
type altSymData struct {
compactTag uint16
symIndex symOffset
system system
symIndex byte
}

0
vendor/golang.org/x/text/internal/number/format.go generated vendored Executable file → Normal file
View file

0
vendor/golang.org/x/text/internal/number/format_test.go generated vendored Executable file → Normal file
View file

View file

@ -255,10 +255,10 @@ func genSymbols(w *gen.CodeWriter, data *cldr.CLDR) {
// resolveSymbolIndex gets the index from the closest matching locale,
// including the locale itself.
resolveSymbolIndex := func(langIndex int, ns system) byte {
resolveSymbolIndex := func(langIndex int, ns system) symOffset {
for {
if sym := symbolMap[key{langIndex, ns}]; sym != nil {
return byte(m[*sym])
return symOffset(m[*sym])
}
if langIndex == 0 {
return 0 // und, latn
@ -270,7 +270,7 @@ func genSymbols(w *gen.CodeWriter, data *cldr.CLDR) {
// Create an index with the symbols for each locale for the latn numbering
// system. If this is not the default, or the only one, for a locale, we
// will overwrite the value later.
var langToDefaults [language.NumCompactTags]byte
var langToDefaults [language.NumCompactTags]symOffset
for _, l := range data.Locales() {
langIndex, _ := language.CompactIndex(language.MustParse(l))
langToDefaults[langIndex] = resolveSymbolIndex(langIndex, 0)
@ -300,8 +300,8 @@ func genSymbols(w *gen.CodeWriter, data *cldr.CLDR) {
for _, l := range data.Locales() {
langIndex, _ := language.CompactIndex(language.MustParse(l))
start := len(langToAlt)
if start > 0x7F {
log.Fatal("Number of alternative assignments > 0x7F")
if start >= hasNonLatnMask {
log.Fatalf("Number of alternative assignments >= %x", hasNonLatnMask)
}
// Create the entry for the default value.
def := defaults[langIndex]
@ -328,7 +328,7 @@ func genSymbols(w *gen.CodeWriter, data *cldr.CLDR) {
langToAlt = langToAlt[:start]
} else {
// Overwrite the entry in langToDefaults.
langToDefaults[langIndex] = 0x80 | byte(start)
langToDefaults[langIndex] = hasNonLatnMask | symOffset(start)
}
}
w.WriteComment(`

View file

@ -37,8 +37,19 @@ const (
NumSymbolTypes
)
const hasNonLatnMask = 0x8000
// symOffset is an offset into altSymData if the bit indicated by hasNonLatnMask
// is not 0 (with this bit masked out), and an offset into symIndex otherwise.
//
// TODO: this type can be a byte again if we use an indirection into altsymData
// and introduce an alt -> offset slice (the length of this will be number of
// alternatives plus 1). This also allows getting rid of the compactTag field
// in altSymData. In total this will save about 1K.
type symOffset uint16
type altSymData struct {
compactTag uint16
symIndex symOffset
system system
symIndex byte
}

View file

@ -17,7 +17,7 @@ import (
// Info holds number formatting configuration data.
type Info struct {
system systemData // numbering system information
symIndex byte // index to symbols
symIndex symOffset // index to symbols
}
// InfoFromLangID returns a Info for the given compact language identifier and
@ -26,16 +26,16 @@ type Info struct {
func InfoFromLangID(compactIndex int, numberSystem string) Info {
p := langToDefaults[compactIndex]
// Lookup the entry for the language.
pSymIndex := byte(0) // Default: Latin, default symbols
pSymIndex := symOffset(0) // Default: Latin, default symbols
system, ok := systemMap[numberSystem]
if !ok {
// Take the value for the default numbering system. This is by far the
// most common case as an alternative numbering system is hardly used.
if p&0x80 == 0 {
if p&hasNonLatnMask == 0 { // Latn digits.
pSymIndex = p
} else {
} else { // Non-Latn or multiple numbering systems.
// Take the first entry from the alternatives list.
data := langToAlt[p&^0x80]
data := langToAlt[p&^hasNonLatnMask]
pSymIndex = data.symIndex
system = data.system
}
@ -43,8 +43,8 @@ func InfoFromLangID(compactIndex int, numberSystem string) Info {
langIndex := compactIndex
ns := system
outerLoop:
for {
if p&0x80 == 0 {
for ; ; p = langToDefaults[langIndex] {
if p&hasNonLatnMask == 0 {
if ns == 0 {
// The index directly points to the symbol data.
pSymIndex = p
@ -52,30 +52,32 @@ func InfoFromLangID(compactIndex int, numberSystem string) Info {
}
// Move to the parent and retry.
langIndex = int(internal.Parent[langIndex])
}
// The index points to a list of symbol data indexes.
for _, e := range langToAlt[p&^0x80:] {
if int(e.compactTag) != langIndex {
if langIndex == 0 {
// The CLDR root defines full symbol information for all
// numbering systems (even though mostly by means of
// aliases). This means that we will never fall back to
// the default of the language. Also, the loop is
// guaranteed to terminate as a consequence.
ns = numLatn
// Fall back to Latin and start from the original
// language. See
// http://unicode.org/reports/tr35/#Locale_Inheritance.
langIndex = compactIndex
} else {
} else {
// The index points to a list of symbol data indexes.
for _, e := range langToAlt[p&^hasNonLatnMask:] {
if int(e.compactTag) != langIndex {
if langIndex == 0 {
// The CLDR root defines full symbol information for
// all numbering systems (even though mostly by
// means of aliases). Fall back to the default entry
// for Latn if there is no data for the numbering
// system of this language.
if ns == 0 {
break
}
// Fall back to Latin and start from the original
// language. See
// http://unicode.org/reports/tr35/#Locale_Inheritance.
ns = numLatn
langIndex = compactIndex
continue outerLoop
}
// Fall back to parent.
langIndex = int(internal.Parent[langIndex])
} else if e.system == ns {
pSymIndex = e.symIndex
break outerLoop
}
break
}
if e.system == ns {
pSymIndex = e.symIndex
break outerLoop
}
}
}

View file

@ -31,6 +31,10 @@ func TestInfo(t *testing.T) {
{"de-CH-oxendict", SymGroup, "", '9'}, // inherits from de-CH (no compact index)
{"de-CH-u-nu-deva", SymGroup, "", '\u096f'}, // miss -> latn -> de-CH
{"bn-u-nu-beng", SymGroup, ",", '\u09ef'},
{"bn-u-nu-deva", SymGroup, ",", '\u096f'},
{"bn-u-nu-latn", SymGroup, ",", '9'},
{"pa", SymExponential, "E", '9'},
// "×۱۰^" -> U+00d7 U+06f1 U+06f0^"

File diff suppressed because it is too large Load diff