Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Mohamed Hernouf
www
Commits
84ce10cc
Commit
84ce10cc
authored
Nov 04, 2021
by
Artemiy
Browse files
linkify tags
parent
4e6863cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
src/blog.ml
src/blog.ml
+12
-17
No files found.
src/blog.ml
View file @
84ce10cc
...
...
@@ -249,6 +249,13 @@ let categories_count =
let
l
=
Hashtbl
.
fold
(
fun
k
v
acc
->
(
k
,
v
)
::
acc
)
tbl
[]
in
List
.
sort
(
fun
(
k1
,
v1
)
(
k2
,
v2
)
->
compare
(
v2
,
k2
)
(
v1
,
k1
))
l
let
pp_list_to_blog_links
t
=
Format
.
pp_print_list
~
pp_sep
:
(
fun
fmt
()
->
Format
.
fprintf
fmt
", "
)
(
fun
fmt
e
->
Format
.
fprintf
fmt
{
|<
a
href
=
"/blog/%s/%s"
>%
s
</
a
>|
}
t
(
normalize_url
e
)
e
)
let
links_to_home_pages
=
Format
.
sprintf
{
|
...
...
@@ -303,17 +310,11 @@ let pp_article_excerpt fmt article =
<
br
/>
%
s
<
a
href
=
"/blog/%s"
>
(
Read
more
)
</
a
>|
}
article
.
url
article
.
title
(
Format
.
pp_print_list
~
pp_sep
:
(
fun
fmt
()
->
Format
.
fprintf
fmt
", "
)
(
fun
fmt
author
->
Format
.
fprintf
fmt
{
|<
a
href
=
"/blog/authors/%s"
>%
s
</
a
>|
}
(
normalize_url
author
)
author
)
)
(
pp_list_to_blog_links
"authors"
)
article
.
authors
year
month
day
(
normalize_url
article
.
category
)
article
.
category
(
Format
.
pp_print_list
~
pp_sep
:
(
fun
fmt
()
->
Format
.
fprintf
fmt
", "
)
Format
.
pp_print_string
)
(
pp_list_to_blog_links
"tag"
)
article
.
tags
(
preview
article
.
content
)
article
.
url
let
pp_blog_posts
fmt
articles_data_list
=
...
...
@@ -332,7 +333,7 @@ let specific_article_header title authors (year, month, day) category tags =
<
div
class
=
"row"
>
<
div
class
=
"col-lg-3"
>
<
img
class
=
"icon"
src
=
"/blog/assets/img/icon_person.svg"
/>
Author
:
%
a
Author
s
:
%
a
</
div
>
<
div
class
=
"col-lg-2"
>
<
img
class
=
"icon"
src
=
"/blog/assets/img/icon_calendar.svg"
/>
...
...
@@ -354,15 +355,9 @@ let specific_article_header title authors (year, month, day) category tags =
<
hr
class
=
"featurette-divider"
/>
<
br
/>|
}
title
(
Format
.
pp_print_list
~
pp_sep
:
(
fun
fmt
()
->
Format
.
fprintf
fmt
", "
)
(
fun
fmt
author
->
Format
.
fprintf
fmt
{
|<
a
href
=
"/blog/authors/%s"
>%
s
</
a
>|
}
(
normalize_url
author
)
author
)
)
(
pp_list_to_blog_links
"authors"
)
authors
year
month
day
(
normalize_url
category
)
category
(
Format
.
pp_print_list
~
pp_sep
:
(
fun
fmt
()
->
Format
.
fprintf
fmt
", "
)
Format
.
pp_print_string
)
(
pp_list_to_blog_links
"tag"
)
tags
(** [given_category category] Displays the list of articles corresponding to the
...
...
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