Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
126
Issues
126
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
50dd5ec3
Commit
50dd5ec3
authored
Apr 22, 2015
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shares the function that formats a string in HTML, escaping special
characters '. ", <, > and &
parent
100a0e7c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
13 deletions
+24
-13
src/session/session.ml
src/session/session.ml
+1
-10
src/session/session.mli
src/session/session.mli
+0
-1
src/util/pp.ml
src/util/pp.ml
+12
-0
src/util/pp.mli
src/util/pp.mli
+5
-0
src/why3doc/doc_lexer.mll
src/why3doc/doc_lexer.mll
+6
-2
No files found.
src/session/session.ml
View file @
50dd5ec3
...
@@ -533,16 +533,7 @@ let shape_filename = "why3shapes"
...
@@ -533,16 +533,7 @@ let shape_filename = "why3shapes"
let
compressed_shape_filename
=
"why3shapes.gz"
let
compressed_shape_filename
=
"why3shapes.gz"
let
session_dir_for_save
=
ref
"."
let
session_dir_for_save
=
ref
"."
let
save_string
fmt
s
=
let
save_string
=
Pp
.
html_string
for
i
=
0
to
String
.
length
s
-
1
do
match
String
.
get
s
i
with
|
'\"'
->
pp_print_string
fmt
"""
|
'\''
->
pp_print_string
fmt
"'"
|
'
<
'
->
pp_print_string
fmt
"<"
|
'
>
'
->
pp_print_string
fmt
">"
|
'
&
'
->
pp_print_string
fmt
"&"
|
c
->
pp_print_char
fmt
c
done
let
opt
pr
lab
fmt
=
function
let
opt
pr
lab
fmt
=
function
|
None
->
()
|
None
->
()
...
...
src/session/session.mli
View file @
50dd5ec3
...
@@ -205,7 +205,6 @@ val read_session: string -> unit session * bool
...
@@ -205,7 +205,6 @@ val read_session: string -> unit session * bool
*)
*)
val
save_session
:
Whyconf
.
config
->
'
key
session
->
unit
val
save_session
:
Whyconf
.
config
->
'
key
session
->
unit
(** Save a session on disk *)
(** Save a session on disk *)
...
...
src/util/pp.ml
View file @
50dd5ec3
...
@@ -206,6 +206,18 @@ let sprintf_wnl p =
...
@@ -206,6 +206,18 @@ let sprintf_wnl p =
kfprintf
(
fun
fmt
->
Format
.
pp_print_flush
fmt
()
;
Buffer
.
contents
b
)
fmt
p
kfprintf
(
fun
fmt
->
Format
.
pp_print_flush
fmt
()
;
Buffer
.
contents
b
)
fmt
p
let
html_string
fmt
s
=
for
i
=
0
to
String
.
length
s
-
1
do
match
String
.
get
s
i
with
|
'\"'
->
pp_print_string
fmt
"""
|
'\''
->
pp_print_string
fmt
"'"
|
'
<
'
->
pp_print_string
fmt
"<"
|
'
>
'
->
pp_print_string
fmt
">"
|
'
&
'
->
pp_print_string
fmt
"&"
|
c
->
pp_print_char
fmt
c
done
module
Ansi
=
module
Ansi
=
struct
struct
...
...
src/util/pp.mli
View file @
50dd5ec3
...
@@ -147,6 +147,11 @@ val sprintf :
...
@@ -147,6 +147,11 @@ val sprintf :
val
sprintf_wnl
:
val
sprintf_wnl
:
(
'
b
,
formatter
,
unit
,
string
)
Pervasives
.
format4
->
'
b
(
'
b
,
formatter
,
unit
,
string
)
Pervasives
.
format4
->
'
b
val
html_string
:
Format
.
formatter
->
string
->
unit
(** formats the string by escaping special HTML characters
quote, double quote, <, > and & *)
module
Ansi
:
module
Ansi
:
sig
sig
val
set_column
:
Format
.
formatter
->
int
->
unit
val
set_column
:
Format
.
formatter
->
int
->
unit
...
...
src/why3doc/doc_lexer.mll
View file @
50dd5ec3
...
@@ -81,6 +81,8 @@
...
@@ -81,6 +81,8 @@
t
t
end
end
let
pp_html_escape
=
Pp
.
html_string
let
current_file
=
ref
""
let
current_file
=
ref
""
let
print_ident
fmt
lexbuf
s
=
let
print_ident
fmt
lexbuf
s
=
...
@@ -96,9 +98,11 @@
...
@@ -96,9 +98,11 @@
try
try
match
Glob
.
find
loc
with
match
Glob
.
find
loc
with
|
id
,
Glob
.
Def
->
|
id
,
Glob
.
Def
->
fprintf
fmt
"<a name=
\"
%a
\"
>%s</a>"
Doc_def
.
pp_anchor
id
s
fprintf
fmt
"<a name=
\"
%a
\"
>%a</a>"
Doc_def
.
pp_anchor
id
pp_html_escape
s
|
id
,
Glob
.
Use
->
|
id
,
Glob
.
Use
->
fprintf
fmt
"<a href=
\"
%a
\"
>%s</a>"
Doc_def
.
pp_locate
id
s
fprintf
fmt
"<a href=
\"
%a
\"
>%a</a>"
Doc_def
.
pp_locate
id
pp_html_escape
s
with
Not_found
->
with
Not_found
->
(* otherwise, just print it *)
(* otherwise, just print it *)
pp_print_string
fmt
s
pp_print_string
fmt
s
...
...
Write
Preview
Markdown
is supported
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