@@ -7,24 +7,24 @@
9struct TeXer {
9struct TeXer {
10− static func convert(objects: [Object]) -> String {
10+ static func convert(objects: [Object], with style: TexType = .laTeX(2)) -> String {
11 return """
11 return """
12− \\subsection{Описание классов и структур}
12+ \\\(style.section(for: 1)){Описание классов и структур}
14 \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
14 \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
16 \\textbf{Класс или стркура} & \\textbf{Описание} \\\\ \\hline
16 \\textbf{Класс или стркура} & \\textbf{Описание} \\\\ \\hline
17 \( objects.map {"\\texttt{\($0.declaration)} & \($0.documentation ?? "{\\color{red} TODO}") \\\\ \\hline"} .joined(separator: "\n") )
17 \( objects.map {"\\texttt{\($0.declaration)} & \($0.documentation ?? "{\\color{red} TODO}") \\\\ \\hline"} .joined(separator: "\n") )
18 \\end{longtable}
18 \\end{longtable}
21− \\subsection{Описание полей классов и структур}
21+ \\\(style.section(for: 1)){Описание полей классов и структур}
24 objects.compactMap {
24 objects.compactMap {
25 if $0.fields.count > 0 {
25 if $0.fields.count > 0 {
26 return """
26 return """
27− \\subsubsection{\\texttt{\($0.declaration)}}
27+ \\\(style.section(for: 2))*{\\texttt{\($0.declaration)}}
29 \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
29 \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
@@ -38,14 +38,14 @@ struct TeXer {
39 } .joined(separator: "\n")
39 } .joined(separator: "\n")
42− \\subsection{Описание методов классов и структур}
42+ \\\(style.section(for: 1)){Описание методов классов и структур}
45 objects.compactMap {
45 objects.compactMap {
46 if $0.methods.count > 0 {
46 if $0.methods.count > 0 {
47 return """
47 return """
48− \\subsubsection{\\texttt{\($0.declaration)}}
48+ \\\(style.section(for: 2))*{\\texttt{\($0.declaration)}}
50 \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
50 \\begin{longtable}{|p{0.55\\textwidth} | p{0.4\\textwidth}|}
@@ -61,4 +61,41 @@ struct TeXer {
69+ func section(`for` level: Int) -> String {
72+ return String(repeating: "sub", count: i+level-2).appending("section")
73+ case .techDoc(let i):
78+ return TexType.laTeX(i).section(for: level)
82+ var levelOffset: Int {
87+ case .techDoc(let i):
94+ self = .laTeX(newValue)
96+ self = .techDoc(newValue)