Add String_with_vars.text_only
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
b4dd6565b2
commit
79f3506922
|
@ -272,3 +272,8 @@ let is_var { template; syntax_version = _ } ~name =
|
||||||
match template.parts with
|
match template.parts with
|
||||||
| [Var n] -> name = Var.full_name n
|
| [Var n] -> name = Var.full_name n
|
||||||
| _ -> false
|
| _ -> false
|
||||||
|
|
||||||
|
let text_only t =
|
||||||
|
match t.template.parts with
|
||||||
|
| [Text s] -> Some s
|
||||||
|
| _ -> None
|
||||||
|
|
|
@ -30,6 +30,9 @@ val virt_text : (string * int * int * int) -> string -> t
|
||||||
|
|
||||||
val is_var : t -> name:string -> bool
|
val is_var : t -> name:string -> bool
|
||||||
|
|
||||||
|
(** If [t] contains no variable, returns the contents of [t]. *)
|
||||||
|
val text_only : t -> string option
|
||||||
|
|
||||||
module Mode : sig
|
module Mode : sig
|
||||||
type 'a t =
|
type 'a t =
|
||||||
| Single : Value.t t
|
| Single : Value.t t
|
||||||
|
|
Loading…
Reference in New Issue