From ce7da27ee23ca315b8549728e5241cb5dfd7857a Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Thu, 12 Dec 2024 05:44:13 +0900 Subject: [PATCH] Update deps Signed-off-by: Sora Morimoto --- .github/workflows/workflow.yml | 17 +--- .ocamlformat | 19 +---- dune-project | 35 +++------ html_of_wiki.opam | 12 +-- ohow-help.txt | 5 +- src/client/HTML5outliner.ml | 137 +++++++++++++++------------------ src/client/client.ml | 120 ++++++++++++++--------------- src/common/bridge.ml | 22 +++--- src/ohow/dune | 9 --- src/ohow/wikicreole.mli | 129 ------------------------------- src/wit/dune | 6 +- src/wit/wit.ml | 19 ++--- wit-help.txt | 2 +- 13 files changed, 166 insertions(+), 366 deletions(-) delete mode 100644 src/ohow/dune delete mode 100644 src/ohow/wikicreole.mli diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index e2e8875..7c51c11 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,8 +1,8 @@ -name: Main workflow +name: Builds, tests & co on: - pull_request: push: + pull_request: schedule: # Prime the caches every Monday - cron: 0 1 * * MON @@ -13,23 +13,18 @@ jobs: fail-fast: false matrix: os: - - macos-latest - ubuntu-latest + - macos-latest - windows-latest - runs-on: ${{ matrix.os }} - steps: - name: Checkout tree uses: actions/checkout@v4 - - name: Set-up OCaml uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: "4.14" - - run: opam install . --deps-only - - run: opam exec -- make all lint-doc: @@ -37,12 +32,10 @@ jobs: steps: - name: Checkout tree uses: actions/checkout@v4 - - name: Set-up OCaml uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: "4.14" - - uses: ocaml/setup-ocaml/lint-doc@v3 lint-fmt: @@ -50,12 +43,10 @@ jobs: steps: - name: Checkout tree uses: actions/checkout@v4 - - name: Set-up OCaml uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: "4.14" - - uses: ocaml/setup-ocaml/lint-fmt@v3 lint-opam: @@ -63,10 +54,8 @@ jobs: steps: - name: Checkout tree uses: actions/checkout@v4 - - name: Set-up OCaml uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: "4.14" - - uses: ocaml/setup-ocaml/lint-opam@v3 diff --git a/.ocamlformat b/.ocamlformat index cfcf346..d20e3da 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,20 +1,3 @@ -version=0.26.2 +version=0.27.0 profile=conventional -break-cases=fit-or-vertical -break-separators=before -break-sequences=true -cases-exp-indent=2 -doc-comments=before -dock-collection-brackets=false -field-space=loose -if-then-else=keyword-first -indicate-nested-or-patterns=unsafe-no -let-and=sparse -let-and=sparse parse-docstrings=true -sequence-style=terminator -space-around-arrays -space-around-lists -space-around-records -type-decl=sparse -wrap-comments=true diff --git a/dune-project b/dune-project index c1e0493..da3ebac 100644 --- a/dune-project +++ b/dune-project @@ -1,41 +1,26 @@ -(lang dune 2.0) - -(using menhir 2.0) - +(lang dune 3.17) (name html_of_wiki) +(generate_opam_files true) (implicit_transitive_deps false) (license "LGPL-2.1 with OCaml linking exception") - (authors "The ocsigen team ") - -(maintainers - "The ocsigen team " - "Leo Valais ") - -(source - (github ocsigen/html_of_wiki)) - -(bug_reports "https://github.com/ocsigen/html_of_wiki/issues") - -(homepage "https://github.com/ocsigen/html_of_wiki") - +(maintainers "The ocsigen team " "Leo Valais ") +(source (github ocsigen/html_of_wiki)) (documentation "https://ocsigen.org/html_of_wiki/2.0/manual/intro") -(generate_opam_files true) - (package (name html_of_wiki) (synopsis "A wikicreole to HTML compiler") - (description - "a static website generator for software projects, using wikicreole syntax.") + (description "a static website generator for software projects, using wikicreole syntax.") (depends + (ocaml (< 5.0)) ("cmdliner" (>= 1.1.1)) - "js_of_ocaml-ppx_deriving_json" + ("tyxml"(>= 4.6.0)) + "base64" "js_of_ocaml-ppx" + "js_of_ocaml-ppx_deriving_json" "ocamlfind" "re" - "base64" - "reason" - ("tyxml"(>= 4.6.0)))) + "reason")) diff --git a/html_of_wiki.opam b/html_of_wiki.opam index 5363c0a..bbeebbc 100644 --- a/html_of_wiki.opam +++ b/html_of_wiki.opam @@ -12,18 +12,20 @@ homepage: "https://github.com/ocsigen/html_of_wiki" doc: "https://ocsigen.org/html_of_wiki/2.0/manual/intro" bug-reports: "https://github.com/ocsigen/html_of_wiki/issues" depends: [ - "dune" {>= "2.0"} + "dune" {>= "3.17"} + "ocaml" {< "5.0"} "cmdliner" {>= "1.1.1"} - "js_of_ocaml-ppx_deriving_json" + "tyxml" {>= "4.6.0"} + "base64" "js_of_ocaml-ppx" + "js_of_ocaml-ppx_deriving_json" "ocamlfind" "re" - "base64" "reason" - "tyxml" {>= "4.6.0"} + "odoc" {with-doc} ] build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/ohow-help.txt b/ohow-help.txt index 5358f50..891669b 100644 --- a/ohow-help.txt +++ b/ohow-help.txt @@ -118,7 +118,8 @@ OPTIONS -r, --hl, --headless Produces raw HTML without head tag and not inside a body tag. - --root=DIR (absent=/home/hugo/html_of_wiki/_build/default) + --root=DIR + (absent=/Users/smorimoto/src/github.com/ocsigen/html_of_wiki/_build/default) Use the given root directory. -t FILE, --template=FILE @@ -134,7 +135,7 @@ COMMON OPTIONS Show version information. EXIT STATUS - ohow exits with the following status: + ohow exits with: 0 on success. diff --git a/src/client/HTML5outliner.ml b/src/client/HTML5outliner.ml index e728ae8..e8a78e8 100644 --- a/src/client/HTML5outliner.ml +++ b/src/client/HTML5outliner.ml @@ -10,14 +10,7 @@ let heading_content = [ "h1"; "h2"; "h3"; "h4"; "h5"; "h6"; "hgroup" ] (* The h1 element is said to have the highest rank, the h6 element has the lowest rank, and two elements with the same name have equal rank. *) -type rank = - | H6 - | H5 - | H4 - | H3 - | H2 - | H1 - | Top +type rank = H6 | H5 | H4 | H3 | H2 | H1 | Top type outline = section list and section = Section of Dom.node Js.t list * string option * outline @@ -28,22 +21,22 @@ type heading = | Unnamed of string | Named of (rank * Dom.node Js.t list * string option) -type state = - { heading : heading - ; outline : outline - ; context : ((rank * Dom.node Js.t list * string option) * outline) list - ; ignore : Dom.node Js.t -> bool - } +type state = { + heading : heading; + outline : outline; + context : ((rank * Dom.node Js.t list * string option) * outline) list; + ignore : Dom.node Js.t -> bool; +} exception FoundNode of Dom.node Js.t let find_first_heading node = let rec find node = let tag = String.lowercase_ascii (Js.to_string node##.nodeName) in - if List.mem tag [ "h1"; "h2"; "h3"; "h4"; "h5"; "h6" ] - then raise (FoundNode node) - else if not (List.mem tag sectionning_tag) - then List.iter find (Dom.list_of_nodeList node##.childNodes) + if List.mem tag [ "h1"; "h2"; "h3"; "h4"; "h5"; "h6" ] then + raise (FoundNode node) + else if not (List.mem tag sectionning_tag) then + List.iter find (Dom.list_of_nodeList node##.childNodes) in try find node; @@ -59,10 +52,9 @@ let find_previous_heading node = in let rec find node = let tag = String.lowercase_ascii (Js.to_string node##.nodeName) in - if List.mem tag [ "h1"; "h2"; "h3"; "h4"; "h5"; "h6" ] - then raise (FoundNode node) - else if not (List.mem tag sectionning_tag) - then ( + if List.mem tag [ "h1"; "h2"; "h3"; "h4"; "h5"; "h6" ] then + raise (FoundNode node) + else if not (List.mem tag sectionning_tag) then ( List.iter find (List.rev (Dom.list_of_nodeList node##.childNodes)); find (previous node)) in @@ -104,38 +96,40 @@ let get_fragment node = (fun s -> Some (Js.to_string s))) let unnamed tag = - [ (Dom_html.document##createTextNode (Js.string ("Unnamed " ^ tag)) - :> Dom.node Js.t) + [ + (Dom_html.document##createTextNode (Js.string ("Unnamed " ^ tag)) + :> Dom.node Js.t); ] let step_up st = match st.context with | [] -> assert false | (upper_heading, upper_outline) :: context -> - let heading, fragment = - match st.heading with - | Named (_, nodes, fragment) -> (nodes, fragment) - | Unnamed tag -> (unnamed tag, None) - in - { st with - heading = Named upper_heading - ; outline = - Section (heading, fragment, List.rev st.outline) :: upper_outline - ; context - } + let heading, fragment = + match st.heading with + | Named (_, nodes, fragment) -> (nodes, fragment) + | Unnamed tag -> (unnamed tag, None) + in + { + st with + heading = Named upper_heading; + outline = + Section (heading, fragment, List.rev st.outline) :: upper_outline; + context; + } let rec insert_heading st ((rank, _, _) as node) = match st.heading with | Unnamed _ -> assert false | Named ((candidate_rank, _, _) as candidate) -> - if candidate_rank > rank - then - { st with - heading = Named node - ; outline = [] - ; context = (candidate, st.outline) :: st.context - } - else insert_heading (step_up st) node + if candidate_rank > rank then + { + st with + heading = Named node; + outline = []; + context = (candidate, st.outline) :: st.context; + } + else insert_heading (step_up st) node let rec rebuild st = match (st.context, st.heading) with @@ -143,18 +137,17 @@ let rec rebuild st = | _, Named _ | _, Unnamed _ -> rebuild (step_up st) let init_st ?(ignore = fun _ -> false) tag = - { heading = Unnamed tag - ; outline = [] - ; context = [ ((Top, [], None), []) ] - ; ignore + { + heading = Unnamed tag; + outline = []; + context = [ ((Top, [], None), []) ]; + ignore; } let rec walk st node = let tag = String.lowercase_ascii (Js.to_string node##.nodeName) in - if st.ignore node - then st - else if List.mem tag heading_content - then + if st.ignore node then st + else if List.mem tag heading_content then let node = find_first_heading node in let childrens = List.map @@ -165,21 +158,18 @@ let rec walk st node = match st.heading with | Unnamed _ when st.outline = [] -> { st with heading = Named candidate } | Unnamed tag when st.context = [ ((Top, [], None), []) ] -> - { st with - heading = Named candidate - ; outline = [] - ; context = ((Top, unnamed tag, fragment), st.outline) :: st.context - } + { + st with + heading = Named candidate; + outline = []; + context = ((Top, unnamed tag, fragment), st.outline) :: st.context; + } | Unnamed _ -> assert false | Named _ -> insert_heading st candidate - else if List.mem tag sectionning_root - then st (* ignore these nodes... *) - else if List.mem tag sectionning_content - then + else if List.mem tag sectionning_root then st (* ignore these nodes... *) + else if List.mem tag sectionning_content then let st = - match st.context with - | [] | [ ((Top, _, _), _) ] -> st - | _ -> step_up st + match st.context with [] | [ ((Top, _, _), _) ] -> st | _ -> step_up st in let nodes = Dom.list_of_nodeList node##.childNodes in let outline = @@ -209,14 +199,9 @@ let find_fragment fragment outline = | Section (_, _, outline) -> find_l outline and find_l = function | [] -> None - | x :: xs -> ( - match find x with - | None -> find_l xs - | Some _ as x -> x) + | x :: xs -> ( match find x with None -> find_l xs | Some _ as x -> x) in - match find_l outline with - | None -> [] - | Some x -> x + match find_l outline with None -> [] | Some x -> x let rec build_ol ?(depth = 0) outline = (* depth = 0 means as deep as infinity (for a value of infinity equal to @@ -232,10 +217,10 @@ and build_li ~depth (Section (heading, fragment, outline)) = (match fragment with | None -> List.iter (Dom.appendChild li) heading | Some fragment -> - let a = Dom_html.createA Dom_html.document in - a##setAttribute (Js.string "href") (Js.string @@ "#" ^ fragment); - List.iter (Dom.appendChild a) heading; - Dom.appendChild li a); - if outline <> [] && depth <> 0 - then Dom.appendChild li (build_ol ~depth outline); + let a = Dom_html.createA Dom_html.document in + a##setAttribute (Js.string "href") (Js.string @@ "#" ^ fragment); + List.iter (Dom.appendChild a) heading; + Dom.appendChild li a); + if outline <> [] && depth <> 0 then + Dom.appendChild li (build_ol ~depth outline); li diff --git a/src/client/client.ml b/src/client/client.ml index 27f16c8..43935d3 100644 --- a/src/client/client.ml +++ b/src/client/client.ml @@ -15,50 +15,46 @@ let () = let elem, restrict2 = match elem with | `Id id -> - ( (Dom_html.document##getElementById (Js.string id) - :> Dom.node Js.t Js.opt) - , None ) + ( (Dom_html.document##getElementById (Js.string id) + :> Dom.node Js.t Js.opt), + None ) | `Container -> - let fragment = - if div - then - try - Js.Opt.case - (HTML5outliner.find_previous_heading nav) - (fun () -> None) - (fun x -> HTML5outliner.get_fragment x) - with Not_found -> None - else None - in - (HTML5outliner.find_container nav, fragment) + let fragment = + if div then + try + Js.Opt.case + (HTML5outliner.find_previous_heading nav) + (fun () -> None) + (fun x -> HTML5outliner.get_fragment x) + with Not_found -> None + else None + in + (HTML5outliner.find_container nav, fragment) in let restrict = - match restrict with - | None -> restrict2 - | _ -> restrict + match restrict with None -> restrict2 | _ -> restrict in match Js.Opt.to_option elem with | None -> () | Some elem -> - let outline = - HTML5outliner.outline ~ignore - (Dom.list_of_nodeList elem##.childNodes) - in - let outline = - match restrict with - | Some fragment -> HTML5outliner.find_fragment fragment outline - | None -> ( - match outline with - | [ HTML5outliner.Section (_, _, outline) ] -> outline - | _ -> outline) - in - Dom.appendChild nav (HTML5outliner.build_ol ?depth outline) + let outline = + HTML5outliner.outline ~ignore + (Dom.list_of_nodeList elem##.childNodes) + in + let outline = + match restrict with + | Some fragment -> HTML5outliner.find_fragment fragment outline + | None -> ( + match outline with + | [ HTML5outliner.Section (_, _, outline) ] -> outline + | _ -> outline) + in + Dom.appendChild nav (HTML5outliner.build_ol ?depth outline) end) let to_list l = let rec f acc i = - if i < l##.length - then + if i < l##.length then match Js.Opt.to_option (l##item i) with | None -> f acc (i + 1) | Some x -> f (x :: acc) (i + 1) @@ -103,15 +99,15 @@ let translate existing = match Js.Opt.to_option existing##.textContent with | None -> () | Some ocaml -> ( - try - (* to_bytestring is required because there are 0xa0 bytes *) - let reason = ocaml |> Js.to_bytestring |> to_reason |> Js.string in - let code' = create_code ~language:"reason" reason in - insert_after ~existing code'; - highlight_element code'; - (* remove translatable, so that we only do this once *) - existing##.className := Js.string "language-ocaml" - with _e -> existing##.className := Js.string "language-ocaml error") + try + (* to_bytestring is required because there are 0xa0 bytes *) + let reason = ocaml |> Js.to_bytestring |> to_reason |> Js.string in + let code' = create_code ~language:"reason" reason in + insert_after ~existing code'; + highlight_element code'; + (* remove translatable, so that we only do this once *) + existing##.className := Js.string "language-ocaml" + with _e -> existing##.className := Js.string "language-ocaml error") let convert pre = let code = Dom_html.(createCode document) in @@ -123,8 +119,9 @@ let convert pre = let remove_error_message n = let p = Js.Unsafe.coerce n in - if Js.string p##.firstChild == Js.string "[object Text]" - && p##.firstChild##.data == Js.string reason_error + if + Js.string p##.firstChild == Js.string "[object Text]" + && p##.firstChild##.data == Js.string reason_error then Js.Opt.iter n##.firstChild (fun c -> ignore (n##removeChild c)) let add_error_message n = @@ -137,8 +134,7 @@ let toggle_reason () = to_list (Dom_html.document##getElementsByTagName n) |> List.iter (fun body -> let class_list = body##.classList in - if Js.to_bool (class_list##contains (Js.string "reason")) - then ( + if Js.to_bool (class_list##contains (Js.string "reason")) then ( let t = Js.string "language-ocaml error" in to_list (Dom_html.document##getElementsByClassName t) |> List.iter remove_error_message; @@ -161,26 +157,26 @@ let () = (match Dom_html.(getElementById_coerce "search" CoerceTo.form) with | None -> () | Some form -> - form##.onsubmit := - Dom_html.handler @@ fun _ -> - let engine = "https://google.com/search?q=" in - let filter = " site:ocsigen.org" in - let q = - (match Dom_html.(getElementById_coerce "q" CoerceTo.input) with - | None -> filter - | Some q -> Js.to_string q##.value ^ filter) - |> Js.string |> Js.encodeURIComponent |> Js.to_string - in - Dom_html.window##.location##.href := Js.string (engine ^ q); - Js.bool false); + form##.onsubmit := + Dom_html.handler @@ fun _ -> + let engine = "https://google.com/search?q=" in + let filter = " site:ocsigen.org" in + let q = + (match Dom_html.(getElementById_coerce "q" CoerceTo.input) with + | None -> filter + | Some q -> Js.to_string q##.value ^ filter) + |> Js.string |> Js.encodeURIComponent |> Js.to_string + in + Dom_html.window##.location##.href := Js.string (engine ^ q); + Js.bool false); (* language switch *) (match Dom_html.getElementById_opt "reason" with | None -> () | Some btn -> - btn##.onclick := - Dom_html.handler @@ fun _ -> - toggle_reason (); - Js.bool true); + btn##.onclick := + Dom_html.handler @@ fun _ -> + toggle_reason (); + Js.bool true); (* API conversion *) let f = Js.string "odocwiki_code" in to_list (Dom_html.document##getElementsByClassName f) diff --git a/src/common/bridge.ml b/src/common/bridge.ml index 890a50b..cb2c0ff 100644 --- a/src/common/bridge.ml +++ b/src/common/bridge.ml @@ -1,17 +1,13 @@ [@@@ocaml.warning "-39"] -type elem = - [ `Id of string - | `Container - ] -[@@deriving json] +type elem = [ `Id of string | `Container ] [@@deriving json] -type outline_params = - { elem : elem - ; restrict : string option - ; depth : int option - ; ignore : string list - ; nav : string - ; div : bool - } +type outline_params = { + elem : elem; + restrict : string option; + depth : int option; + ignore : string list; + nav : string; + div : bool; +} [@@deriving json] diff --git a/src/ohow/dune b/src/ohow/dune deleted file mode 100644 index 60205ec..0000000 --- a/src/ohow/dune +++ /dev/null @@ -1,9 +0,0 @@ -(executables - (names ohow) - (public_names ohow) - (package html_of_wiki) - (libraries tyxml tyxml.functor re cmdliner unix common base64) - (modules_without_implementation wiki_syntax_types)) - -(ocamllex - (modules wikicreole)) diff --git a/src/ohow/wikicreole.mli b/src/ohow/wikicreole.mli deleted file mode 100644 index 26fadbd..0000000 --- a/src/ohow/wikicreole.mli +++ /dev/null @@ -1,129 +0,0 @@ -(* Ocsimore - * Copyright (C) 2008 - * Laboratoire PPS - Universit� Paris Diderot - CNRS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *) -(** Parser for Wikicreole - - @author Jerome Vouillon - @author Vincent Balat - @author Boris Yakobowski *) - -(** Xml-like attributes for the extension (eg val='foo') *) -type attribs = (string * string) list - -module type RawBuilder = sig - type href - type param - type phrasing_without_interactive - type phrasing - type flow - type flow_without_interactive - type uo_list - - val chars : string -> phrasing_without_interactive - val strong_elem : attribs -> phrasing list -> phrasing_without_interactive - val em_elem : attribs -> phrasing list -> phrasing_without_interactive - val br_elem : attribs -> phrasing_without_interactive - val img_elem : attribs -> href -> string -> phrasing_without_interactive - val tt_elem : attribs -> phrasing list -> phrasing_without_interactive - val monospace_elem : attribs -> phrasing list -> phrasing_without_interactive - val underlined_elem : attribs -> phrasing list -> phrasing_without_interactive - - val linethrough_elem : - attribs -> phrasing list -> phrasing_without_interactive - - val subscripted_elem : - attribs -> phrasing list -> phrasing_without_interactive - - val superscripted_elem : - attribs -> phrasing list -> phrasing_without_interactive - - val nbsp : phrasing_without_interactive - val endash : phrasing_without_interactive - val emdash : phrasing_without_interactive - - val a_elem_phrasing : - attribs -> href -> phrasing_without_interactive list -> phrasing - - val a_elem_flow : attribs -> href -> flow_without_interactive list -> flow - val make_href : param -> string -> string option -> href - - (* the string option is the fragment part of the URL (#...)*) - - val string_of_href : href -> string - val p_elem : attribs -> phrasing list -> flow_without_interactive - val pre_elem : attribs -> string list -> flow_without_interactive - val h1_elem : attribs -> phrasing list -> flow_without_interactive - val h2_elem : attribs -> phrasing list -> flow_without_interactive - val h3_elem : attribs -> phrasing list -> flow_without_interactive - val h4_elem : attribs -> phrasing list -> flow_without_interactive - val h5_elem : attribs -> phrasing list -> flow_without_interactive - val h6_elem : attribs -> phrasing list -> flow_without_interactive - val section_elem : attribs -> flow list -> flow_without_interactive - - val ul_elem : - attribs -> (phrasing list * uo_list option * attribs) list -> uo_list - - val ol_elem : - attribs -> (phrasing list * uo_list option * attribs) list -> uo_list - - val dl_elem : - attribs -> (bool * phrasing list * attribs) list -> flow_without_interactive - - val hr_elem : attribs -> flow_without_interactive - - val table_elem : - attribs - -> ((bool * attribs * phrasing list) list * attribs) list - -> flow_without_interactive - - val phrasing : phrasing_without_interactive -> phrasing - val flow : flow_without_interactive -> flow - val list : uo_list -> flow_without_interactive - val error : string -> phrasing_without_interactive -end - -(** *) -type (-'param, +'res) plugin = 'param -> attribs -> string option -> 'res - -type plugin_resolver = Resolver of (string -> plugin_resolver option) - -module type Builder = sig - include RawBuilder - - type plugin_content = - [ `Flow5_link of href * attribs * flow_without_interactive - | `Phrasing_link of href * attribs * phrasing_without_interactive - | `Flow5 of flow - | `Phrasing_without_interactive of phrasing_without_interactive - ] - - val plugin : string -> plugin_resolver option * (param, plugin_content) plugin - val plugin_action : string -> int -> int -> (param, unit) plugin - - val link_action : - string -> string option -> attribs -> int * int -> param -> unit - - val href_action : - string -> string option -> attribs -> int * int -> param -> unit -end - -type ('param, 'res) builder = - (module Builder with type param = 'param and type flow = 'res) - -val from_string : - ?sectioning:bool -> 'param -> ('param, 'res) builder -> string -> 'res list diff --git a/src/wit/dune b/src/wit/dune index 9c02af9..e6c807e 100644 --- a/src/wit/dune +++ b/src/wit/dune @@ -1,5 +1,5 @@ -(executables - (names wit) - (public_names wit) +(executable + (name wit) + (public_name wit) (package html_of_wiki) (libraries cmdliner re)) diff --git a/src/wit/wit.ml b/src/wit/wit.ml index 5bb42ce..ada3f5e 100644 --- a/src/wit/wit.ml +++ b/src/wit/wit.ml @@ -29,8 +29,8 @@ let main template = match replace_content_tag tmpl wiki with | Some replacement -> print_string replacement | None -> - Printf.fprintf stderr "no <> tag found in template\n"; - exit 1 + Printf.fprintf stderr "no <> tag found in template\n"; + exit 1 let tmpl_cmd = let doc = "The template to put the wiki into." in @@ -43,16 +43,17 @@ let info_cmd = "Inlines a wikicreole file into another one with a <> tag." in let man = - [ `S Manpage.s_description - ; `P + [ + `S Manpage.s_description; + `P "$(tname) reads wikicreole content from stdin and inserts it inside \ the given template file $(b,TMPL) in place of the first <> \ - tag found and outputs the result on stdout." - ; `P "The $(b,TMPL) file is never modified." - ; `S Manpage.s_bugs - ; `P + tag found and outputs the result on stdout."; + `P "The $(b,TMPL) file is never modified."; + `S Manpage.s_bugs; + `P "Escaping <> tags has no effect, the tag is still \ - recognized." + recognized."; ] in Cmd.info "wit" ~version:"v0.0.0" ~doc ~man) diff --git a/wit-help.txt b/wit-help.txt index 242bec7..2c92bff 100644 --- a/wit-help.txt +++ b/wit-help.txt @@ -26,7 +26,7 @@ COMMON OPTIONS Show version information. EXIT STATUS - wit exits with the following status: + wit exits with: 0 on success.