arrow keys navigation added | fixes mmcgrana/gobyexample#222
This commit is contained in:
committed by
Mark McGranaghan
parent
ff7d5ba117
commit
1943fe0803
@@ -138,6 +138,7 @@ type Example struct {
|
||||
ID, Name string
|
||||
GoCode, GoCodeHash, URLHash string
|
||||
Segs [][]*Seg
|
||||
PrevExample *Example
|
||||
NextExample *Example
|
||||
}
|
||||
|
||||
@@ -270,6 +271,9 @@ func parseExamples() []*Example {
|
||||
examples = append(examples, &example)
|
||||
}
|
||||
for i, example := range examples {
|
||||
if i > 0 {
|
||||
example.PrevExample = examples[i-1]
|
||||
}
|
||||
if i < (len(examples) - 1) {
|
||||
example.NextExample = examples[i+1]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user