Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
6b0195a6
Commit
6b0195a6
authored
6 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[Lib/Markdown] optimisation of empty and nil
parent
d0f6ca84
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libraries/utils/markdown.ml
+17
-6
17 additions, 6 deletions
src/libraries/utils/markdown.ml
src/libraries/utils/markdown.mli
+1
-0
1 addition, 0 deletions
src/libraries/utils/markdown.mli
with
18 additions
and
6 deletions
src/libraries/utils/markdown.ml
+
17
−
6
View file @
6b0195a6
...
...
@@ -65,11 +65,13 @@ let local ctxt job data =
(* --- Combinators --- *)
(* -------------------------------------------------------------------------- *)
let
nil
_fmt
=
()
let
empty
=
nil
let
space
fmt
=
Format
.
pp_print_space
fmt
()
let
newline
fmt
=
Format
.
pp_print_newline
fmt
()
let
merge
sep
ds
fmt
=
match
ds
with
match
List
.
filter
(
fun
d
->
d
!=
nil
)
ds
with
|
[]
->
()
|
d
::
ds
->
d
fmt
;
List
.
iter
(
fun
d
->
sep
fmt
;
d
fmt
)
ds
...
...
@@ -78,9 +80,20 @@ let glue ?sep ds fmt =
|
None
->
List
.
iter
(
fun
d
->
d
fmt
)
ds
|
Some
s
->
merge
s
ds
fmt
let
(
<@>
)
a
b
fmt
=
a
fmt
;
b
fmt
let
(
<+>
)
a
b
fmt
=
a
fmt
;
space
fmt
;
b
fmt
let
(
</>
)
a
b
fmt
=
a
fmt
;
newline
fmt
;
b
fmt
let
(
<@>
)
a
b
=
if
a
==
empty
then
b
else
if
b
==
empty
then
a
else
fun
fmt
->
a
fmt
;
b
fmt
let
(
<+>
)
a
b
=
if
a
==
empty
then
b
else
if
b
==
empty
then
a
else
fun
fmt
->
a
fmt
;
space
fmt
;
b
fmt
let
(
</>
)
a
b
=
if
a
==
empty
then
b
else
if
b
==
empty
then
a
else
fun
fmt
->
a
fmt
;
newline
fmt
;
b
fmt
let
fmt_text
k
fmt
=
Format
.
fprintf
fmt
"@[<h 0>%t@]"
k
let
fmt_block
k
fmt
=
Format
.
fprintf
fmt
"@[<v 0>%t@]"
k
...
...
@@ -151,8 +164,6 @@ let href ?title (h : href) fmt =
(* --- Blocks --- *)
(* -------------------------------------------------------------------------- *)
let
empty
_fmt
=
()
let
aname
anchor
fmt
=
Format
.
fprintf
fmt
"<a name=
\"
%s
\"
></a>@
\n
"
anchor
...
...
This diff is collapsed.
Click to expand it.
src/libraries/utils/markdown.mli
+
1
−
0
View file @
6b0195a6
...
...
@@ -42,6 +42,7 @@ val (</>) : block -> block -> block (** Infix operator for [concat] *)
(** {2 Text Constructors} *)
val
nil
:
text
(** Empty *)
val
raw
:
string
->
text
(** inlined markdown format *)
val
rm
:
string
->
text
(** roman (normal) style *)
val
it
:
string
->
text
(** italic style *)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment