This commit is contained in:
Denis Merigoux 2021-11-29 10:36:33 +01:00
parent 095198f5ac
commit 82865c48da
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
3 changed files with 2280 additions and 2146 deletions

View File

@ -47,18 +47,6 @@ let remove_cb_first_lines : string -> string =
let remove_cb_last_lines : string -> string =
R.substitute ~rex:(R.regexp "<.*\n*</pre>") ~subst:(function _ -> "</pre>")
(** Partial application allowing to substitute operators by their unicode representation. *)
let substitute_arithmetics_op : string -> string =
R.substitute ~rex:(R.regexp "!=|<=|>=|--|->|\\*|\\/") ~subst:(function
| "!=" -> ""
| "<=" -> ""
| ">=" -> ""
| "--" -> ""
| "->" -> ""
| "*" -> "×"
| "/" -> "÷"
| s -> s)
(** Usage: [wrap_html source_files custom_pygments language fmt wrapped]
Prints an HTML complete page structure around the [wrapped] content. *)
@ -154,11 +142,10 @@ let rec law_structure_to_html (language : C.backend_lang) (fmt : Format.formatte
let t = pre_html t in
if t = "" then () else Format.fprintf fmt "<p class='law-text'>%s</p>" t
| A.CodeBlock (_, c, metadata) ->
let pprinted_c = substitute_arithmetics_op (Pos.unmark c) in
Format.fprintf fmt "<div class='code-wrapper%s'>\n<div class='filename'>%s</div>\n%s\n</div>"
(if metadata then " code-metadata" else "")
(Pos.get_file (Pos.get_position c))
(pygmentize_code (Pos.same_pos_as ("```catala\n" ^ pprinted_c ^ "```") c) language)
(pygmentize_code (Pos.same_pos_as ("```catala\n" ^ Pos.unmark c ^ "```") c) language)
| A.LawHeading (heading, children) ->
let h_number = heading.law_heading_precedence + 1 in
Format.fprintf fmt "<h%d class='law-heading'><a href='%s'>%s</a></h%d>\n" h_number

File diff suppressed because one or more lines are too long

View File

@ -1183,19 +1183,20 @@ let prestations_familiales (prestations_familiales_in : prestations_familiales_i
"Code de la sécurité sociale";
];
}
((match param_.obligation_scolaire with
| Avant _ -> true
(((match param_.obligation_scolaire with
| Avant _ -> true
| Pendant _ -> false
| Apres _ -> false)
|| (match param_.obligation_scolaire with
| Avant _ -> false
| Pendant _ -> true
| Apres _ -> false)
||
match param_.obligation_scolaire with
| Avant _ -> false
| Pendant _ -> false
| Apres _ -> false)
|| (match param_.obligation_scolaire with
| Avant _ -> false
| Pendant _ -> true
| Apres _ -> false)
|| (match param_.obligation_scolaire with
| Avant _ -> false
| Pendant _ -> false
| Apres _ -> true)
&& param_.remuneration_mensuelle <=$ plafond_l512_3_2_)
| Apres _ -> true)
&& param_.remuneration_mensuelle <=$ plafond_l512_3_2_)
then true
else raise EmptyError
with EmptyError -> false