Implement and display headlines in interface
This commit is contained in:
parent
abd7fc6bef
commit
8c95782eff
13 changed files with 85 additions and 58 deletions
|
|
@ -59,6 +59,11 @@ func SyncExercices(i Importer, theme fic.Theme) []string {
|
|||
if err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: overview.txt: %s", edir, err))
|
||||
}
|
||||
ovrvw := strings.Split(overview, "\n")
|
||||
headline := ovrvw[0]
|
||||
if len(ovrvw) > 1 {
|
||||
overview = strings.Join(ovrvw[1:], "\n")
|
||||
}
|
||||
|
||||
statement, err := getFileContent(i, path.Join(theme.Path, edir, "statement.txt"))
|
||||
if err != nil {
|
||||
|
|
@ -111,18 +116,20 @@ func SyncExercices(i Importer, theme fic.Theme) []string {
|
|||
// Markdown pre-formating
|
||||
statement = string(blackfriday.Run([]byte(statement)))
|
||||
overview = string(blackfriday.Run([]byte(overview)))
|
||||
headline = string(blackfriday.Run([]byte(headline)))
|
||||
|
||||
e, err := theme.GetExerciceByTitle(ename)
|
||||
if err != nil {
|
||||
if e, err = theme.AddExercice(ename, fic.ToURLid(ename), path.Join(theme.Path, edir), statement, overview, depend, gain, videoURI); err != nil {
|
||||
if e, err = theme.AddExercice(ename, fic.ToURLid(ename), path.Join(theme.Path, edir), statement, overview, headline, depend, gain, videoURI); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: error on exercice add: %s", edir, err))
|
||||
continue
|
||||
}
|
||||
} else if e.Title != ename || e.URLId == "" || e.Statement != statement || e.Overview != overview || e.Gain != gain || e.VideoURI != videoURI {
|
||||
} else if e.Title != ename || e.URLId == "" || e.Statement != statement || e.Overview != overview || e.Headline != headline || e.Gain != gain || e.VideoURI != videoURI {
|
||||
e.Title = ename
|
||||
e.URLId = fic.ToURLid(ename)
|
||||
e.Statement = statement
|
||||
e.Overview = overview
|
||||
e.Headline = headline
|
||||
e.Gain = gain
|
||||
e.VideoURI = videoURI
|
||||
if _, err := e.Update(); err != nil {
|
||||
|
|
|
|||
Reference in a new issue