MainIndex2.ml

(* Copyright INRIA and Microsoft Corporation, 2008-2013. *)
(* DDMF is distributed under CeCILL-B license. *)

INCLUDE "preamble.ml"

let anchor_of_eqn eqn_id =
  let eqn = DB.eqn_of_id eqn_id in
  let name = eqn.FEqn.eqn_name in
  if not (DynaMoW.Services.Renderings.is_defined ()) then
    <:par< The $(str:name) >>
  else
    let params = List.map Maple.pretty_code_of_t (FEqn.params_of_t eqn) in
    let nparams = List.length params in
    let descr =
      match eqn.FEqn.eqn_type with
      | FEqn.RecEq ->
          RecurrenceEqn.Param0'.descr eqn_id None
      | FEqn.DiffEq ->
          match nparams with
          | 0 -> OrdinaryDiffEqn.Param0.descr eqn_id None
          | 1 -> OrdinaryDiffEqn.Param1.descr eqn_id (Some (List.hd params))
          | 2 ->
              OrdinaryDiffEqn.Param2.descr eqn_id
                (Some (List.hd params, List.nth params 1))
          | 3 ->
              OrdinaryDiffEqn.Param3.descr eqn_id
                (Some (List.hd params, List.nth params 1, List.nth params 2))
          | _ -> OrdinaryDiffEqn.Paramn.descr eqn_id None in
    let link = DC.link_service descr <:text<$(str:name)>> in
    <:par< The $(link) >>

let anchor_of_seq seq_id =
  let seq = DB.seq_of_id seq_id in
  let name = seq.Seq.full_name in
  if not (DynaMoW.Services.Renderings.is_defined ()) then
    <:par< The $(str:name) >>
  else
    let descr = Sequence.Param0''.descr seq_id None in
    let link = DC.link_service descr <:text<$(str:name)>> in
    <:par< The $(link) >>


let intro () =
  let t = DC.dstyle (DC.css_of_string "font-size:200%; float: left") "T" in
  <:par<
    $(t_ent:t)his is a test for sequences. Lorem ipsum dolor sit amet,
      consectetur adipiscing elit. Aliquam arcu leo, laoreet id gravida sed,
      tempor non lorem. Ut varius malesuada quam, ut facilisis orci viverra a.
      Suspendisse magna dolor, pellentesque in sodales in, tempor quis massa.
      Praesent cursus volutpat dui sit amet tempus.
  >>

(* Make a paragraph that does not have class content-par. *)
let no_content_par = DC.pstyle (DC.css_of_string "")

let centered_par pos =
  DC.pstyle
    (DC.css_of_string
       ("text-align: center; font-weight: bold; padding" ^ pos ^ ": 20px"))

let math_rendering =
  DC.link "math_rendering.html" <:text<Select a mathematical rendering>> in
    centered_par "-bottom"
  (if not (DynaMoW.Services.Renderings.is_defined ()) then
    <:par< $(math_rendering) to enable access to the contents >>
  else <:par< Select a special function from the list >>)

let bold_text =
  DC.dstyle (DC.css_of_string "font-weight: bold; margin-right: 1em")

let footer =
  let msr_inria =
    DC.link
      "http://www.msr-inria.inria.fr/"
      <:text<Microsoft ResearchINRIA Joint Centre>> in
    <:par<
      The DDMF project (20082013) is hosted and supported \
      by the $(msr_inria).
    >>


let eqn_list eqn_typ title =
  let el = List.map anchor_of_eqn (DB.eqn_list eqn_typ) in
  DC.pstyle (DC.css_of_string "text-align: center") <:par<$(str:title)>> @@@
  DC.unordered_list (List.map no_content_par el)

let seq_list title =
  let el = List.map anchor_of_seq (DB.seq_list ()) in
  DC.pstyle (DC.css_of_string "text-align: center") <:par<$(str:title)>> @@@
  DC.unordered_list (List.map no_content_par el)

let right_column () =
  DC.section
    <:text<Sequences and Recurrent Equations>>
    ((seq_list "Sequences")
  @@@ <:par< >> @@@
  (eqn_list FEqn.FRecEq "Recurrence Equations"))

let title _ = <:text<Dynamic Dictionary of Mathematical Functions>>

let service_style =
  DC.css_of_string
    "#section-1 {\
      float: right\
    }\
\
    #section-1 > .section2 {\
      display: none\
    }"

let welcome_test () =
  <:par< Le second test. >>

let_service MainIndex2 :
  DC.sec_entities * unit with { title = title; style = service_style } =

  (DC.section (title ())
     (right_column () @@@ intro () @@@ welcome_test () @@@ footer),
   ())

Generated by GNU Enscript 1.6.5.90.