Skip to content

Commit

Permalink
Merge pull request #97 from avsm/topkg
Browse files Browse the repository at this point in the history
Switch to topkg and use module aliases
  • Loading branch information
avsm committed Sep 15, 2016
2 parents b7e4c4c + 83e4ed7 commit 8df9050
Show file tree
Hide file tree
Showing 33 changed files with 312 additions and 106 deletions.
31 changes: 7 additions & 24 deletions .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
7 changes: 4 additions & 3 deletions .merlin
@@ -1,3 +1,4 @@
PKG omd ezjsonm xmlm cow alcotest
S lib
B _build/lib
PKG bytes
S src
S test
B _build/**
1 change: 1 addition & 0 deletions .ocp-indent
@@ -0,0 +1 @@
strict_with=always,match_clause=4,strict_else=never
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -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
10 changes: 10 additions & 0 deletions CHANGES → 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
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions _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
<src> : include
<src/cow.*>: no_alias_deps
<test> : include
<test/*> : package(alcotest)
24 changes: 24 additions & 0 deletions 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
7 changes: 7 additions & 0 deletions doc/api.odocl
@@ -0,0 +1,7 @@
Cow
Cow_html
Cow_xhtml
Cow_atom
Cow_markdown
Cow_json
Cow_xml
7 changes: 7 additions & 0 deletions doc/dev.odocl
@@ -0,0 +1,7 @@
Cow
Cow_html
Cow_xhtml
Cow_atom
Cow_markdown
Cow_json
Cow_xml
112 changes: 112 additions & 0 deletions 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.
---------------------------------------------------------------------------*/
53 changes: 20 additions & 33 deletions 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 <anil@recoil.org>"
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 ]
7 changes: 7 additions & 0 deletions 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"
10 changes: 10 additions & 0 deletions 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" ]
File renamed without changes.
6 changes: 6 additions & 0 deletions 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
28 changes: 28 additions & 0 deletions src/cow.mli
@@ -0,0 +1,28 @@
(*
* Copyright (c) 2016 Anil Madhavapeddy <anil@recoil.org>
*
* 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

0 comments on commit 8df9050

Please sign in to comment.