|
|
@@ -40,6 +40,14 @@ import ( |
|
|
|
"github.com/editorconfig/editorconfig-core-go/v2" |
|
|
|
) |
|
|
|
|
|
|
|
const ( |
|
|
|
REF_HEADS_PREFIX = "refs/heads/" |
|
|
|
REF_TAGS_PREFIX = "refs/tags/" |
|
|
|
REF_TYPE_BRANCH = "branch" |
|
|
|
REF_TYPE_TAG = "tag" |
|
|
|
REF_TYPE_PATTERN = "(refs/heads/|refs/tags/)" |
|
|
|
) |
|
|
|
|
|
|
|
// Used from static.go && dynamic.go |
|
|
|
var mailSubjectSplit = regexp.MustCompile(`(?m)^-{3,}[\s]*$`) |
|
|
|
|
|
|
@@ -427,6 +435,8 @@ func NewTextFuncMap() []texttmpl.FuncMap { |
|
|
|
} |
|
|
|
return float32(n) * 100 / float32(sum) |
|
|
|
}, |
|
|
|
"GetRefType": GetRefType, |
|
|
|
"GetRefName": GetRefName, |
|
|
|
}} |
|
|
|
} |
|
|
|
|
|
|
@@ -444,10 +454,12 @@ func SafeJS(raw string) template.JS { |
|
|
|
func Str2html(raw string) template.HTML { |
|
|
|
return template.HTML(markup.Sanitize(raw)) |
|
|
|
} |
|
|
|
|
|
|
|
// |
|
|
|
func subOne(length int)int{ |
|
|
|
return length-1 |
|
|
|
func subOne(length int) int { |
|
|
|
return length - 1 |
|
|
|
} |
|
|
|
|
|
|
|
// Escape escapes a HTML string |
|
|
|
func Escape(raw string) string { |
|
|
|
return html.EscapeString(raw) |
|
|
@@ -758,3 +770,18 @@ func licenses() []string { |
|
|
|
func tasks() []string { |
|
|
|
return []string{"machine_translation", "question_answering_system", "information_retrieval", "knowledge_graph", "text_annotation", "text_categorization", "emotion_analysis", "language_modeling", "speech_recognition", "automatic_digest", "information_extraction", "description_generation", "image_classification", "face_recognition", "image_search", "target_detection", "image_description_generation", "vehicle_license_plate_recognition", "medical_image_analysis", "unmanned", "unmanned_security", "drone", "vr_ar", "2_d_vision", "2.5_d_vision", "3_d_reconstruction", "image_processing", "video_processing", "visual_input_system", "speech_coding", "speech_enhancement", "speech_synthesis"} |
|
|
|
} |
|
|
|
|
|
|
|
func GetRefType(ref string) string { |
|
|
|
if strings.HasPrefix(ref, REF_HEADS_PREFIX) { |
|
|
|
return REF_TYPE_BRANCH |
|
|
|
} |
|
|
|
if strings.HasPrefix(ref, REF_TAGS_PREFIX) { |
|
|
|
return REF_TYPE_TAG |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func GetRefName(ref string) string { |
|
|
|
reg := regexp.MustCompile(REF_TYPE_PATTERN) |
|
|
|
return reg.ReplaceAllString(ref, "") |
|
|
|
} |