-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
230 additions
and
200 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
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
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
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,54 @@ | ||
/* | ||
* BlocksToLaTeX.java Copyright (C) 2024 Daniel H. Huson | ||
* | ||
* (Some files contain contributions from other authors, who are then mentioned separately.) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package splitstree6.xtra.latex; | ||
|
||
import splitstree6.io.nexus.*; | ||
|
||
import static splitstree6.xtra.latex.IOToLaTeX.FOOTER; | ||
import static splitstree6.xtra.latex.IOToLaTeX.HEADER; | ||
|
||
public class BlocksToLaTeX { | ||
public static void main(String[] args) { | ||
|
||
System.out.println(HEADER + | ||
"\\section{Main data blocks and their `Nexus format' syntax}\n\n" + | ||
output("Taxa block", TaxaNexusInput.DESCRIPTION, TaxaNexusInput.SYNTAX) + | ||
output("Traits block", TraitsNexusInput.DESCRIPTION, TraitsNexusInput.SYNTAX) + | ||
output("Characters block", CharactersNexusInput.DESCRIPTION, CharactersNexusInput.SYNTAX) + | ||
output("Distances block", DistancesNexusInput.DESCRIPTION, DistancesNexusInput.SYNTAX) + | ||
output("Trees block", TreesNexusInput.DESCRIPTION, TreesNexusInput.SYNTAX) + | ||
output("Splits block", SplitsNexusInput.DESCRIPTION, SplitsNexusInput.SYNTAX) + | ||
output("Network block", NetworkNexusInput.DESCRIPTION, NetworkNexusInput.SYNTAX) + | ||
output("View block", ViewNexusInput.DESCRIPTION, ViewNexusInput.SYNTAX) + | ||
output("Algorithms block", AlgorithmNexusInput.DESCRIPTION, AlgorithmNexusInput.SYNTAX) + | ||
output("Report block", ReportNexusInput.DESCRIPTION, ReportNexusInput.SYNTAX) + | ||
output("Sets block", SetsNexusInput.DESCRIPTION, SetsNexusInput.SYNTAX) + | ||
output("SplitsTree6 block", SplitsTree6NexusInput.DESCRIPTION, SplitsTree6NexusInput.SYNTAX) + | ||
output("Genomes block", GenomesNexusInput.DESCRIPTION, GenomesNexusInput.SYNTAX) + | ||
FOOTER); | ||
} | ||
|
||
public static String output(String name, String description, String syntax) { | ||
return "\\subsection{%s}\n%n%s%n".formatted(name, description.replaceAll("\t", " ")) + | ||
"{\\footnotesize\\begin{verbatim}\n" + | ||
syntax.replaceAll("\t", " ") + | ||
"\\end{verbatim}}\n\n"; | ||
} | ||
} |
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,62 @@ | ||
/* | ||
* MenusToLaTeX.java Copyright (C) 2024 Daniel H. Huson | ||
* | ||
* (Some files contain contributions from other authors, who are then mentioned separately.) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package splitstree6.xtra.latex; | ||
|
||
import javafx.scene.control.Menu; | ||
import javafx.scene.control.MenuBar; | ||
import javafx.scene.control.SeparatorMenuItem; | ||
|
||
/** | ||
* write out all items in the menu bar in LaTeX | ||
*/ | ||
public class MenusToLaTeX { | ||
public static String apply(MenuBar menuBar) { | ||
var buf = new StringBuilder("\\section{The main menu bar}\n\n"); | ||
for (var menu : menuBar.getMenus()) { | ||
buf.append(applyRec(menu, 0)); | ||
} | ||
return buf.toString(); | ||
} | ||
|
||
public static String applyRec(Menu menu, int level) { | ||
var buf = new StringBuilder(); | ||
if (level == 0) { | ||
buf.append("\\subsection{The %s menu}%n%n%n".formatted(menu.getText())); | ||
buf.append("This menu has the following items:\n\n"); | ||
} else { | ||
buf.append("This %s-menu has the following items:\n\n".formatted("sub".repeat(level))); | ||
} | ||
buf.append("\\begin{itemize}\n"); | ||
for (var item : menu.getItems()) { | ||
if (!(item instanceof SeparatorMenuItem)) { | ||
if (item instanceof Menu subMenu) { | ||
applyRec(subMenu, level + 1); | ||
} else { | ||
var text = item.getText(); | ||
if (item.getUserData() != null) | ||
text += " - " + item.getUserData().toString(); | ||
buf.append("\\item %s%n".formatted(text)); | ||
} | ||
} | ||
} | ||
buf.append("\\end{itemize}\n\n"); | ||
return buf.toString(); | ||
} | ||
} |
Oops, something went wrong.