Skip to content

Commit b2e8e30

Browse files
committed
Use opam libs 2.0, and large refactor
1 parent cd0a254 commit b2e8e30

28 files changed

+1405
-1061
lines changed

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
build:
44
jbuilder build @install @js_search
5-
cp _build/default/src/js_search/search.bc.js ext/js/
5+
cp _build/default/src/js_search/search.bc.js ext/js/search.js
66
cp _build/default/src/opam2web.exe opam2web
77

88
install:

Diff for: content/home.xhtml

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<!-- Main hero unit for a primary marketing message or call to action -->
33
<div class="hero-unit">
44
<h1>
5-
<img style="width: 1em;vertical-align:middle;" src="ext/img/opam.png" alt="OPAM"/>
5+
<img style="width: 1em;vertical-align:middle;" src="ext/img/opam.png" alt="opam"/>
66
&#160;OCaml Package Manager
77
</h1>
88
<br/>
9-
<p>OPAM is a source-based package manager for OCaml. It supports multiple simultaneous
9+
<p>opam is a source-based package manager for OCaml. It supports multiple simultaneous
1010
compiler installations, flexible package constraints, and a Git-friendly development
1111
workflow. Managing your OCaml installation can be as simple as:</p>
1212
<pre class="prettyprint lang-sh linenums">
@@ -22,11 +22,11 @@ opam upgrade # Upgrade the installed packages to their latest version
2222
<div class="btn-group">
2323
<a class="btn btn-large"
2424
href="doc/Install.html">
25-
Download and install OPAM »
25+
Download and install opam »
2626
</a>
2727
<a class="btn btn-large"
2828
href="doc/Usage.html">
29-
How to use OPAM »
29+
How to use opam »
3030
</a>
3131
</div>
3232
</div>
@@ -44,7 +44,7 @@ opam upgrade # Upgrade the installed packages to their latest version
4444
<i class="icon-tag"> </i>
4545
<a href="https://github.com/ocaml/opam/blob/master/CONTRIBUTING.md" title="ocaml/opam">Report bugs</a> and
4646
<a href="https://github.com/ocaml/opam/issues" title="ocaml/opam">ask for features</a> in
47-
the OPAM tool<br/>
47+
the opam tool<br/>
4848
<i class="icon-tags"> </i>
4949
<a href="https://github.com/ocaml/opam-repository/issues" title="ocaml/opam-repository">Report</a> packaging issues or
5050
<a href="https://github.com/ocaml/opam-repository/issues" title="ocaml/opam-repository">request</a> new packages<br/></p>
@@ -56,9 +56,9 @@ opam upgrade # Upgrade the installed packages to their latest version
5656

5757
<div class="span4">
5858
<h2>Documentation</h2>
59-
<p><a href="doc/Install.html" title="Installing OPAM">Installing OPAM</a></p>
60-
<p><a href="doc/Packaging.html" title="Creating OPAM packages">Creating Packages</a></p>
61-
<p><a href="doc/Manual.html" title="The OPAM Manual">The OPAM Manual</a></p>
59+
<p><a href="doc/Install.html" title="Installing opam">Installing opam</a></p>
60+
<p><a href="doc/Packaging.html" title="Creating opam packages">Creating Packages</a></p>
61+
<p><a href="doc/Manual.html" title="The opam Manual">The opam Manual</a></p>
6262
</div>
6363
<!--
6464
<div class="span2">

Diff for: content/template.xhtml

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
xmlns:t="http://ocaml.org/xmlns/template#">
44
<head>
55
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6-
<title>OPAM - <t:insert name="title" /></title>
6+
<title>opam - <t:insert name="title" /></title>
77
<link href="/blog/feed.xml" type="application/atom+xml" rel="alternate" title="Platform blog ATOM Feed" />
88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99
<meta name="description"
10-
content="The homepage of OPAM, a package manager for OCaml" />
10+
content="The homepage of opam, a package manager for OCaml" />
1111
<meta name="author" content="OCamlPro" />
1212
<link rel="icon" type="image/png" href="/ext/img/favicon.png" />
1313
<link rel="stylesheet" href="/ext/css/bootstrap.css" />
@@ -32,7 +32,10 @@
3232
<span class="icon-bar"> </span>
3333
<span class="icon-bar"> </span>
3434
</a>
35-
<a class="brand" href="https://github.com/ocaml/opam">OPAM on Github</a>
35+
<a class="brand" href="https://github.com/ocaml/opam">
36+
<img src="/ext/img/GitHub-Mark-32px.png"
37+
alt="opam on Github"></img>
38+
</a>
3639
<div class="nav-collapse collapse">
3740
<t:insert name="header" />
3841
<!--
@@ -45,13 +48,14 @@
4548
</div>
4649
</div>
4750

48-
<div id="wrap">
49-
<div id="main" class="container clear-top">
51+
<!-- <div id="wrap"> -->
52+
<div id="main" class="container">
5053

5154
<t:insert name="body" />
5255

53-
</div> <!-- /container -->
54-
</div> <!-- /wrap -->
56+
</div>
57+
58+
<!-- </div> -->
5559

5660
<div class="footer"><t:insert name="footer" /></div>
5761

Diff for: content/universe.xhtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<thead>
1919
<tr>
2020
<th>Name</th>
21-
<th>Version</th>
21+
<th>Latest version</th>
2222
<th>Description</th>
2323
</tr>
2424
</thead>

Diff for: ext/css/opam2web.css

+93-45
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,47 @@
22
text-align: center;
33
}
44

5-
#wrap {
6-
min-height: 100%;
7-
}
8-
95
#main {
10-
overflow:auto;
11-
padding-bottom:50px; /* this needs to be bigger than footer height*/
6+
overflow: visible;
127
clear:both;
8+
min-height: calc(100% - 142px);
9+
padding-top: 50px;
10+
}
11+
12+
.navbar .brand {
13+
padding: 4px;
14+
margin: 0;
15+
}
16+
17+
.navbar .nav > li > a img {
18+
margin-top: -16px;
19+
margin-bottom: -16px;
20+
}
21+
22+
span.opam-title {
23+
font-size: 120%;
24+
font-weight: bold;
1325
}
1426

1527
.footer {
1628
position: relative;
17-
margin-top: -50px; /* negative value of footer height */
29+
margin-top: 10px;
1830
height: 50px;
1931
clear: both;
2032
text-align: center;
21-
padding-top:20px;
22-
}
33+
padding-top: 20px; /* + border-top 10px */
34+
padding-bottom: 0;
35+
}
2336

2437
.footer .copyright {
2538
clear: both;
2639
}
2740

2841
.footer .icons {
2942
margin: auto;
30-
padding-bottom: 20px;
43+
/* padding-bottom: 20px; */
3144
width: 150px;
32-
overflow: auto;
45+
overflow: hidden;
3346
}
3447

3548
.footer .icons .icon {
@@ -50,56 +63,91 @@
5063
border-bottom: 0;
5164
}
5265

53-
th.operator {
54-
vertical-align: middle;
55-
text-align: center;
56-
font-family: monospace;
66+
table.package-info > tbody > tr:first-child > th,
67+
table.package-info > tbody > tr:first-child > td {
68+
border-top: 0;
5769
}
5870

59-
table.formula-wrap th, table.formula-wrap td,
60-
table.formula th, table.formula td {
61-
border: none;
62-
white-space: nowrap;
71+
span.versions {
72+
margin-left: 2ex;
73+
vertical-align: text-top;
6374
}
6475

65-
table.formula th.operator {
66-
font-size: 150%;
67-
border-right: 1px solid rgb(221, 221, 221);
76+
span.package-version {
77+
font-weight: bold;
78+
margin-left: 0.2em;
79+
/* margin-right: 0.6em; */
6880
}
6981

70-
table.formula td.pkgname {
71-
vertical-align: middle;
82+
span.invisible {
83+
display: none;
7284
}
7385

74-
td table.formula {
75-
margin-left: -8px;
86+
ul.formula {
87+
list-style-type: none;
88+
margin-left: 0;
7689
}
7790

78-
table.formula-wrap {
79-
width: 100%;
80-
margin-left: -8px;
91+
ul.formula > li {
92+
clear: both;
8193
}
8294

83-
table.formula-wrap > tbody > tr > th,
84-
table.formula-wrap > tbody > tr > td {
85-
padding-top: 0;
86-
padding-bottom: 0;
87-
border: none;
95+
ul.formula ul.formula formula-package {
96+
margin-left: 1em;
8897
}
8998

90-
table.formula-wrap > tbody > tr > td:last-child,
91-
table.formula > tbody > tr > td:last-child {
92-
width: 100%;
99+
span.formula-package {
100+
display: inline-block;
101+
min-width: 50%;
93102
}
94103

95-
tr.embedded-formula > th, tr.embedded-formula > td {
96-
font-size: 85%;
97-
padding-top: 4px;
98-
padding-bottom: 4px;
99-
border-top: 0;
104+
span.version-constraint {
105+
min-width: 50%;
106+
float: right;
107+
min-height: 20px;
108+
color: #777777;
109+
}
110+
111+
.version-constraint span {
112+
vertical-align: top;
113+
}
114+
115+
div.revdeps {
116+
border: 1px solid #ddd;
117+
border-radius: 4px;
118+
margin: 0;
119+
margin-bottom: 10px;
120+
max-height: 60ex;
121+
overflow: auto;
122+
}
123+
124+
.revdeps ul {
125+
list-style-type: none;
126+
margin: 0;
127+
padding: 8px;
100128
}
101129

102-
tr.embedded-formula > td:last-child {
103-
width: 100%;
104-
text-align: right;
130+
.revdeps li {
131+
clear: both;
132+
padding-top: 3px;
133+
}
134+
135+
.revdeps li span {
136+
vertical-align: baseline;
137+
}
138+
139+
span.revdeps-title {
140+
padding: 3px 7px;
141+
font-size: 100%;
142+
font-weight: bold;
143+
/* background-color: #f5f5f5; */
144+
}
145+
146+
.revdeps span.revdeps-title {
147+
position: relative;
148+
left: -1px;
149+
top: -1px;
150+
border: 1px solid #ddd;
151+
/* color: #9da0a4; */
152+
border-radius: 4px 0 4px 0;
105153
}

Diff for: ext/css/site.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
body {
2-
padding-top: 60px;
3-
padding-bottom: 40px;
2+
padding: 0;
43
}
54

65
a {

Diff for: ext/img/GitHub-Mark-32px.png

1.67 KB
Loading

Diff for: src/META

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version = "1.3.1"
2-
description = "Conversion from OPAM universes to web pages"
2+
description = "Conversion from opam universes to web pages"
33
archive(byte) = "opam2web.cma"
44
archive(native) = "opam2web.cmxa"
55
exists_if = "opam2web.cma"

Diff for: src/jbuild

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(name opam2web)
55
(public_name opam2web)
66
(modules_without_implementation (o2wTypes))
7-
(libraries (str omd cow opam-lib.client cmdliner apalog))
7+
(libraries (str omd cow opam-core opam-format opam-state opam-client cmdliner apalog))
88
))
99

1010
(rule(

Diff for: src/js_search/search.ml

+29-21
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ let win = Dom_html.window
2020
let _s = Js.string
2121

2222
let get_element_by_id id =
23-
Js.Opt.get (doc##getElementById (Js.string id))
24-
(fun () -> Firebug.console##log (_s id); assert false)
23+
Js.Opt.to_option (doc##getElementById (Js.string id))
2524

2625
let from_option opt =
2726
match Js.Opt.to_option opt with
@@ -43,27 +42,36 @@ let show tr =
4342
(* Filter the string [str] from the table [tbl] by looking in the column
4443
name (position 0) and the description (position 2) *)
4544
let filter str tbl =
46-
for i = 1 to (tbl##.rows##.length) do
47-
let tr = from_option (tbl##.rows##item (i)) in
45+
for i = 1 to tbl##.rows##.length do
46+
Js.Opt.iter (tbl##.rows##item (i)) @@ fun tr ->
4847
(* Get the [td] corresponding to the name column *)
49-
let name = from_option (tr##.cells##item (by_name)) in
48+
let name = tr##.cells##item (by_name) in
5049
(* Get the [td] corresponding to the description column *)
51-
let descr = from_option (tr##.cells##item (by_descr)) in
50+
let descr = tr##.cells##item (by_descr) in
51+
let matches str elt =
52+
Js.Opt.case elt (fun () -> false) @@ fun e ->
53+
None <>
54+
Regexp.search (Regexp.regexp_string_case_fold (Js.to_string str))
55+
(Js.to_string e##.innerHTML) 0
56+
in
5257
(* Filter name or column column of the table *)
53-
if (Regexp.search (Regexp.regexp (String.lowercase (Js.to_string str)))
54-
(String.lowercase (Js.to_string name##.innerHTML)) 0) <> None ||
55-
(Regexp.search (Regexp.regexp (String.lowercase (Js.to_string str)))
56-
(String.lowercase (Js.to_string descr##.innerHTML)) 0) <> None
57-
then
58-
show tr
59-
else
60-
hide tr
58+
if matches str name || matches str descr
59+
then show tr
60+
else hide tr
6161
done
6262

63-
let _=
64-
let tbl = get_element_by_id "packages" in
65-
let tbl = from_option (Dom_html.CoerceTo.table tbl) in
66-
let search = get_element_by_id "search" in
67-
let search = from_option (Dom_html.CoerceTo.input search) in
68-
search##.onkeyup := Dom_html.handler
69-
(fun _ -> filter search##.value tbl; Js._false);
63+
let ( >>= ) = Js.Opt.bind
64+
65+
let _ =
66+
doc##getElementById (Js.string "search") >>= Dom_html.CoerceTo.input
67+
>>= fun search ->
68+
doc##getElementById (Js.string "packages") >>= Dom_html.CoerceTo.table
69+
>>= fun tbl ->
70+
let handler =
71+
Dom_html.handler (fun _ -> filter search##.value tbl; Js._false)
72+
in
73+
search##.onkeyup := handler;
74+
let hash = win##.location##.hash##substring_toEnd 1 in
75+
if hash##.length > 0 then search##.value := hash;
76+
if search##.value##.length > 0 then filter search##.value tbl;
77+
Js.some handler

0 commit comments

Comments
 (0)