Skip to content

Commit

Permalink
Fix misligned lines in output of aqFile
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorGoatman committed Oct 15, 2022
1 parent 8be96b8 commit e346af5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion aqcalc.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.3.0"
version = "0.3.1"
author = "VitorGoatman"
description = "Calculate gematria values for Alphanumeric Qabbala"
license = "Unlicense"
Expand Down
19 changes: 12 additions & 7 deletions src/aqcalcpkg/aqfile.nim
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import strutils, re, aq
from strutils import split
from aq import aq
proc aqFile*(file: string): string =
for line in file.lines:
if line.aq != 0:
result.add line.strip&" = " & $line.aq&"\n"
let words = line.split(re"\s")
let lineaq = line.aq
if lineaq != 0:
let words = line.split
var tline,nline:string
for word in words:
if word != "":
if word.len == 1: tline.add word&" "
else: tline.add word&" "
let sum = word.aq
let slen = ($sum).len
var offset = word.len - slen
if offset < 0: offset = 0
result.add $sum&" "
for i in 0..<offset: result.add " "
result.add "\n"
nline.add $sum&" "
for i in 0..<offset: nline.add " "
tline.add "= " & $lineaq
result.add tline&"\n"&nline&"\n"
else: result.add "\n"

0 comments on commit e346af5

Please sign in to comment.