arrow keys navigation added | fixes mmcgrana/gobyexample#222

This commit is contained in:
Shivam Rathore
2019-06-24 00:41:52 +05:30
committed by Mark McGranaghan
parent ff7d5ba117
commit 1943fe0803
73 changed files with 992 additions and 0 deletions

View File

@@ -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]
}