Skip to content

Commit 25d6ae6

Browse files
committed
Remove hg dep
1 parent f8977f4 commit 25d6ae6

36 files changed

+119822
-8
lines changed

.gopmfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
path = github.com/gogits/gogs
33

44
[deps]
5-
code.google.com/p/mahonia =
6-
github.com/beego/memcache =
7-
github.com/beego/redigo =
85
github.com/Unknwon/cae =
96
github.com/Unknwon/com =
107
github.com/Unknwon/goconfig =
@@ -18,15 +15,13 @@ github.com/gogits/gfm =
1815
github.com/gogits/git =
1916
github.com/gogits/oauth2 =
2017
github.com/juju2013/goldap =
21-
github.com/johnweldon/asn1-ber =
2218
github.com/lib/pq =
2319
github.com/macaron-contrib/cache =
2420
github.com/macaron-contrib/captcha =
2521
github.com/macaron-contrib/csrf =
2622
github.com/macaron-contrib/i18n =
2723
github.com/macaron-contrib/session =
2824
github.com/macaron-contrib/toolbox =
29-
github.com/mattn/go-sqlite3 =
3025
github.com/nfnt/resize =
3126
github.com/saintfish/chardet =
3227

modules/mahonia/8bit.go

Lines changed: 844 additions & 0 deletions
Large diffs are not rendered by default.

modules/mahonia/ASCII.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package mahonia
2+
3+
// Converters for ASCII and ISO-8859-1
4+
5+
func init() {
6+
for i := 0; i < len(asciiCharsets); i++ {
7+
RegisterCharset(&asciiCharsets[i])
8+
}
9+
}
10+
11+
var asciiCharsets = []Charset{
12+
{
13+
Name: "US-ASCII",
14+
NewDecoder: func() Decoder { return decodeASCIIRune },
15+
NewEncoder: func() Encoder { return encodeASCIIRune },
16+
Aliases: []string{"ASCII", "US", "ISO646-US", "IBM367", "cp367", "ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "csASCII"},
17+
},
18+
{
19+
Name: "ISO-8859-1",
20+
NewDecoder: func() Decoder { return decodeLatin1Rune },
21+
NewEncoder: func() Encoder { return encodeLatin1Rune },
22+
Aliases: []string{"latin1", "ISO Latin 1", "IBM819", "cp819", "ISO_8859-1:1987", "iso-ir-100", "l1", "csISOLatin1"},
23+
},
24+
}
25+
26+
func decodeASCIIRune(p []byte) (c rune, size int, status Status) {
27+
if len(p) == 0 {
28+
status = NO_ROOM
29+
return
30+
}
31+
32+
b := p[0]
33+
if b > 127 {
34+
return 0xfffd, 1, INVALID_CHAR
35+
}
36+
return rune(b), 1, SUCCESS
37+
}
38+
39+
func encodeASCIIRune(p []byte, c rune) (size int, status Status) {
40+
if len(p) == 0 {
41+
status = NO_ROOM
42+
return
43+
}
44+
45+
if c < 128 {
46+
p[0] = byte(c)
47+
return 1, SUCCESS
48+
}
49+
50+
p[0] = '?'
51+
return 1, INVALID_CHAR
52+
}
53+
54+
func decodeLatin1Rune(p []byte) (c rune, size int, status Status) {
55+
if len(p) == 0 {
56+
status = NO_ROOM
57+
return
58+
}
59+
60+
return rune(p[0]), 1, SUCCESS
61+
}
62+
63+
func encodeLatin1Rune(p []byte, c rune) (size int, status Status) {
64+
if len(p) == 0 {
65+
status = NO_ROOM
66+
return
67+
}
68+
69+
if c < 256 {
70+
p[0] = byte(c)
71+
return 1, SUCCESS
72+
}
73+
74+
p[0] = '?'
75+
return 1, INVALID_CHAR
76+
}

0 commit comments

Comments
 (0)