Compare commits
No commits in common. "7755d6c2fe7c591a60eede0c26368c27beb39ba6" and "15ffbfae4d2ddc8edd9757910599404e3cb460fc" have entirely different histories.
7755d6c2fe
...
15ffbfae4d
@ -15,7 +15,7 @@ var Dicts []dictionary = []dictionary{
|
||||
{ShortName: "EN-FR", Name: "French - English", Url: "/french-english"},
|
||||
}
|
||||
|
||||
func find_dict(sn string) *dictionary {
|
||||
func find_dict(sn string) (*dictionary) {
|
||||
for i := range Dicts {
|
||||
if Dicts[i].ShortName == sn {
|
||||
return &Dicts[i]
|
||||
@ -25,7 +25,7 @@ func find_dict(sn string) *dictionary {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *dictionary) Path(term string) string {
|
||||
func (d *dictionary) Path(term string) string{
|
||||
term_escaped := url.PathEscape(term)
|
||||
return d.Url + "/" + term_escaped
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ type Translation struct {
|
||||
}
|
||||
|
||||
func (t *Translation) getSuggestions(doc *goquery.Document) error {
|
||||
doc.Find(".suggestion-list li").Each(func(_ int, sel *goquery.Selection) {
|
||||
doc.Find(".suggestion-list li").Each(func(_ int, sel *goquery.Selection){
|
||||
if link := sel.Find("a"); link != nil {
|
||||
t.Suggestions = append(t.Suggestions, link.Text())
|
||||
}
|
||||
@ -29,7 +29,7 @@ func (t *Translation) getSuggestions(doc *goquery.Document) error {
|
||||
}
|
||||
|
||||
func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
if tds == nil || tds.Length() < 4 {
|
||||
if tds == nil || tds.Length() < 4{
|
||||
return
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
index int = 0
|
||||
)
|
||||
|
||||
tds.Each(func(_ int, sel *goquery.Selection) {
|
||||
tds.Each(func(_ int,sel *goquery.Selection){
|
||||
if index < 1 || index > 3 {
|
||||
index++
|
||||
return
|
||||
@ -58,7 +58,7 @@ func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
entries = append(entries, Entry{
|
||||
Text: text,
|
||||
})
|
||||
} else {
|
||||
}else {
|
||||
entries = append(entries, Entry{
|
||||
Text: text,
|
||||
Detail: detail.Text(),
|
||||
@ -72,7 +72,7 @@ func (t *Translation) getEntry(tds *goquery.Selection) {
|
||||
}
|
||||
|
||||
func (t *Translation) getEntries(trs *goquery.Selection) {
|
||||
trs.Each(func(_ int, sel *goquery.Selection) {
|
||||
trs.Each(func(_ int, sel *goquery.Selection){
|
||||
tds := sel.Find("td")
|
||||
|
||||
if tds == nil {
|
||||
@ -81,7 +81,7 @@ func (t *Translation) getEntries(trs *goquery.Selection) {
|
||||
|
||||
if class, ok := tds.Last().Attr("class"); !ok {
|
||||
return
|
||||
} else if !strings.Contains(class, "rc4 hidden-xs") {
|
||||
}else if !strings.Contains(class, "rc4 hidden-xs"){
|
||||
return
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ func (t *Translation) GetResults(doc *goquery.Document) error {
|
||||
return fmt.Errorf("failed to get table body")
|
||||
}
|
||||
|
||||
trs.First().Find("th").Each(func(_ int, sel *goquery.Selection) {
|
||||
trs.First().Find("th").Each(func(_ int, sel *goquery.Selection){
|
||||
if sel.Text() != "" {
|
||||
t.Fields = append(t.Fields, sel.Text())
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"extends": ["config:recommended"],
|
||||
"prHourlyLimit": 20
|
||||
}
|
@ -16,8 +16,8 @@ func Render(c *fiber.Ctx, template string, data fiber.Map) error {
|
||||
return c.Render(template, data)
|
||||
}
|
||||
|
||||
func RenderError(c *fiber.Ctx, code int, err ...error) error {
|
||||
if code == 500 && len(err) > 0 && err[0] != nil {
|
||||
func RenderError(c *fiber.Ctx, code int, err... error) error {
|
||||
if code == 500 && len(err) > 0 && err[0] != nil{
|
||||
log.Printf("server error: %s", err[0].Error())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user