sync: parse complex AUTHORS.txt as described in README
This commit is contained in:
parent
2a941a4fc7
commit
da2a88a3a6
@ -3,6 +3,7 @@ package sync
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
@ -32,7 +33,17 @@ func getAuthors(i Importer, tname string) ([]string, error) {
|
||||
if authors, err := getFileContent(i, path.Join(tname, "AUTHORS.txt")); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return strings.Split(strings.TrimSpace(authors), "\n"), nil
|
||||
var ret []string
|
||||
re := regexp.MustCompile("^([^<]+)(?: +<(.*)>)?$")
|
||||
for _, a := range strings.Split(strings.TrimSpace(authors), "\n") {
|
||||
grp := re.FindStringSubmatch(a)
|
||||
if len(grp) < 2 || grp[2] == "" {
|
||||
ret = append(ret, a)
|
||||
} else {
|
||||
ret = append(ret, fmt.Sprintf("<a href=\"%s\">%s</a>", grp[2], grp[1]))
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,10 @@ a:hover .teamname {
|
||||
text-shadow: 0px 0px 10px #888888;
|
||||
}
|
||||
|
||||
.authors a {
|
||||
color: #3A3F44;
|
||||
}
|
||||
|
||||
.heading {
|
||||
font-style: italic;
|
||||
margin-top: -7px;
|
||||
|
@ -92,7 +92,7 @@
|
||||
|
||||
<div class="container" style="margin-top: 5px;">
|
||||
<div class="page-header text-primary" ng-cloak>
|
||||
<h1 ng-if="(current_theme)">{{ themes[current_theme].name }} <small class="authors" ng-if="themes[current_theme].authors">{{ themes[current_theme].authors }}</small></h1>
|
||||
<h1 ng-if="(current_theme)">{{ themes[current_theme].name }} <small class="authors" ng-if="themes[current_theme].authors" ng-bind-html="themes[current_theme].authors"></small></h1>
|
||||
<h1 ng-if="(!current_theme && title)" ng-cloak>{{ title }} <small class="authors" ng-if="authors">{{ authors }}</small></h1>
|
||||
<h1 ng-if="(!current_theme && !title)">{{ settings.title }} <small class="authors">{{ settings.authors }}</small></h1>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user