quran-go

Read Qur'an right in the terminal.
git clone http://git.hanabi.in/repos/quran-go.git
Log | Files | Refs | README | LICENSE

end.go (468B)


      1 package decorate
      2 
      3 import (
      4 	"fmt"
      5 
      6 	t "git.hanabi.in/gitbox/quran-go/src/types"
      7 )
      8 
      9 // Decorate end of printed verses like:
     10 // "--Qur'an 1:1-7"
     11 // "--Qur'an 1:2"
     12 // "--Qur'an 1:2-5"
     13 func End(transAuthor string, chapterID t.Chap, verse1, verse2 t.Verse) {
     14 
     15 	res := fmt.Sprintf("\n\t--Qur'an %d:%d", chapterID, verse1)
     16 
     17 	if verse1 < verse2 { // "1:3-3"
     18 		res += fmt.Sprintf("-%d", verse2)
     19 	}
     20 
     21 	res += fmt.Sprintf(", %s translation.\n", transAuthor)
     22 
     23 	fmt.Println(res)
     24 
     25 }