-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Zheng
committed
Oct 1, 2016
1 parent
a562c9b
commit 7954a7b
Showing
24 changed files
with
946 additions
and
161 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
<style> | ||
<@=css-page> | ||
<@=css-code> | ||
<@=css-api> | ||
<@=css-highlight> | ||
</style> | ||
</head> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
.api .entry-description | ||
{ | ||
display: flex; | ||
} | ||
|
||
.api ul | ||
{ | ||
list-style-type: none; | ||
padding-left: 5px; | ||
} | ||
|
||
.api .entry-description h4 | ||
{ | ||
float: left; | ||
width: auto; | ||
height 30px; | ||
} | ||
|
||
.api .entry-description p | ||
{ | ||
float: left; | ||
margin-bottom: 0px; | ||
padding-left:2px; | ||
} | ||
|
||
.api .entry-option h6 | ||
{ | ||
float: left; | ||
padding-right:5px; | ||
} | ||
|
||
.api .entry-option .args | ||
{ | ||
font-weight: lighter; | ||
} | ||
|
||
.api .entry pre | ||
{ | ||
width: 100%; | ||
} | ||
|
||
.api .entry pre h6 | ||
{ | ||
float: right; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,42 @@ | ||
(ns lucid.publish.collect.api | ||
(:require [lucid.core.code :as code])) | ||
(:require [lucid.core.code :as code] | ||
[lucid.publish.collect.reference :as reference])) | ||
|
||
(defn collect-apis | ||
"" | ||
{:added "1.2"} | ||
[{:keys [articles] :as interim} name] | ||
[{:keys [articles project] :as interim} name] | ||
(let [all (->> (get-in articles [name :elements]) | ||
(filter #(-> % :type (= :api))))] | ||
interim)) | ||
(filter #(-> % :type (= :api)))) | ||
namespaces (-> (map (comp symbol :namespace) all))] | ||
(-> interim | ||
(update-in [:references] | ||
(fnil (fn [references] | ||
(reference/reference-namespaces references | ||
(:lookup project) | ||
namespaces)) | ||
{}))))) | ||
|
||
(comment | ||
"DO NOT DELETE!!!!!" | ||
|
||
(:lookup PROJECT) | ||
(-> (parse/parse-file | ||
"test/documentation/hara_zip.clj" PROJECT) | ||
(->> (assoc-in {} [:articles "hara-zip" :elements])) | ||
(assoc :project PROJECT) | ||
(collect-references "hara-zip") | ||
:references | ||
keys) | ||
(hara.zip hara.zip.base)) | ||
|
||
(comment | ||
(do (require '[lucid.publish :as publish] | ||
'[lucid.publish.theme] | ||
'[hara.io.project :as project] | ||
'[lucid.publish.parse :as parse]) | ||
|
||
(def project-file "/Users/chris/Development/chit/hara/project.clj") | ||
|
||
(def PROJECT (let [project (project/project project-file)] | ||
(assoc project :lookup (project/file-lookup project)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(ns lucid.publish.engine.plugin.api | ||
(:require [lucid.publish.render.util :as util] | ||
[clojure.string :as string])) | ||
|
||
(defn entry-tag [ns var] | ||
(munge (str "entry__" ns "__" var))) | ||
|
||
(defn api-entry [[var entry] {:keys [project namespace] :as elem}] | ||
[:div {:class "entry"} | ||
[:a {:name (entry-tag namespace var)}] | ||
[:div {:class "entry-description"} | ||
[:h4 [:b (str var " ")]] | ||
[:p [:i (:intro entry)]]] | ||
|
||
[:div {:class "entry-option"} | ||
[:h6 | ||
" args: " | ||
[:i {:class "args"} | ||
(string/join " " (:arglists entry)) ] | ||
" " | ||
[:a {:href (format "%s/blob/master/%s#L%d-L%d" | ||
(:url project) | ||
(-> entry :source :path) | ||
(-> entry :source :line :row) | ||
(-> entry :source :line :end-row)) | ||
:target "_blank"} | ||
"(source)"]]] | ||
(let [code (-> entry :test :code | ||
(util/adjust-indent 2) | ||
(string/trim))] | ||
[:pre | ||
[:h6 [:i [:a {:href (format "%s/blob/master/%s#L%d-L%d" | ||
(:url project) | ||
(-> entry :test :path) | ||
(-> entry :test :line :row) | ||
(-> entry :test :line :end-row))} | ||
"(test code)"]]] | ||
[:code {:class "clojure"} code]])]) | ||
|
||
(defn api-contents [{:keys [table project] :as elem}] | ||
(->> table | ||
seq | ||
sort | ||
(map #(api-entry % elem)))) | ||
|
||
(defn api-element | ||
[{:keys [table tag title namespace] :as elem}] | ||
[:div {:class "api"} | ||
[:div [:hr] [:h2 (or title namespace)] [:hr]] | ||
[:div | ||
[:h3 "Outline"] | ||
(apply vector | ||
:ul | ||
(map (fn [v] | ||
[:li [:a {:href (str "#" (entry-tag namespace v))} (str v)] | ||
" - " (get-in table [v :intro])]) | ||
(-> table keys sort))) | ||
[:h3 "Contents"] | ||
(apply vector :div (api-contents elem))]]) |
Oops, something went wrong.