Skip to content

Commit e3a7dcf

Browse files
authored
Fix display of ampersand (#18)
* Fix ampersand display * Fix ampersand display * Add test for ampersand * Add testing for Julia 1.0 * Fix typo in test * Disallow failures on nightly
1 parent bcd9fdc commit e3a7dcf

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ os:
77

88
julia:
99
- 0.7
10+
- 1.0
1011
- nightly
1112

12-
matrix:
13-
allow_failures:
14-
- julia: nightly
13+
#matrix:
14+
# allow_failures:
15+
# - julia: nightly
1516

1617
notifications:
1718
email: false

src/display.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
# latex treats # as a special character, so we have to escape it. See:
33
# https://github.com/sisl/TikzGraphs.jl/issues/12
44

5-
latex_escape(s::String) = replace(s, "#"=>"\\#")
5+
# latex_escape(s::String) = replace(s, Dict("#"=>"\\#", "&"=>"\\&"))
6+
7+
function latex_escape(s::String)
8+
s = replace(s, "#"=>"\\#")
9+
s = replace(s, "&"=>"\\&")
10+
return s
11+
end
612

713
"Convert a symbol or into a LaTeX label"
814
function latex_label(sym)

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ end
2424
expr = Expr(Symbol("##271"))
2525
t = walk_tree(expr)
2626
@test t.labels[1] == Symbol("##271")
27+
28+
t = @tree x && y
29+
@test TreeView.latex_escape(string(t.labels[1])) == "\\&\\&"
2730
end
2831

2932
@testset "DAG" begin

0 commit comments

Comments
 (0)