Skip to content

Commit

Permalink
update URL references to corefork and minor fix in vector parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarnathCJD committed Dec 24, 2024
1 parent f0a96df commit 1aeeb63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/cmd/tlgen/gen/tl_gen_methods.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package gen

import (
"fmt"
"io"
"log"
"net/http"
"regexp"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -66,9 +67,9 @@ func (g *Generator) generateMethods(f *jen.File, d bool) {
}

func (g *Generator) generateComment(name, _type string) (string, []string) {
var base = "https://core.telegram.org/" + _type + "/"
fmt.Println(base + name)
var base = "https://corefork.telegram.org/" + _type + "/"
req, _ := http.NewRequest("GET", base+name, http.NoBody)
log.Println("tlgen: fetching", req.URL.String())

resp, err := http.DefaultClient.Do(req)
if err != nil {
Expand Down Expand Up @@ -98,7 +99,8 @@ func (g *Generator) generateComment(name, _type string) (string, []string) {
ack = strings.Split(ack, "</p>")[0]
ack = strings.ReplaceAll(ack, "<p>", "")
//ack = strings.ReplaceAll(ack, "see .", "")
ack = regexLinkTag.ReplaceAllString(ack, "[$2](https://core.telegram.org$1)")
ack = regexLinkTag.ReplaceAllString(ack, "[$2](https://corefork.telegram.org$1)")
ack = regexp.MustCompile(`\[(.*?)\]\(.*?\)`).ReplaceAllString(ack, "$1")

ack = regexCodeTag.ReplaceAllString(ack, "`$1`")

Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/tlgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ null#56730bcc = Null;`}
clean = []string{}
}

b = bytes.ReplaceAll(b, []byte(`vector<`), []byte(`Vector<`))

clean = append(clean, string(b))

return []byte(strings.Join(clean, "\n"))
Expand Down

0 comments on commit 1aeeb63

Please sign in to comment.