print_dot: correctly escape \n in html output

* spot/misc/escape.cc (escape_html): Handle \n.
* tests/core/readsave.test: Test it.
* NEWS: Mention the fix.
This commit is contained in:
Alexandre Duret-Lutz 2018-04-24 23:24:02 +02:00
parent 9d34c1f500
commit 4fbcdaca91
3 changed files with 34 additions and 5 deletions

5
NEWS
View file

@ -60,6 +60,11 @@ New in spot 2.5.3.dev (not yet released)
options; there are demonstrated on the new options; there are demonstrated on the new
https://spot.lrde.epita.fr/ipynb/satmin.html page. https://spot.lrde.epita.fr/ipynb/satmin.html page.
Bugs fixed:
- print_dot() will correctly escape strings containing \n in HTML
mode.
New in spot 2.5.3 (2018-04-20) New in spot 2.5.3 (2018-04-20)
Bugs fixed: Bugs fixed:

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2015, 2016 Laboratoire de Recherche et // Copyright (C) 2012, 2013, 2015, 2016, 2018 Laboratoire de Recherche
// Developpement de l'Epita (LRDE) // et Developpement de l'Epita (LRDE)
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
@ -93,6 +93,9 @@ namespace spot
case '>': case '>':
os << "&gt;"; os << "&gt;";
break; break;
case '\n':
os << "<br/>";
break;
default: default:
os << i; os << i;
break; break;

View file

@ -1000,7 +1000,8 @@ State: 1 /* Defined before State 0 on purpose */
[1&!2] 1 /* used in spot.highlight.edges */ [1&!2] 1 /* used in spot.highlight.edges */
State: 0 {0} State: 0 {0}
[t] 0 [t] 0
State: 2 State: 2 "new
line"
[2] 0 [2] 0
[!0&1&!2] 1 [!0&1&!2] 1
[0&!2] 2 [0&!2] 2
@ -1010,7 +1011,6 @@ autfilt -dA input9 > output9
cat >expected9 <<EOF cat >expected9 <<EOF
digraph "a U (b U c)" { digraph "a U (b U c)" {
rankdir=LR rankdir=LR
node [shape="circle"]
I [label="", style=invis, width=0] I [label="", style=invis, width=0]
I -> 2 I -> 2
0 [label="0", peripheries=2, style="bold", color="#1F78B4"] 0 [label="0", peripheries=2, style="bold", color="#1F78B4"]
@ -1018,13 +1018,34 @@ digraph "a U (b U c)" {
1 [label="1"] 1 [label="1"]
1 -> 0 [label="c", style=bold, color="#FF4DA0"] 1 -> 0 [label="c", style=bold, color="#FF4DA0"]
1 -> 1 [label="b & !c", style=bold, color="#FF7F00"] 1 -> 1 [label="b & !c", style=bold, color="#FF7F00"]
2 [label="2", style="bold", color="#6A3D9A"] 2 [label="new\nline", style="bold", color="#6A3D9A"]
2 -> 0 [label="c", style=bold, color="#6A3D9A"] 2 -> 0 [label="c", style=bold, color="#6A3D9A"]
2 -> 1 [label="!a & b & !c"] 2 -> 1 [label="!a & b & !c"]
2 -> 2 [label="a & !c"] 2 -> 2 [label="a & !c"]
} }
EOF EOF
diff output9 expected9 diff output9 expected9
autfilt -dbar input9 > output9a
style=', style="bold", color="#1F78B4"'
cat >expected9a <<EOF
digraph "a U (b U c)" {
rankdir=LR
label=<Inf(<font color="#1F78B4">⓿</font>)<br/>[Büchi]>
labelloc="t"
I [label="", style=invis, width=0]
I -> 2
0 [label=<0<br/><font color="#1F78B4">⓿</font>>$style]
0 -> 0 [label=<1>, style=bold, color="#1F78B4"]
1 [label=<1>]
1 -> 0 [label=<c>, style=bold, color="#FF4DA0"]
1 -> 1 [label=<b &amp; !c>, style=bold, color="#FF7F00"]
2 [label=<new<br/>line>, style="bold", color="#6A3D9A"]
2 -> 0 [label=<c>, style=bold, color="#6A3D9A"]
2 -> 1 [label=<!a &amp; b &amp; !c>]
2 -> 2 [label=<a &amp; !c>]
}
EOF
diff output9a expected9a
# spot.hightlight.edges and spot.hightlight.states are not valid HOA # spot.hightlight.edges and spot.hightlight.states are not valid HOA
# v1 output, so they should only but output for HOA 1.1 # v1 output, so they should only but output for HOA 1.1