new style
This commit is contained in:
@@ -19,8 +19,9 @@ To run kifugen you will need:
|
|||||||
# Usage
|
# Usage
|
||||||
The basic usage is `kifugen <file> [options]` where file is the `.sgf` file and options are:
|
The basic usage is `kifugen <file> [options]` where file is the `.sgf` file and options are:
|
||||||
|
|
||||||
| Option | Meaning |
|
| Option | Meaning | Default |
|
||||||
| :------------- | :---------------------------- |
|
| :------------- | :---------------------------- | :-------- |
|
||||||
| -se n | "split every" n moves |
|
| -se n | "split every" n moves | 50 |
|
||||||
| -c | compile to pdf |
|
| -cn | continuous numbering | false |
|
||||||
| -o | open the pdf after compilation|
|
| -c | compile to pdf | false |
|
||||||
|
| -o | open the pdf after compilation| false |
|
||||||
|
|||||||
+26
-11
@@ -7,6 +7,7 @@ parser = argparse.ArgumentParser(description='Convert sgf go records into a kifu
|
|||||||
|
|
||||||
parser.add_argument('sgfFile')
|
parser.add_argument('sgfFile')
|
||||||
parser.add_argument('-se', "--splitevery", dest="step", type=int, default=50)
|
parser.add_argument('-se', "--splitevery", dest="step", type=int, default=50)
|
||||||
|
parser.add_argument('-cn', "--continuousNumbers", action="store_true", dest="cn", default=False)
|
||||||
parser.add_argument('-c', "--compile", action="store_true", dest="c", default=False)
|
parser.add_argument('-c', "--compile", action="store_true", dest="c", default=False)
|
||||||
parser.add_argument('-o', "--open", action="store_true", dest="o", default=False)
|
parser.add_argument('-o', "--open", action="store_true", dest="o", default=False)
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ def generate_moves():
|
|||||||
currentSplit = splitBoardAt[i]
|
currentSplit = splitBoardAt[i]
|
||||||
nextSplit = splitBoardAt[i+1]
|
nextSplit = splitBoardAt[i+1]
|
||||||
|
|
||||||
outText.extend(["\n\\setcounter{gomove}{0}\n", "\\begin{psgoboard}\n\t"])
|
outText.append("\\begin{psgoboard}\n\t")
|
||||||
|
|
||||||
# old moves
|
# old moves
|
||||||
for j in range(currentSplit):
|
for j in range(currentSplit):
|
||||||
@@ -95,6 +96,8 @@ def generate_moves():
|
|||||||
outText.append("\n\\end{psgoboard}\n")
|
outText.append("\n\\end{psgoboard}\n")
|
||||||
if finished:
|
if finished:
|
||||||
break
|
break
|
||||||
|
elif not args.cn:
|
||||||
|
outText.append("\n\\setcounter{gomove}{0}\n")
|
||||||
|
|
||||||
return "".join(outText)
|
return "".join(outText)
|
||||||
|
|
||||||
@@ -112,32 +115,44 @@ parsedHeader = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
title = generate_title()
|
# title = generate_title()
|
||||||
|
event = parsedHeader["event"]
|
||||||
date = parsedHeader["date"]
|
date = parsedHeader["date"]
|
||||||
moves = generate_moves()
|
|
||||||
result = parsedHeader["result"]
|
result = parsedHeader["result"]
|
||||||
|
playerWhite = parsedHeader["playerWhite"]
|
||||||
|
playerBlack = parsedHeader["playerBlack"]
|
||||||
|
moves = generate_moves()
|
||||||
|
|
||||||
outText = f"""
|
outText = f"""
|
||||||
\\documentclass[a4paper]{{article}}
|
\\documentclass[a4paper]{{article}}
|
||||||
\\usepackage{{psgo}}
|
\\usepackage{{psgo}}
|
||||||
\\usepackage[ngerman]{{babel}}
|
\\usepackage[ngerman]{{babel}}
|
||||||
\\usepackage[margin=2cm,nohead]{{geometry}}
|
\\usepackage[margin=2cm,nohead]{{geometry}}
|
||||||
|
\\usepackage{{tabularx}}
|
||||||
|
|
||||||
|
\\newcolumntype{{R}}{{>{{\\raggedleft\\arraybackslash}}X}}
|
||||||
|
|
||||||
\\setgounit{{0.5cm}}
|
\\setgounit{{0.5cm}}
|
||||||
|
\\setcounter{{gomove}}{{0}}
|
||||||
\\author{{}}
|
|
||||||
\\title{{{title}}}
|
|
||||||
\\date{{{date}}}
|
|
||||||
|
|
||||||
\\begin{{document}}
|
\\begin{{document}}
|
||||||
\\maketitle
|
\\sffamily
|
||||||
\\vspace{{3.5cm}}
|
\\def\\arraystretch{{2}}
|
||||||
\\begin{{center}}
|
\\begin{{center}}
|
||||||
|
\\vspace*{{1cm}}
|
||||||
|
{{\\Huge {event} \\par}}
|
||||||
|
\\vspace{{1cm}}
|
||||||
|
{{\\huge {date} \\par}}
|
||||||
|
\\vspace{{2cm}}
|
||||||
|
\\begin{{tabularx}}{{\\textwidth}}{{ R | c | X }}
|
||||||
|
\\hline
|
||||||
|
\\stone{{black}} {playerBlack} & \\textbf{{{result}}} & {playerWhite} \\stone{{white}} \\\\\\hline
|
||||||
|
& 7.5 komi & \\\\\\hline
|
||||||
|
\\end{{tabularx}}
|
||||||
|
\\vspace{{3cm}}
|
||||||
|
|
||||||
{moves}
|
{moves}
|
||||||
|
|
||||||
\\textbf{{{result}}}
|
|
||||||
|
|
||||||
\\end{{center}}
|
\\end{{center}}
|
||||||
\\end{{document}}
|
\\end{{document}}
|
||||||
"""
|
"""
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 122 KiB |
Reference in New Issue
Block a user