Skip to content
Browse files

Private pages

  • Loading branch information...
1 parent 03e02cd commit cb9991fd109e30adebb706b925a93b134354c66d @VictorNicollet committed Sep 25, 2012
Showing with 18 additions and 5 deletions.
  1. +9 −4 ohmStatic/ohmStatic.ml
  2. +9 −1 ohmStatic/ohmStatic.mli
View
13 ohmStatic/ohmStatic.ml
@@ -4,6 +4,8 @@ open BatPervasives
open Ohm
open Ohm.Universal
+exception Private
+
type key = string
type renaming = key -> string
type page = <
@@ -45,10 +47,13 @@ let export ?(rename=canonical) ?(render=default_render) ?(public="/") ~server ~t
match item with
| `File path -> BatPMap.add key path files, endpoints,definitions
| `Page page ->
- let endpoint, define = Action.declare server (rename key) Action.Args.none in
- files,
- BatPMap.add key endpoint endpoints,
- (define,page,key) :: definitions
+ try
+ let endpoint, define = Action.declare server (rename key) Action.Args.none in
+ files,
+ BatPMap.add key endpoint endpoints,
+ (define,page,key) :: definitions
+ with Private ->
+ files, endpoints, definitions
end site (BatPMap.empty, BatPMap.empty, [])
in
View
10 ohmStatic/ohmStatic.mli
@@ -11,8 +11,16 @@
*)
type key = string
+(** Raise this exception from a renaming function to indicate that a given item
+ should not be public. This is useful when, for instance, you need to include
+ a specific bit of HTML on several pages but do not want to make that HTML
+ available in other places.
+*)
+exception Private
+
(** The type of a renaming operation. Such operations turn the key of a site element
- into the public URL at which it may be found.
+ into the public URL at which it may be found. A renaming function may also raise
+ {!Private}, which means an item has no public URL.
*)
type renaming = key -> string

0 comments on commit cb9991f

Please sign in to comment.
Something went wrong with that request. Please try again.