-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add kaluga textable for valeria (#48)
* chore: add kaluga textable for valeria * docs: fix macos config dir * docs: add kaluga * docs: add more kaluga
- Loading branch information
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package textables | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// Works both in HTML and PDF render. | ||
type KalugaTable struct { | ||
groups []string | ||
} | ||
|
||
var _ Table = &KalugaTable{} | ||
|
||
func (t *KalugaTable) AddGroup(info GroupInfo) { | ||
var limits string | ||
switch info.Type { | ||
case Group0: | ||
return | ||
case GroupLast: | ||
limits = "Ограничения из условия" | ||
case GroupRegular: | ||
} | ||
row := fmt.Sprintf("%s & %d & %s \\\\ \\hline", | ||
info.Name, | ||
info.Score, | ||
limits, | ||
) | ||
t.groups = append(t.groups, row) | ||
} | ||
|
||
func (t *KalugaTable) String() string { | ||
table := []string{ | ||
"\\begin{center}", | ||
"\\begin{tabular}{|c|c|c|}", | ||
"\\hline", | ||
"\\bf{Подзадача} &", | ||
"\\bf{Баллы} &", | ||
"\\bf{Ограничения}", | ||
"\\\\ \\hline", | ||
} | ||
table = append(table, t.groups...) | ||
table = append(table, "\\end{tabular}", "\\end{center}") | ||
|
||
return strings.Join(table, "\n") | ||
} |