@@ -7,26 +7,26 @@
77//
88
99struct TeXer {
10− static func convert(objects: [Object], with style: TexType = .laTeX(2)) -> String {
10+ static func convert(objects: [Object]) -> String {
1111 return """
12− \\\(style.section(for: 1)){Описание классов и структур}
12+ \\subsection{Описание классов и структур}
1313
14− \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | p{0.4\\textwidth}|}
14+ \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
1515 \\hline
1616 \\textbf{Класс или стркура} & \\textbf{Описание} \\\\ \\hline
17− \( objects.map {"\\texttt{\($0.declaration)} & {\\color{red} TODO} \\\\ \\hline"} .joined(separator: "\n") )
17+ \( objects.map {"\\texttt{\($0.declaration)} & \($0.documentation ?? "{\\color{red} TODO}") \\\\ \\hline"} .joined(separator: "\n") )
1818 \\end{longtable}
19+
1920
20−
21− \\\(style.section(for: 1)){Описание полей классов и структур}
21+ \\subsection{Описание полей классов и структур}
2222
2323 \(
2424 objects.compactMap {
2525 if $0.fields.count > 0 {
2626 return """
27− \\\(style.section(for: 2))*{\\texttt{\($0.declaration)}}
27+ \\subsubsection{\\texttt{\($0.declaration)}}
2828
29− \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | p{0.4\\textwidth}|}
29+ \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
3030 \\hline
3131 \\textbf{Поле} & \\textbf{Описание} \\\\ \\hline
3232 \( $0.fields.map {"\\texttt{\($0.declaration.prefix {$0 != "="})} & {\\color{red} TODO} \\\\ \\hline"} .joined(separator: "\n") )
@@ -38,19 +38,19 @@ struct TeXer {
3838 }
3939 } .joined(separator: "\n")
4040 )
41−
42− \\\(style.section(for: 1)){Описание методов классов и структур}
41+
42+ \\subsection{Описание методов классов и структур}
4343
4444 \(
4545 objects.compactMap {
4646 if $0.methods.count > 0 {
4747 return """
48− \\\(style.section(for: 2))*{\\texttt{\($0.declaration)}}
48+ \\subsubsection{\\texttt{\($0.declaration)}}
4949
50− \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | p{0.4\\textwidth}|}
50+ \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
5151 \\hline
5252 \\textbf{Метод} & \\textbf{Описание} \\\\ \\hline
53− \( $0.methods.map {"\\texttt{\($0.declaration)} & {\\color{red} TODO} \\\\ \\hline"} .joined(separator: "\n") )
53+ \( $0.methods.map {"\\texttt{\($0.declaration)} & \($0.documentation ?? "{\\color{red} TODO}") \\\\ \\hline"} .joined(separator: "\n") )
5454 \\end{longtable}
5555
5656 """
@@ -61,41 +61,4 @@ struct TeXer {
6161 )
6262 """
6363 }
64−
65− enum TexType {
66− case techDoc(Int)
67− case laTeX(Int)
68−
69− func section(`for` level: Int) -> String {
70− switch self {
71− case .laTeX(let i):
72− return String(repeating: "sub", count: i+level-2).appending("section")
73− case .techDoc(let i):
74− switch i+level-2 {
75− case 0:
76− return "addition"
77− default:
78− return TexType.laTeX(i).section(for: level)
79− }
80− }
81− }
82− var levelOffset: Int {
83− get {
84− switch self {
85− case .laTeX(let i):
86− return i
87− case .techDoc(let i):
88− return i
89− }
90− }
91− set {
92− switch self {
93− case .laTeX(_):
94− self = .laTeX(newValue)
95− case .techDoc(_):
96− self = .techDoc(newValue)
97− }
98− }
99− }
100− }
10164}