Nearly done with download :)
This commit is contained in:
+10
-10
@@ -1,25 +1,25 @@
|
||||
//Package appimg is to download and update AppImages for LinuxPA.
|
||||
//Converted from github.com/CalebQ42/bbConvert
|
||||
package appimg
|
||||
|
||||
import "reflect"
|
||||
|
||||
//Convert converts the input string. Only returns <a> tags
|
||||
func Convert(in string) (out []Tag) {
|
||||
func convert(in string) (out []tag) {
|
||||
for i := 0; i < len(in); i++ {
|
||||
v := in[i]
|
||||
if v == '<' {
|
||||
for j := i; j < len(in); j++ {
|
||||
val := in[j]
|
||||
if val == '>' {
|
||||
var tmp Tag
|
||||
var tmp tag
|
||||
tmp.process(in[i+1 : j+1])
|
||||
if !tmp.end {
|
||||
if !tmp.end && tmp.typ == "a" {
|
||||
tmp.index[0] = i
|
||||
tmp.index[1] = j
|
||||
nd := fndend(tmp, in[j+1:])
|
||||
if !reflect.DeepEqual(nd, Tag{}) && tmp.typ == "a" {
|
||||
if !reflect.DeepEqual(nd, tag{}) {
|
||||
tmp.Meat = in[j+1 : nd.index[0]]
|
||||
out = append(out, tmp)
|
||||
str := in[tmp.index[1]:nd.index[0]]
|
||||
in = in[:i] + str + in[nd.index[1]+1:]
|
||||
}
|
||||
}
|
||||
break
|
||||
@@ -30,13 +30,13 @@ func Convert(in string) (out []Tag) {
|
||||
return
|
||||
}
|
||||
|
||||
func fndend(fnt Tag, area string) Tag {
|
||||
func fndend(fnt tag, area string) tag {
|
||||
var count int
|
||||
for i, v := range area {
|
||||
if v == '<' {
|
||||
for j, val := range area[i:] {
|
||||
if val == '>' {
|
||||
var tmp Tag
|
||||
var tmp tag
|
||||
tmp.process(area[i+1 : i+j+1])
|
||||
if tmp.typ == fnt.typ {
|
||||
if tmp.end {
|
||||
@@ -56,5 +56,5 @@ func fndend(fnt Tag, area string) Tag {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Tag{}
|
||||
return tag{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user