Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
MathPrettyPrinter
Commits
29b9c555
Commit
29b9c555
authored
Jun 28, 2018
by
0xJMR
Browse files
Further development on TeXHTMLMathPrettyPrinter.
parent
1450d7c7
Pipeline
#58742
passed with stages
in 45 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/mpp/core/generator/GeneratorHelper.java
View file @
29b9c555
...
...
@@ -65,12 +65,18 @@ public class GeneratorHelper {
return
this
.
texPrinter
.
prettyPrint
(
ast
);
}
public
String
[]
getLines
(
ASTMathCompilationUnit
ast
)
{
public
String
[]
get
HTML
Lines
(
ASTMathCompilationUnit
ast
)
{
String
printedHTML
=
this
.
printHTML
(
ast
);
return
printedHTML
.
split
(
"\n"
);
}
public
String
[]
getTeXHTMLLines
(
ASTMathCompilationUnit
ast
)
{
String
printedHTML
=
this
.
printTeXHTML
(
ast
);
return
printedHTML
.
split
(
"\n"
);
}
@Subscribe
public
void
onMathFileParsed
(
MathFileParsedEvent
event
)
{
...
...
src/main/java/de/monticore/lang/monticar/mpp/core/tex/SVGGenerator.java
View file @
29b9c555
...
...
@@ -15,10 +15,7 @@ import org.w3c.dom.DOMImplementation;
import
org.w3c.dom.Document
;
import
java.awt.*
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.io.Writer
;
import
java.io.*
;
import
java.nio.file.Path
;
public
class
SVGGenerator
{
...
...
@@ -32,6 +29,10 @@ public class SVGGenerator {
public
void
setContext
(
ASTMathCompilationUnit
ast
)
{
this
.
outputPath
=
this
.
optionsService
.
getOutputPath
(
ast
);
File
outputDirectory
=
this
.
outputPath
.
toFile
();
if
(!
outputDirectory
.
exists
())
outputDirectory
.
mkdirs
();
}
public
String
generate
(
String
latex
)
throws
IOException
{
...
...
src/main/resources/templates/script.ftl
View file @
29b9c555
...
...
@@ -66,7 +66,7 @@
<ul>
<li>
<table>
<#list helper.getLines(ast) as line>
<#list helper.get
HTML
Lines(ast) as line>
<tr>
<td class="line-number">$
{
1
+
line
?
index
}
</td>
<td><pre><#if line?length == 0> <#else>$
{
line
}
</#if></pre></td>
...
...
@@ -75,12 +75,14 @@
</table>
</li>
<li>
<
pre
class="line-numbers">
<#
list
1..helper.getLinesCount(ast) as lineNumber>
$
{
lineNumber
}
</#
list
>
</
pre
>
<
pre
>${
helper
.printTeXHTML
(
ast
)}</
pre
>
<table>
<#list helper.getTeXHTMLLines(ast) as line>
<tr>
<td class="line-number">$
{
1
+
line
?
index
}
</td>
<td><pre><#if line?length == 0> <#else>$
{
line
}
</#if></pre></td>
</tr>
</#list>
</table>
</li>
</ul>
</body>
...
...
src/test/java/de/monticore/lang/monticar/mpp/core/ApplicationTest.java
→
src/test/java/de/monticore/lang/monticar/mpp/core/
application/
ApplicationTest.java
View file @
29b9c555
package
de.monticore.lang.monticar.mpp.core
;
package
de.monticore.lang.monticar.mpp.core
.application
;
import
de.monticore.lang.monticar.mpp.core.application.Application
;
import
org.junit.Ignore
;
...
...
src/test/java/de/monticore/lang/monticar/mpp/core/tex/SVGGeneratorTest.java
deleted
100644 → 0
View file @
1450d7c7
package
de.monticore.lang.monticar.mpp.core.tex
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
java.io.IOException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
public
class
SVGGeneratorTest
{
@Test
@Ignore
public
void
testGenerate
()
throws
IOException
{
Path
target
=
Paths
.
get
(
"target/generated-sources/svg"
).
toAbsolutePath
();
SVGGenerator
generator
=
new
SVGGenerator
();
generator
.
generate
(
target
,
"\\forall \\varepsilon \\in \\mathbb{R}"
);
}
}
src/test/java/de/monticore/lang/monticar/mpp/montimath/TeXHTMLMathPrettyPrinterTest.java
0 → 100644
View file @
29b9c555
package
de.monticore.lang.monticar.mpp.montimath
;
import
de.monticore.lang.math._ast.ASTMathCompilationUnit
;
import
de.monticore.lang.math._parser.MathParser
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
java.io.IOException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Optional
;
public
class
TeXHTMLMathPrettyPrinterTest
{
@Test
@Ignore
public
void
test
()
throws
IOException
{
Path
model
=
Paths
.
get
(
"src/test/resources/models/montimath/vanilla/Example.m"
).
toAbsolutePath
();
MathParser
parser
=
new
MathParser
();
Optional
<
ASTMathCompilationUnit
>
astOptional
=
parser
.
parse
(
model
.
toString
());
//TeXHTMLMathPrettyPrinter visitor = new TeXHTMLMathPrettyPrinter();
//astOptional.ifPresent(visitor::handle);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment