bonus2: add support for jekyll baseurl and highlight

git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@191 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
bevilj 2018-11-15 07:54:54 +00:00
parent c2713cbb68
commit c6f05e4ccc
2 changed files with 13 additions and 3 deletions
bonus2
res
src/ch/usi/inf/atelier/group1/jekyll

View file

@ -44,7 +44,7 @@ A surprise to be sure,
<h1>Fish</h1>
There's always bigger fish<br>
There's always <a href="{{ site.baseurl }}/bigger.html">bigger</a> fish<br>
[visible confusion]
@ -54,6 +54,12 @@ There's always bigger fish<br>
<li>You're a <b>bold</b> one</li>
</ul>
{% highlight bash %}
Dew it.
{% endhighlight %}
<table>
<tr>

View file

@ -71,6 +71,8 @@ class HtmlToLatexWriter(private var content: String) {
* Replace <a> with LaTeX footNote url
*/
fun changeLink() {
content = content.replace("{{ site.baseurl }}/", "www.theshell.ch/") // ""
val pattern = Pattern.compile("<a href=\"(.*?)\"(.*?)>(.*?)</a>")
val matcher = pattern.matcher(content)
@ -98,10 +100,12 @@ class HtmlToLatexWriter(private var content: String) {
}
/**
* Replace <pre> with LaTeX verbatim
* Replace <pre> and {% highlight %} with LaTeX verbatim
*/
fun changeMono() {
content = content.replaceTag("<pre>", "</pre>", "\\begin{verbatim}", "\\end{verbatim}")
.replaceTag("{% highlight bash %}", "{% endhighlight %}",
"\\begin{verbatim}", "\\end{verbatim}")
}
/**
@ -258,4 +262,4 @@ class HtmlToLatexWriter(private var content: String) {
"\\usepackage[margin=2cm]{geometry}\n" +
"\\usepackage{hyperref}"
}
}
}