Output separate HTML files

This commit is contained in:
oakes
2014-04-01 16:31:56 -04:00
parent f03cd07225
commit 8e5fe2c0f6
7 changed files with 454 additions and 114 deletions

View File

@@ -1,70 +1,102 @@
{"Align" {"align" :static-fields}
"Animation" {"play-mode" :static-fields
"animation" :methods}
"AnimationController" {"animation-controller" :methods}
"com.badlogic.gdx.graphics.g2d.Animation" {"play-mode" :static-fields
"animation" :methods
"animation!" :methods}
"AnimationController" {"animation-controller" :methods
"animation-controller!" :methods}
"Application" {"app!" :methods}
"Array" {"gdx-array" :methods}
"ArrayMap" {"gdx-array-map" :methods}
"AssetManager" {"asset-manager" :methods}
"AtlasTmxMapLoader" {"loader :atlas-tmx-map" :methods}
"Array" {"gdx-array" :methods
"gdx-array!" :methods}
"ArrayMap" {"gdx-array-map" :methods
"gdx-array-map!" :methods}
"AssetManager" {"asset-manager" :methods
"asset-manager!" :methods}
"AtlasTmxMapLoader" {"loader :atlas-tmx-map" :methods
"loader! :atlas-tmx-map" :methods}
"Audio" {"audio!" :methods}
"Bezier" {"bezier" :methods}
"Bezier" {"bezier" :methods
"bezier!" :methods}
"BitmapFont" {"bitmap-font" :constructors}
"BitmapFontLoader" {"loader :bitmap-font" :methods}
"BitmapFontLoader" {"loader :bitmap-font" :methods
"loader! :bitmap-font" :methods}
"BlendingAttribute" {"attribute :blending" :constructors
"attribute-type :blending" :static-fields
"attribute! :blending" :static-methods}
"Body" {"create-body!" :methods}
"Body" {"create-body!" :methods
"body!" :methods}
"BodyDef" {"body-def" :fields}
"Bresenham2" {"bresenham-2" :methods}
"BSpline" {"b-spline" :methods}
"Bresenham2" {"bresenham-2" :methods
"bresenham-2!" :methods}
"BSpline" {"b-spline" :methods
"b-spline!" :methods}
"Button.ButtonStyle" {"style :button" :constructors}
"CatmullRomSpline" {"catmull-rom-spline" :methods}
"Circle" {"circle" :methods}
"CatmullRomSpline" {"catmull-rom-spline" :methods
"catmull-rom-spline!" :methods}
"Circle" {"circle" :methods
"circle!" :methods}
"Color" {"color" :static-fields}
"ColorAttribute" {"attribute :color" :constructors
"attribute-type :color" :static-fields
"attribute! :color" :static-methods}
"Contact" {"contact!" :methods}
"ConvexHull" {"convex-hull" :methods}
"ChainShape" {"chain-shape" :methods}
"CheckBox" {"check-box" :methods}
"ConvexHull" {"convex-hull" :methods
"convex-hull!" :methods}
"ChainShape" {"chain-shape" :methods
"chain-shape!" :methods}
"CheckBox" {"check-box" :methods
"check-box!" :methods}
"CheckBox.CheckBoxStyle" {"style :check-box" :constructors}
"CircleShape" {"circle-shape" :methods}
"CircleShape" {"circle-shape" :methods
"circle-shape!" :methods}
"CubemapAttribute" {"attribute :cubemap" :constructors
"attribute-type :cubemap" :static-fields
"attribute! :cubemap" :static-methods}
"DelaunayTriangulator" {"delauny-triangulator" :methods}
"DelaunayTriangulator" {"delaunay-triangulator" :methods
"delaunay-triangulator!" :methods}
"DepthTestAttribute" {"attribute :depth-test" :constructors
"attribute-type :depth-test" :static-fields
"attribute! :depth-test" :static-methods}
"Dialog" {"dialog" :methods}
"Dialog" {"dialog" :methods
"dialog!" :methods}
"DistanceJointDef" {"joint-def :distance" :fields}
"EarClippingTriangulator" {"ear-clipping-triangulator" :methods}
"EdgeShape" {"edge-shape" :methods}
"Ellipse" {"ellipse" :methods}
"Environment" {"environment" :methods}
"EarClippingTriangulator" {"ear-clipping-triangulator" :methods
"ear-clipping-triangulator!" :methods}
"EdgeShape" {"edge-shape" :methods
"edge-shape!" :methods}
"Ellipse" {"ellipse" :methods
"ellipse!" :methods}
"Environment" {"environment" :methods
"environment!" :methods}
"Files" {"files!" :methods}
"Fixture" {"fixture!" :methods}
"FixtureDef" {"fixture-def" :fields}
"FloatAttribute" {"attribute :float" :constructors
"attribute-type :float" :static-fields
"attribute! :float" :static-methods}
"FloatCounter" {"float-counter" :methods}
"FloatCounter" {"float-counter" :methods
"float-counter!" :methods}
"FrictionJointDef" {"joint-def :friction" :fields}
"Frustum" {"frustum" :methods}
"Frustum" {"frustum" :methods
"frustum!" :methods}
"GearJointDef" {"joint-def :gear" :fields}
"GeometryUtils" {"geometry!" :static-methods}
"Graphics" {"graphics!" :methods}
"GridPoint2" {"grid-point-2" :methods}
"GridPoint3" {"grid-point-3" :methods}
"GridPoint2" {"grid-point-2" :methods
"grid-point-2!" :methods}
"GridPoint3" {"grid-point-3" :methods
"grid-point-3!" :methods}
"GL20" {"gl!" :methods}
"HexagonalTiledMapRenderer" {"hexagonal-tiled-map" :methods}
"HorizontalGroup" {"horizontal" :methods}
"Image" {"image" :methods}
"ImageButton" {"image-button" :methods}
"HexagonalTiledMapRenderer" {"hexagonal-tiled-map" :methods
"hexagonal-tiled-map!" :methods}
"HorizontalGroup" {"horizontal" :methods
"horizontal!" :methods}
"Image" {"image" :methods
"image!" :methods}
"ImageButton" {"image-button" :methods
"image-button!" :methods}
"ImageButton.ImageButtonStyle" {"style :image-button" :constructors}
"ImageTextButton" {"image-text-button" :methods}
"ImageTextButton" {"image-text-button" :methods
"image-text-button!" :methods}
"ImageTextButton.ImageTextButtonStyle" {"style :image-text-button" :constructors}
"Input" {"input!" :methods}
"Input.Keys" {"key-code" :static-fields
@@ -74,80 +106,130 @@
"IntAttribute" {"attribute :int" :constructors
"attribute-type :int" :static-fields
"attribute! :int" :static-methods}
"IsometricStaggeredTiledMapRenderer" {"isometric-staggered-tiled-map" :methods}
"IsometricTiledMapRenderer" {"isometric-tiled-map" :methods}
"Joint" {"create-joint!" :methods}
"Label" {"label" :methods}
"Material" {"material" :methods}
"IsometricStaggeredTiledMapRenderer" {"isometric-staggered-tiled-map" :methods
"isometric-staggered-tiled-map!" :methods}
"IsometricTiledMapRenderer" {"isometric-tiled-map" :methods
"isometric-tiled-map!" :methods}
"Joint" {"create-joint!" :methods
"joint!" :methods}
"Label" {"label" :methods
"label!" :methods}
"Material" {"material" :methods
"material!" :methods}
"MathUtils" {"math!" :static-methods}
"Matrix3" {"matrix-3" :methods}
"Matrix4" {"matrix-4" :methods}
"ModelBatch" {"model-batch" :methods}
"ModelBuilder" {"model-builder" :methods}
"ModelInstance" {"model" :methods}
"ModelLoader" {"loader :model" :methods}
"Matrix3" {"matrix-3" :methods
"matrix-3!" :methods}
"Matrix4" {"matrix-4" :methods
"matrix-4!" :methods}
"ModelBatch" {"model-batch" :methods
"model-batch!" :methods}
"ModelBuilder" {"model-builder" :methods
"model-builder!" :methods}
"ModelInstance" {"model" :methods
"model!" :methods}
"ModelLoader" {"loader :model" :methods
"loader! :model" :methods}
"MouseJointDef" {"joint-def :mouse" :fields}
"MusicLoader" {"loader :music" :methods}
"MusicLoader" {"loader :music" :methods
"loader! :music" :methods}
"Net" {"net!" :methods}
"NinePatch" {"nine-patch" :methods}
"NinePatch" {"nine-patch" :methods
"nine-patch!" :methods}
"NinePatchDrawable" {"drawable :nine-patch" :constructors}
"OrthogonalTiledMapRenderer" {"orthogonal-tiled-map" :methods}
"OrthographicCamera" {"orthographic" :methods}
"ParticleEffect" {"particle-effect" :methods}
"PerspectiveCamera" {"perspective" :methods}
"PixmapLoader" {"loader :pixmap" :methods}
"Plane" {"plane" :methods}
"OrthogonalTiledMapRenderer" {"orthogonal-tiled-map" :methods
"orthogonal-tiled-map!" :methods}
"OrthographicCamera" {"orthographic" :methods
"orthographic!" :methods}
"ParticleEffect" {"particle-effect" :methods
"particle-effect!" :methods}
"PerspectiveCamera" {"perspective" :methods
"perspective!" :methods}
"PixmapLoader" {"loader :pixmap" :methods
"loader! :pixmap" :methods}
"Plane" {"plane" :methods
"plane!" :methods}
"Plane.PlaneSide" {"plane-side" :static-fields}
"Polygon" {"polygon" :methods}
"PolygonShape" {"polygon-shape" :methods}
"Polyline" {"polyline" :methods}
"Polygon" {"polygon" :methods
"polygon!" :methods}
"PolygonShape" {"polygon-shape" :methods
"polygon-shape!" :methods}
"Polyline" {"polyline" :methods
"polyline!" :methods}
"PrismaticJointDef" {"joint-def :prismatic" :fields}
"ProgressBar.ProgressBarStyle" {"style :progress-bar" :constructors}
"PulleyJointDef" {"joint-def :pulley" :fields}
"Quaternion" {"quaternion" :methods}
"Rectangle" {"rectangle" :methods}
"Quaternion" {"quaternion" :methods
"quaternion!" :methods}
"Rectangle" {"rectangle" :methods
"rectangle!" :methods}
"RevoluteJointDef" {"joint-def :revolute" :fields}
"RopeJointDef" {"joint-def :rope" :fields}
"Scaling" {"scaling" :static-fields}
"ScrollPane" {"scroll-pane" :methods}
"ScrollPane" {"scroll-pane" :methods
"scroll-pane!" :methods}
"ScrollPane.ScrollPaneStyle" {"style :scroll-pane" :constructors}
"SelectBox" {"select-box" :methods}
"SelectBox" {"select-box" :methods
"select-box!" :methods}
"SelectBox.SelectBoxStyle" {"style :select-box" :constructors}
"Skin" {"skin" :methods}
"SkinLoader" {"loader :skin" :methods}
"Slider" {"slider" :methods}
"Sound" {"sound" :methods}
"SoundLoader" {"loader :sound" :methods}
"Skin" {"skin" :methods
"skin!" :methods}
"SkinLoader" {"loader :skin" :methods
"loader! :skin" :methods}
"Slider" {"slider" :methods
"slider!" :methods}
"Sound" {"sound" :methods
"sound!" :methods}
"SoundLoader" {"loader :sound" :methods
"loader! :sound" :methods}
"SplitPane.SplitPaneStyle" {"style :split-pane" :constructors}
"SpriteDrawable" {"drawable :sprite" :constructors}
"Stack" {"stack" :methods}
"Stage" {"stage" :methods}
"Table" {"table" :methods}
"TextureAtlas" {"texture-atlas" :methods}
"Stack" {"stack" :methods
"stack!" :methods}
"Stage" {"stage" :methods
"stage!" :methods}
"Table" {"table" :methods
"table!" :methods}
"TextureAtlas" {"texture-atlas" :methods
"texture-atlas!" :methods}
"TextureAttribute" {"attribute :texture" :constructors
"attribute-type :texture" :static-fields
"attribute! :texture" :static-methods}
"TextButton" {"text-button" :methods}
"TextButton" {"text-button" :methods
"text-button!" :methods}
"TextButton.TextButtonStyle" {"style :text-button" :constructors}
"TextField" {"text-field" :methods}
"TextField" {"text-field" :methods
"text-field!" :methods}
"TextField.TextFieldStyle" {"style :text-field" :constructors}
"TextureLoader" {"loader :texture" :methods}
"TextureRegion" {"texture" :methods}
"TextureLoader" {"loader :texture" :methods
"loader! :texture" :methods}
"TextureRegion" {"texture" :methods
"texture!" :methods}
"TextureRegionDrawable" {"drawable :texture-region" :constructors}
"Tree" {"tree" :methods}
"TmxMapLoader" {"loader :tmx-map" :methods}
"Tree" {"tree" :methods
"tree!" :methods}
"TmxMapLoader" {"loader :tmx-map" :methods
"loader! :tmx-map" :methods}
"Touchpad.TouchpadStyle" {"style :touchpad" :constructors}
"TiledMap" {"tiled-map" :methods}
"TiledMapTileLayer" {"tiled-map-layer" :methods}
"TiledMapTileLayer.Cell" {"tiled-map-cell" :methods}
"TiledMap" {"tiled-map" :methods
"tiled-map!" :methods}
"TiledMapTileLayer" {"tiled-map-layer" :methods
"tiled-map-layer!" :methods}
"TiledMapTileLayer.Cell" {"tiled-map-cell" :methods
"tiled-map-cell!" :methods}
"Tree.TreeStyle" {"style :tree" :constructors}
"Vector2" {"vector-2" :methods}
"Vector3" {"vector-3" :methods}
"Vector2" {"vector-2" :methods
"vector-2!" :methods}
"Vector3" {"vector-3" :methods
"vector-3!" :methods}
"VertexAttributes.Usage" {"usage" :static-fields}
"VerticalGroup" {"vertical" :methods}
"VerticalGroup" {"vertical" :methods
"vertical!" :methods}
"WeldJointDef" {"joint-def :weld" :fields}
"WheelJointDef" {"joint-def :wheel" :fields}
"Window" {"window" :methods}
"Window" {"window" :methods
"window!" :methods}
"Window.WindowStyle" {"style :window" :constructors}
"WindowedMean" {"windowed-mean" :methods}
"World" {"box-2d" :methods}}
"WindowedMean" {"windowed-mean" :methods
"windowed-mean!" :methods}
"World" {"box-2d" :methods
"box-2d!" :methods}}

View File

@@ -0,0 +1,153 @@
/*
Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
*/
.hljs {
display: block; padding: 0.5em;
background: #F0F0F0;
}
.hljs,
.hljs-subst,
.hljs-tag .hljs-title,
.lisp .hljs-title,
.clojure .hljs-built_in,
.nginx .hljs-title {
color: black;
}
.hljs-string,
.hljs-title,
.hljs-constant,
.hljs-parent,
.hljs-tag .hljs-value,
.hljs-rules .hljs-value,
.hljs-rules .hljs-value .hljs-number,
.hljs-preprocessor,
.hljs-pragma,
.haml .hljs-symbol,
.ruby .hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.hljs-aggregate,
.hljs-template_tag,
.django .hljs-variable,
.smalltalk .hljs-class,
.hljs-addition,
.hljs-flow,
.hljs-stream,
.bash .hljs-variable,
.apache .hljs-tag,
.apache .hljs-cbracket,
.tex .hljs-command,
.tex .hljs-special,
.erlang_repl .hljs-function_or_atom,
.asciidoc .hljs-header,
.markdown .hljs-header,
.coffeescript .hljs-attribute {
color: #800;
}
.smartquote,
.hljs-comment,
.hljs-annotation,
.hljs-template_comment,
.diff .hljs-header,
.hljs-chunk,
.asciidoc .hljs-blockquote,
.markdown .hljs-blockquote {
color: #888;
}
.hljs-number,
.hljs-date,
.hljs-regexp,
.hljs-literal,
.hljs-hexcolor,
.smalltalk .hljs-symbol,
.smalltalk .hljs-char,
.go .hljs-constant,
.hljs-change,
.lasso .hljs-variable,
.makefile .hljs-variable,
.asciidoc .hljs-bullet,
.markdown .hljs-bullet,
.asciidoc .hljs-link_url,
.markdown .hljs-link_url {
color: #080;
}
.hljs-label,
.hljs-javadoc,
.ruby .hljs-string,
.hljs-decorator,
.hljs-filter .hljs-argument,
.hljs-localvars,
.hljs-array,
.hljs-attr_selector,
.hljs-important,
.hljs-pseudo,
.hljs-pi,
.haml .hljs-bullet,
.hljs-doctype,
.hljs-deletion,
.hljs-envvar,
.hljs-shebang,
.apache .hljs-sqbracket,
.nginx .hljs-built_in,
.tex .hljs-formula,
.erlang_repl .hljs-reserved,
.hljs-prompt,
.asciidoc .hljs-link_label,
.markdown .hljs-link_label,
.vhdl .hljs-attribute,
.clojure .hljs-attribute,
.asciidoc .hljs-attribute,
.lasso .hljs-attribute,
.coffeescript .hljs-property,
.hljs-phony {
color: #88F
}
.hljs-keyword,
.hljs-id,
.hljs-title,
.hljs-built_in,
.hljs-aggregate,
.css .hljs-tag,
.hljs-javadoctag,
.hljs-phpdoc,
.hljs-yardoctag,
.smalltalk .hljs-class,
.hljs-winutils,
.bash .hljs-variable,
.apache .hljs-tag,
.go .hljs-typename,
.tex .hljs-command,
.asciidoc .hljs-strong,
.markdown .hljs-strong,
.hljs-request,
.hljs-status {
font-weight: bold;
}
.asciidoc .hljs-emphasis,
.markdown .hljs-emphasis {
font-style: italic;
}
.nginx .hljs-built_in {
font-weight: normal;
}
.coffeescript .javascript,
.javascript .xml,
.lasso .markup,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
opacity: 0.5;
}

77
doclet/resources/main.css Normal file
View File

@@ -0,0 +1,77 @@
.sidebar {
width: 240px;
height: 100%;
top: 0px;
left: 0px;
position: fixed;
overflow: auto;
margin-left: 10px;
}
.ns {
font-size: 24px;
font-weight: bold;
}
.name {
margin-top: 5px;
margin-bottom: 5px;
}
.content {
margin-left: 250;
}
.item {
}
.clj {
}
.c-head {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.c-doc {
}
.c-src {
}
.java {
background: lightgray;
}
.j-text {
margin-bottom: 5px;
}
.j-item {
margin-bottom: 10px;
}
.j-name {
font-weight: bold;
}
.j-args {
margin-left: 5px;
}
.j-arg {
}
.j-type {
opacity: 0.5;
}
.j-doc {
font-style: italic;
}

View File

@@ -71,7 +71,8 @@
(defn parse-class
[^ClassDoc c]
(some->> (get classes (.typeName c))
(some->> (or (get classes (.qualifiedTypeName c))
(get classes (.typeName c)))
(map #(vector (first (string/split (first %) #" "))
{:text (.commentText c)
:items (parse-class-entry c %)}))))
@@ -133,8 +134,10 @@
(defn save
[parsed-files]
(->> parsed-files pr-str (spit (io/file "uberdoc.edn")))
(->> parsed-files html/create (spit (io/file "uberdoc.html"))))
(let [dir "doc"]
(.mkdir (io/file dir))
(->> parsed-files pr-str (spit (io/file "uberdoc.edn")))
(html/create dir parsed-files)))
(defn parse
[^RootDoc root]

View File

@@ -3,14 +3,24 @@
[clojure.string :as string]
[hiccup.core :refer :all]))
(defn str->filename
[s]
(-> s
(string/replace "?" "_q")
(string/replace ">" "_r")
(string/replace "<" "_l")
(str ".html")))
(defn sidebar
[parsed-files]
[:div {:class "sidebar"}
(for [{:keys [ns groups] :as pf} parsed-files]
(cons (when (> (count ns) 0)
[:div {:class "ns"} ns])
(for [g groups]
[:div {:class "name"} (:name g)])))])
(for [{:keys [name]} groups]
[:div {:class "name"}
[:a {:href (str->filename name)}
name]])))])
(defn java-param
[[type-name param-name]]
@@ -30,34 +40,49 @@
[:div {:class "j-doc"} text])])
(defn content
[parsed-files]
[{:keys [name docstring arglists java raw raw*]}]
[:div {:class "content"}
(for [{:keys [ns groups] :as pf} parsed-files]
(for [{:keys [name docstring arglists java raw raw*] :as g} groups]
[:div {:class "item"}
[:div {:class "clj"}
(for [args arglists]
[:div {:class "c-head"} (pr-str args)])
[:div {:class "c-doc"} docstring]]
(when (> (count java) 0)
(list [:div {:class "c-head"} "Options"]
(for [[item-name {:keys [text items]}] java]
(list (when (> (count java) 1)
[:div {:class "j-text"} text])
[:div {:class "java"}
(map java-item items)]))))
[:div {:class "c-head"} "Source"]
[:div {:class "c-src"}
(when raw* [:pre raw*])
[:pre raw]]]))])
[:div {:class "item"}
[:div {:class "clj"}
(for [args arglists]
[:div {:class "c-head"} (pr-str args)])
[:div {:class "c-doc"} docstring]]
(when (> (count java) 0)
(list [:div {:class "c-head"} "Options"]
(for [[item-name {:keys [text items]}] java]
(list (when (> (count java) 1)
[:div {:class "j-text"} text])
[:div {:class "java"}
(map java-item items)]))))
[:div {:class "c-head"} "Source"]
[:div {:class "c-src"}
(when raw* [:pre raw*])
[:pre raw]]]])
(defn create
[parsed-files]
(defn create-file
[parsed-files content]
(html [:head
[:link {:rel "stylesheet" :href "style.css"}]
[:link {:rel "stylesheet" :href "styles/default.css"}]]
[:title "play-clj docs"]
[:link {:rel "stylesheet" :href "highlight.css"}]
[:link {:rel "stylesheet" :href "main.css"}]]
[:body
(sidebar parsed-files)
(content parsed-files)
[:script (-> "highlight.pack.js" io/resource slurp)]
[:script (-> "init.js" io/resource slurp)]]))
content
[:script {:src "highlight.js"}]
[:script {:src "main.js"}]]))
(defn copy-from-res
[dir file-name]
(spit (io/file dir file-name)
(-> file-name io/resource slurp)))
(defn create
[dir parsed-files]
(copy-from-res dir "main.css")
(copy-from-res dir "main.js")
(copy-from-res dir "highlight.css")
(copy-from-res dir "highlight.js")
(doseq [{:keys [groups] :as pf} parsed-files]
(doseq [{:keys [name] :as group} groups]
(spit (io/file dir (str->filename name))
(create-file parsed-files (content group))))))