GitXplorerGitXplorer
T

ocawb

public
0 stars
0 forks
1 issues

Commits

List of commits on branch master.
Unverified
d531f074bf9a8f79cdb0e5e5a9aa55ff3a3dc7c1

Added type attribute to link + css for swing

TTheoWinterhalter committed 9 years ago
Unverified
535ddb0472438949d8e674721d70723b1e762fe5

Added .merlin for the project

TTheoWinterhalter committed 9 years ago
Unverified
5e175d4662652578f1cfe94bc43ced51e3f7505d

More generic tag printing

TTheoWinterhalter committed 9 years ago
Unverified
ab543d3bf0e3c3c9db323ef107b98c079bc59c6e

Added nav and main

TTheoWinterhalter committed 9 years ago
Unverified
589f2867cc3b3285acb0511471cf1479120239b4

WIP Swing example

TTheoWinterhalter committed 9 years ago
Unverified
ceb88448fbbb452bd4785c4b7dbdb1d73b58819d

Updated TODO

TTheoWinterhalter committed 9 years ago

README

The README file for this repository.

ocawb

The purpose of this repository is to build an ocaml tool to write html. The first phase of this work is to reflect (a subset of) HTML in ocaml.
Later on, I will try to provide more functionalities.

Thanks to the power of continuations, one currently can write the following ocaml code:

open Html

let my_html =
  html
    (head
      ~links:[
        link ~href:"style.css" ~rel:Rel_stylesheet () ;
        link ~href:"icon.png" ~rel:Rel_icon ()
      ]
      ~title:"My first page" ())
    (body
      (p
        (text "We write paragraphs!")
        (a ~href:"sup.html"
          (text "We can put [a] inside flow.")
        close)
      close)
      (a ~href:"index.html" ~download:"filename" ~target:Target_self
        (p
          (text "We can also add [p] inside [a]")
          (a ~accesskey:'h'
            (text "This is just for show but we also put anchors in anchors.")
            (text "Isn't that all nice? ")
            (abbr ~title:"Oh My God"
              (text "OMG")
            close)
          close)
        close)
        (address
          (text "Maybe we don't want to put [p] inside [address].")
        close)
        (text "Isn't it awesome?")
      close)
      (article
        (text "Because for now this is the only thing we can do.")
        (text "It indeed works!")
      close)
      (aside
        (text "This is some aside, so wonderful.")
        (blockquote ~cite:"lulz.com"
          (text "Everything is better than HTML...")
          (text "-- Somebody dead")
        close)
      close)
    body_end)

let () =
  print_string (export my_html)

To produce the following html:

<!doctype html>
<html>
  <head>
    <title>My first page</title>
    <link href="style.css" rel="stylesheet">
    <link href="icon.png" rel="icon">
  </head>
  <body>
    <p>
      We write paragraphs!
      <a href="sup.html">
        We can put [a] inside flow.
      </a>
    </p>
    <a href="index.html" download="filename" target="_self">
      <p>
        We can also add [p] inside [a]
        <a accesskey="h">
          This is just for show but we also put anchors in anchors.
          Isn't that all nice?
          <abbr title="Oh My God">
            OMG
          </abbr>
        </a>
      </p>
      <address>
        Maybe we don't want to put [p] inside [address].
      </address>
      Isn't it awesome?
    </a>
    <article>
      Because for now this is the only thing we can do.
      It indeed works!
    </article>
    <aside>
      This is some aside, so wonderful.
      <blockquote cite="lulz.com">
        Everything is better than HTML...
        -- Somebody dead
      </blockquote>
    </aside>
  </body>
</html>