diff --git a/.gitignore b/.gitignore index 37444d9..6dce65a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,10 @@ -_build/ -_config/ -.*.swp -tests/*.cmi -tests/*.cmo -tests/render_pp.ml -tests/render -tests/a.out -tests/extension_pp.ml -tests/test -tests/basic.html -configure -setup.log -setup.ml -myocamlbuild.ml -*.mldylib -*.mllib -*.odocl -*.mlpack -**/META +_build +tmp *~ -setup.data -cow.docdir -_tags +\.\#* +\#*# +*.install *.native +*.byte _tests -tests/_tests +basic.html diff --git a/.merlin b/.merlin index 15f0bde..0e0495c 100644 --- a/.merlin +++ b/.merlin @@ -1,3 +1,4 @@ -PKG omd ezjsonm xmlm cow alcotest -S lib -B _build/lib +PKG bytes +S src +S test +B _build/** diff --git a/.ocp-indent b/.ocp-indent new file mode 100644 index 0000000..6c5b8f4 --- /dev/null +++ b/.ocp-indent @@ -0,0 +1 @@ +strict_with=always,match_clause=4,strict_else=never diff --git a/.travis.yml b/.travis.yml index 8679473..e5c997d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,5 @@ sudo: required install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-opam.sh script: bash -ex .travis-opam.sh env: - - OCAML_VERSION=4.01 REVDEPS=* PACKAGE=cow.2.0.1 - - OCAML_VERSION=4.02 REVDEPS=* PACKAGE=cow.2.0.1 - - OCAML_VERSION=4.03 REVDEPS=* PACKAGE=cow.2.0.1 + - OCAML_VERSION=4.02 REVDEPS=* PACKAGE=cow + - OCAML_VERSION=4.03 REVDEPS=* PACKAGE=cow diff --git a/CHANGES b/CHANGES.md similarity index 91% rename from CHANGES rename to CHANGES.md index d939c6f..fc827e5 100644 --- a/CHANGES +++ b/CHANGES.md @@ -1,3 +1,13 @@ +2.2.0: +* Port to use module aliases, so there are now `Cow_xml` `Cow_html` + `Cow_xhtml` `Cow_markdown` `Cow_json` and `Cow_atom` modules, + with aliases to the old scheme under the `Cow` module (e.g. `Cow.Xml`). + Existing code should continue to work, but the whole compilation unit + is no longer linked in if just a single method of output is used. + This bumps the minimum OCaml version to 4.02.3 due to the use of + module-level aliases. +* Switch build system to use `topkg` instead of `oasis`, and adhere + to the `opkg` layout format. 2.1.0 (21-May-2016): * Add description lists (dl/dt/dd) * Add ~licls/~dtcls/~ddcls to Html.ul/ol/dl. Setting classes of child diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/_tags b/_tags new file mode 100644 index 0000000..e907139 --- /dev/null +++ b/_tags @@ -0,0 +1,7 @@ +true : annot, bin_annot, safe_string, package(bytes) +true : package(uri), package(xmlm), package(ezjsonm), package(omd) +true : principal, strict-sequence + : include +: no_alias_deps + : include + : package(alcotest) diff --git a/build b/build new file mode 100755 index 0000000..6a439e3 --- /dev/null +++ b/build @@ -0,0 +1,24 @@ +#!/bin/sh +# This script is only used for developement. It is removed by the +# distribution process. + +set -e + +OCAMLBUILD=${OCAMLBUILD:="ocamlbuild -use-ocamlfind -classic-display \ + -tag debug"} + +action () +{ + case $1 in + default) topkg build ;; + test|tests) topkg build && topkg test ;; + doc) shift; topkg doc --dev $* ;; + api-doc) shift; topkg doc $* ;; + clean) topkg clean ;; + *) $OCAMLBUILD $* ;; + esac +} + +if [ $# -eq 0 ]; +then action default ; +else action $*; fi diff --git a/doc/api.odocl b/doc/api.odocl new file mode 100644 index 0000000..8016bcd --- /dev/null +++ b/doc/api.odocl @@ -0,0 +1,7 @@ +Cow +Cow_html +Cow_xhtml +Cow_atom +Cow_markdown +Cow_json +Cow_xml diff --git a/doc/dev.odocl b/doc/dev.odocl new file mode 100644 index 0000000..8016bcd --- /dev/null +++ b/doc/dev.odocl @@ -0,0 +1,7 @@ +Cow +Cow_html +Cow_xhtml +Cow_atom +Cow_markdown +Cow_json +Cow_xml diff --git a/doc/style.css b/doc/style.css new file mode 100644 index 0000000..d0a8c4b --- /dev/null +++ b/doc/style.css @@ -0,0 +1,112 @@ +/* Copyright (c) 2016 Daniel C. Bünzli. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. */ + +/* Reset a few things. */ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre, +a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp, +small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset, +form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td +{ margin: 0; padding: 0; border: 0 none; outline: 0; font-size: 100%; + font-weight: inherit; font-style:inherit; font-family:inherit; + line-height: inherit; vertical-align: baseline; text-align:inherit; + color:inherit; background: transparent; } + +table { border-collapse: collapse; border-spacing: 0; } + +/* Basic page layout */ + +body { font: normal 10pt/1.375em helvetica, arial, sans-serif; text-align:left; + margin: 1.375em 10%; min-width: 40ex; max-width: 72ex; + color: black; background: transparent /* url(line-height-22.gif) */; } + +b { font-weight: bold } +em { font-style: italic } + +tt, code, pre { font-family: WorkAroundWebKitAndMozilla, monospace; + font-size: 1em; } +pre code { font-size : inherit; } +.codepre { margin-bottom:1.375em /* after code example we introduce space. */ } + +.superscript,.subscript +{ font-size : 0.813em; line-height:0; margin-left:0.4ex;} +.superscript { vertical-align: super; } +.subscript { vertical-align: sub; } + +/* ocamldoc markup workaround hacks */ + +hr, hr + br, div + br, center + br, span + br, ul + br, ol + br, pre + br +{ display: none } /* annoying */ + +div.info + br { display:block} + +.codepre br + br { display: none } +h1 + pre { margin-bottom:1.375em} /* Toplevel module description */ + +/* Sections and document divisions */ + +/* .navbar { margin-bottom: -1.375em } */ +h1 { font-weight: bold; font-size: 1.5em; /* margin-top:1.833em; */ + margin-top:0.917em; padding-top:0.875em; + border-top-style:solid; border-width:1px; border-color:#AAA; } +h2 { font-weight: bold; font-size: 1.313em; margin-top: 1.048em } +h3 { font-weight: bold; font-size: 1.125em; margin-top: 1.222em } +h3 { font-weight: bold; font-size: 1em; margin-top: 1.375em} +h4 { font-style: italic; } + +/* Used by OCaml's own library documentation. */ + h6 { font-weight: bold; font-size: 1.125em; margin-top: 1.222em } + .h7 { font-weight: bold; font-size: 1em; margin-top: 1.375em } + +p { margin-top: 1.375em } +pre { margin-top: 1.375em } +.info { margin: 0.458em 0em -0.458em 2em;}/* Description of types values etc. */ +td .info { margin:0; padding:0; margin-left: 2em;} /* Description in indexes */ + +ul, ol { margin-top:0.688em; padding-bottom:0.687em; + list-style-position:outside} +ul + p, ol + p { margin-top: 0em } +ul { list-style-type: square } + + +/* h2 + ul, h3 + ul, p + ul { } */ +ul > li { margin-left: 1.375em; } +ol > li { margin-left: 1.7em; } +/* Links */ + +a, a:link, a:visited, a:active, a:hover { color : #00B; text-decoration: none } +a:hover { text-decoration : underline } +*:target {background-color: #FFFF99;} /* anchor highlight */ + +/* Code */ + +.keyword { font-weight: bold; } +.comment { color : red } +.constructor { color : green } +.string { color : brown } +.warning { color : red ; font-weight : bold } + +/* Functors */ + +.paramstable { border-style : hidden ; padding-bottom:1.375em} +.paramstable code { margin-left: 1ex; margin-right: 1ex } +.sig_block {margin-left: 1em} + +/* Images */ + +img { margin-top: 1.375em } + +/*--------------------------------------------------------------------------- + Copyright (c) 2016 Daniel C. Bünzli + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ---------------------------------------------------------------------------*/ diff --git a/opam b/opam index b72cb1a..6e31479 100644 --- a/opam +++ b/opam @@ -1,38 +1,25 @@ opam-version: "1.2" -maintainer: "anil@recoil.org" -license: "ISC" -homepage: "https://github.com/mirage/ocaml-cow" -dev-repo: "https://github.com/mirage/ocaml-cow.git" -bug-reports: "https://github.com/mirage/ocaml-cow/issues" -authors: [ - "Anil Madhavapeddy" - "Thomas Gazagnaire" - "David Sheets" - "Rudi Grinberg" - "Timothy Bourke" -] -tags: [ - "org:mirage" - "org:xapi-project" - "www" - "html" - "xml" - "css" - "json" - "markdown" -] - -build: [make "PREFIX=%{prefix}%"] -install: [make "install"] -remove: ["ocamlfind" "remove" "cow"] - +maintainer: "Anil Madhavapeddy " +authors: ["Anil Madhavapeddy" "Thomas Gazagnaire" "David Sheets" + "Rudi Grinberg" "Timothy Bourke"] +homepage: "https://github.com/mirage/ocaml-cow" +doc: "http://mirage.github.io/ocaml-cow" +license: "ISC" +dev-repo: "https://github.com/mirage/ocaml-cow.git" +bug-reports: "https://github.com/mirage/ocaml-cow/issues" +tags: ["org:mirage" "org:xapi-project" "www" "html" "xml" + "css" "json" "markdown" ] +available: [ ocaml-version >= "4.02.3"] depends: [ - "ocamlfind" {build} + "ocamlfind" {build} "ocamlbuild" {build} - "oasis" {build} - "uri" {>= "1.3.9"} - "xmlm" {>= "1.1.1"} - "omd" {>= "0.8.2"} + "topkg" {build} + "uri" {>= "1.3.9"} + "xmlm" {>= "1.1.1"} + "omd" {>= "0.8.2"} "ezjsonm" {>= "0.4.0"} + "alcotest" {test} ] -available: [ocaml-version >= "4.01"] +build: [ + "ocaml" "pkg/pkg.ml" "build" + "--pinned" pinned ] diff --git a/pkg/META b/pkg/META new file mode 100644 index 0000000..192198d --- /dev/null +++ b/pkg/META @@ -0,0 +1,7 @@ +description = "Camel on the Web (CoW)" +version = "%%VERSION%%" +requires = "xmlm uri ezjsonm omd" +archive(byte) = "cow_lib.cma" +archive(native) = "cow_lib.cmxa" +plugin(byte) = "cow_lib.cma" +plugin(native) = "cow_lib.cmxs" diff --git a/pkg/pkg.ml b/pkg/pkg.ml new file mode 100755 index 0000000..a75b90d --- /dev/null +++ b/pkg/pkg.ml @@ -0,0 +1,10 @@ +#!/usr/bin/env ocaml +#use "topfind" +#require "topkg" +open Topkg + +let () = + Pkg.describe "cow" @@ fun c -> + Ok [ Pkg.mllib "src/cow_lib.mllib"; + Pkg.test "test/test"; + Pkg.test "test/basic" ] diff --git a/lib/.merlin b/src/.merlin similarity index 100% rename from lib/.merlin rename to src/.merlin diff --git a/src/cow.ml b/src/cow.ml new file mode 100644 index 0000000..7e6324d --- /dev/null +++ b/src/cow.ml @@ -0,0 +1,6 @@ +module Xml = Cow_xml +module Json = Cow_json +module Markdown = Cow_markdown +module Html = Cow_html +module Xhtml = Cow_xhtml +module Atom = Cow_atom diff --git a/src/cow.mli b/src/cow.mli new file mode 100644 index 0000000..24987f0 --- /dev/null +++ b/src/cow.mli @@ -0,0 +1,28 @@ +(* + * Copyright (c) 2016 Anil Madhavapeddy + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + *) + +(** Camel on the Web (CoW) library. + + This library includes module aliases for various useful Web formats + such as XML, XHTML, JSON, Markdown and Atom. In many cases, you can + also use the constitutent libraries directly. *) + +module Xml = Cow_xml +module Json = Cow_json +module Markdown = Cow_markdown +module Html = Cow_html +module Xhtml = Cow_xhtml +module Atom = Cow_atom diff --git a/lib/atom.ml b/src/cow_atom.ml similarity index 83% rename from lib/atom.ml rename to src/cow_atom.ml index 702573e..288694a 100644 --- a/lib/atom.ml +++ b/src/cow_atom.ml @@ -25,10 +25,10 @@ type author = { email: string option; } -let stringo = function None -> None | Some s -> Some (Xml.string s) +let stringo = function None -> None | Some s -> Some (Cow_xml.string s) let xml_of_author a = - Xml.( + Cow_xml.( tag "name" (string a.name) ++ tago "uri" (stringo a.uri) ++ tago "email" (stringo a.email) @@ -38,7 +38,7 @@ type date = int * int * int * int * int (* year, month, day, hour, minute *) let xml_of_date (year,month,day,hour,min) = let str = Printf.sprintf "%.4d-%.2d-%.2dT%.2d:%.2d:00Z" year month day hour min in - Xml.string str + Cow_xml.string str type link = { rel : [`self|`alternate]; @@ -49,9 +49,9 @@ type link = { let mk_link ?(rel=`self) ?typ href = { rel; typ; href } -let data body : Xml.t = [`Data body] +let data body : Cow_xml.t = [`Data body] -let empty: Xml.t = [] +let empty: Cow_xml.t = [] let xml_of_link l = let attrs = [ @@ -61,7 +61,7 @@ let xml_of_link l = | None -> [] | Some t -> ["type", t] in - Xml.tag "link" ~attrs empty + Cow_xml.tag "link" ~attrs empty type meta = { id : string; @@ -74,7 +74,7 @@ type meta = { } let xml_of_meta m = - let open Xml in + let open Cow_xml in let body = [ tag "id" (data m.id); tag "title" (data m.title); @@ -91,12 +91,12 @@ let xml_of_meta m = ] in List.concat (body @ List.map xml_of_link m.links) -type content = Xml.t +type content = Cow_xml.t let xml_of_content base c = let div = - Xml.tag "content" ~attrs:["type","xhtml"] ( - Xml.tag "div" ~attrs:["xmlns","http://www.w3.org/1999/xhtml"] ( + Cow_xml.tag "content" ~attrs:["type","xhtml"] ( + Cow_xml.tag "div" ~attrs:["xmlns","http://www.w3.org/1999/xhtml"] ( c )) in @@ -115,8 +115,8 @@ let xml_of_content base c = type summary = string option let xml_of_summary = function - | None -> Xml.empty - | Some str -> Xml.(tag "summary" (string str)) + | None -> Cow_xml.empty + | Some str -> Cow_xml.(tag "summary" (string str)) type entry = { entry: meta; @@ -126,7 +126,7 @@ type entry = { } let xml_of_entry e = - Xml.( + Cow_xml.( tag "entry" ( xml_of_meta e.entry ++ xml_of_summary e.summary @@ -142,7 +142,7 @@ let contributors entries = [] entries -let xml_of_contributor c = Xml.tag "contributor" (xml_of_author c) +let xml_of_contributor c = Cow_xml.tag "contributor" (xml_of_author c) type feed = { feed : meta; @@ -151,10 +151,10 @@ type feed = { let xml_of_feed ? self f = let self = match self with - | None -> Xml.empty - | Some s -> Xml.tag "link" ~attrs:["rel","self"; "href",s] Xml.empty + | None -> Cow_xml.empty + | Some s -> Cow_xml.tag "link" ~attrs:["rel","self"; "href",s] Cow_xml.empty in - Xml.(tag "tag" ~attrs:["xmlns","http://www.w3.org/2005/Atom"] ( + Cow_xml.(tag "tag" ~attrs:["xmlns","http://www.w3.org/2005/Atom"] ( self ++ xml_of_meta f.feed ++ list (List.map xml_of_contributor (contributors f.entries)) diff --git a/lib/atom.mli b/src/cow_atom.mli similarity index 96% rename from lib/atom.mli rename to src/cow_atom.mli index 18a6aa4..ec03765 100644 --- a/lib/atom.mli +++ b/src/cow_atom.mli @@ -16,7 +16,6 @@ *) (** The Atom Syndication format. See RFC4287 for the full specification. - @deprecated Please use the [Syndic] package instead. *) type author = { @@ -62,7 +61,7 @@ type summary = string option type entry = { entry : meta; summary : summary; - content : Xml.t; + content : Cow_xml.t; base : string option; } @@ -71,4 +70,4 @@ type feed = { entries : entry list; } -val xml_of_feed : ?self:string -> feed -> Xml.t +val xml_of_feed : ?self:string -> feed -> Cow_xml.t diff --git a/lib/html.ml b/src/cow_html.ml similarity index 95% rename from lib/html.ml rename to src/cow_html.ml index 57ce613..aaba85b 100644 --- a/lib/html.ml +++ b/src/cow_html.ml @@ -20,7 +20,7 @@ let (@@) f x = f x let (|>) x f = f x -type t = Xml.t +type t = Cow_xml.t let void_elements = [ "img"; @@ -51,7 +51,7 @@ let tag name ?cls ?id ?(attrs=[]) t = | None -> attrs | Some c -> ("class", c) :: attrs in - Xml.tag name ~attrs t + Cow_xml.tag name ~attrs t let div = tag "div" let span = tag "span" @@ -125,7 +125,7 @@ let blockquote ?cls ?id ?(attrs=[]) ?cite x = let figure ?cls ?id ?(attrs=[]) ?figcaption x = let x = match figcaption with | None -> x - | Some i -> tag "figcaption" Xml.(i ++ x) + | Some i -> tag "figcaption" Cow_xml.(i ++ x) in tag "figure" ?cls ?id ~attrs x @@ -235,9 +235,9 @@ let rec generate_signals signals = function let output ?(nl=false) ?(indent=None) ?(ns_prefix=fun _ -> None) dest t = let append tree = let signals = generate_signals [] tree in - let out = Xml.make_output ~decl:false ~nl ~indent ~ns_prefix dest in - Xml.output out (`Dtd None); - List.(iter (Xml.output out) (rev signals)) + let out = Cow_xml.make_output ~decl:false ~nl ~indent ~ns_prefix dest in + Cow_xml.output out (`Dtd None); + List.(iter (Cow_xml.output out) (rev signals)) in List.iter append t @@ -259,7 +259,7 @@ let to_string t = Buffer.contents buf let of_string ?enc str = - Xml.of_string ~entity:Xhtml.entity ?enc str + Cow_xml.of_string ~entity:Cow_xhtml.entity ?enc str type rel = [ `alternate @@ -368,15 +368,15 @@ let interleave classes l = let res = classes.(!i mod n) in incr i; res in - List.map (Xml.tag "div" ~attrs:["class", get ()]) l + List.map (Cow_xml.tag "div" ~attrs:["class", get ()]) l -let html_of_string s = Xml.string s +let html_of_string s = Cow_xml.string s let string = html_of_string -let html_of_int i = Xml.int i +let html_of_int i = Cow_xml.int i let int = html_of_int -let html_of_float f = Xml.float f +let html_of_float f = Cow_xml.float f let float = html_of_float type table = t array array @@ -394,7 +394,7 @@ let html_of_table ?(headings=false) t = else List.map Array.to_list (Array.to_list t) in let tl = List.map (fun l -> tr (list @@ List.map (fun x -> td x) l)) tl in - Xml.(tag "table" (some hd ++ list tl)) + Cow_xml.(tag "table" (some hd ++ list tl)) let append (_to : t) (el : t) = _to @ el let (++) = append @@ -436,10 +436,10 @@ module Create = struct open Tags - type t = Xml.t + type t = Cow_xml.t let stylesheet css = - Xml.tag "style" ~attrs:["type","text/css"] (string css) + Cow_xml.tag "style" ~attrs:["type","text/css"] (string css) let table ?(flags = [Headings_fst_row]) = let h_fst_col = ref false in @@ -490,7 +490,7 @@ module Create = struct in let rows = List.map (fun r -> let r = List.flatten r in tr r) rows in let rows = concat rows in - Xml.tag "table"rows + Cow_xml.tag "table"rows in aux end diff --git a/lib/html.mli b/src/cow_html.mli similarity index 98% rename from lib/html.mli rename to src/cow_html.mli index 9340a8c..4933b40 100644 --- a/lib/html.mli +++ b/src/cow_html.mli @@ -15,9 +15,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) -(** HTML library. *) +(** (X)HTML library *) -type t = Xml.t +type t = Cow_xml.t (** A sequence of (X)HTML trees. *) val doctype : string @@ -28,7 +28,7 @@ val to_string : t -> string (** [to_string html] is a valid (X)HTML5 polyglot string corresponding to the [html] structure. *) -val of_string : ?enc:Xml.encoding -> string -> t +val of_string : ?enc:Cow_xml.encoding -> string -> t (** [of_string ?enc html_str] is the tree representation of [html_str] as decoded by [enc]. For more information about the default encoding, see {!Xmlm.inenc}. @@ -160,7 +160,7 @@ module Create : sig [ `Tr of 'a table list | `Td of 'a * int * int | `Th of 'a * int * int ] end - type t = Xml.t + type t = Cow_xml.t val stylesheet : string -> t (** [stylesheet style] converts a COW CSS type to a valid HTML stylesheet *) diff --git a/lib/json.ml b/src/cow_json.ml similarity index 100% rename from lib/json.ml rename to src/cow_json.ml diff --git a/lib/json.mli b/src/cow_json.mli similarity index 95% rename from lib/json.mli rename to src/cow_json.mli index eb73cec..8986519 100644 --- a/lib/json.mli +++ b/src/cow_json.mli @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) +(** JSON (JavaScript Object Notation) library *) + include module type of Ezjsonm val to_buffer : value -> Buffer.t -> unit diff --git a/src/cow_lib.mllib b/src/cow_lib.mllib new file mode 100644 index 0000000..e514928 --- /dev/null +++ b/src/cow_lib.mllib @@ -0,0 +1,7 @@ +Cow_atom +Cow_html +Cow_json +Cow_markdown +Cow_xhtml +Cow_xml +Cow diff --git a/lib/markdown.ml b/src/cow_markdown.ml similarity index 91% rename from lib/markdown.ml rename to src/cow_markdown.ml index cc471e5..9dee4ea 100644 --- a/lib/markdown.ml +++ b/src/cow_markdown.ml @@ -14,11 +14,11 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) -type t = Html.t +type t = Cow_html.t -let to_string = Html.to_string +let to_string = Cow_html.to_string let of_string s = let omd = Omd.of_string s in let html = Omd.to_html omd in - Html.of_string html + Cow_html.of_string html diff --git a/lib/markdown.mli b/src/cow_markdown.mli similarity index 73% rename from lib/markdown.mli rename to src/cow_markdown.mli index 2e24257..222ddf5 100644 --- a/lib/markdown.mli +++ b/src/cow_markdown.mli @@ -14,8 +14,15 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) -type t = Html.t +(** Markdown library *) + +type t = Cow_html.t +(** The type of a Markdown document, represented as an (X)HTML tree *) val to_string: t -> string +(** [to_string t] will output an (X)HTML string representation of + the [t] Markdown *) val of_string: string -> t +(** [of_string s] will parse the [s] Markdown and store an X(HTML) + representation via the Omd library. *) diff --git a/lib/xhtml.ml b/src/cow_xhtml.ml similarity index 100% rename from lib/xhtml.ml rename to src/cow_xhtml.ml diff --git a/lib/xhtml.mli b/src/cow_xhtml.mli similarity index 97% rename from lib/xhtml.mli rename to src/cow_xhtml.mli index db83609..ee22c7c 100644 --- a/lib/xhtml.mli +++ b/src/cow_xhtml.mli @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) +(** XHTML entity support *) + val entity : string -> string option (** [entity s] converts the HTML entity [s] to its corresponding UTF-8 symbol. For example [entity "amp" = "&"]. *) diff --git a/lib/xml.ml b/src/cow_xml.ml similarity index 100% rename from lib/xml.ml rename to src/cow_xml.ml diff --git a/lib/xml.mli b/src/cow_xml.mli similarity index 100% rename from lib/xml.mli rename to src/cow_xml.mli diff --git a/tests/basic.ml b/test/basic.ml similarity index 100% rename from tests/basic.ml rename to test/basic.ml diff --git a/tests/render.ml b/test/render.ml similarity index 100% rename from tests/render.ml rename to test/render.ml diff --git a/tests/test.ml b/test/test.ml similarity index 100% rename from tests/test.ml rename to test/test.ml