Skip to content

Commit

Permalink
docs: filter directories with a semver-lite peg pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
haltcase committed Nov 9, 2020
1 parent e744f99 commit 37bcb4a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docsrc/build_index.nim
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import algorithm, os, sequtils, strformat, strutils
import algorithm, pegs, os, sequtils, strformat, strutils

if paramCount() < 1:
echo "build_index.nim should be passed the repo path"
quit 1

let tmpl = readFile paramStr(1) / "docsrc" / "index.html"
let versionPattern = peg"'v' \d+ '.' \d+ '.' \d+ ('-' \w+)?"

let releaseList = toSeq(walkDirs "*")
.filterIt(it != "latest")
.filterIt(it.match(versionPattern))
.reversed()
.map(proc (name: string): string =
result = fmt"""
Expand Down

0 comments on commit 37bcb4a

Please sign in to comment.