Skip to content

Commit 84ce517

Browse files
committed
Merge remote-tracking branch 'upstream/master' into oauth-moodle-dev
2 parents ac11ad5 + 431113f commit 84ce517

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

demo-repository/exercises/demo2/descr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
2-
This exercise is just another demo for the exercise environment.
1+
The following example link will open another tab/window: [OCaml](https://ocaml.org "External link")
2+
This exercise is just another demo for the exercise environment.
33
<a href="" onclick="top.location='/exercises/demo/';">Test</a>
44

55
<details>

dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(rule
44
(targets VERSION)
55
(action (with-stdout-to %{targets}
6-
(run opam show ./%{dep:./learn-ocaml.opam} -f version --normalise)))
6+
(run opam show --color=never ./%{dep:./learn-ocaml.opam} -f version --normalise)))
77
)
88

99
(env

learn-ocaml-client.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ depends: [
1717
"base" {>= "v0.9.4"}
1818
"base64"
1919
"cmdliner"
20-
"omd"
20+
"omd" {<= "1.3.1"}
2121
"asak"
2222
"cohttp" {>= "1.0.0" & < "2.0.0"}
2323
"cohttp-lwt-unix" {>= "1.0.0" & < "2.0.0"}

learn-ocaml.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ depends: [
4848
"ocp-ocamlres" {>= "0.4"}
4949
"ocplib-json-typed" {= "0.6"}
5050
"odoc" {build & >= "1.3.0"}
51-
"omd"
51+
"omd" {<= "1.3.1"}
5252
"pprint"
5353
"ppx_cstruct"
5454
"ppx_tools"

src/repo/learnocaml_exercise.ml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,25 @@ module File = struct
317317
descrs := (lang, f raw) :: !descrs;
318318
return ()
319319
in
320+
let override_url = function
321+
| Omd_representation.Url(href,s,title) ->
322+
if String.length href > 0 then
323+
if Char.equal (String.get href 0) '#' then
324+
None
325+
else
326+
let title_url =
327+
if title <> "" then Printf.sprintf {| title="%s"|}
328+
(Omd_utils.htmlentities ~md:true title) else "" in
329+
let html =
330+
Printf.sprintf
331+
{|<a href="%s" target="_blank" rel="noopener noreferrer"%s>%s</a>|}
332+
(Omd_utils.htmlentities ~md:true href) title_url
333+
(Omd_backend.html_of_md s) in
334+
Some html
335+
else None
336+
| _ -> None in
320337
let markdown_to_html md =
321-
Omd.(md |> of_string |> to_html)
338+
Omd.(md |> of_string |> to_html ~override:override_url)
322339
in
323340
let read_descrs () =
324341
let langs = [] in

0 commit comments

Comments
 (0)