|
21 | 21 | {:added "0.15.0"}
|
22 | 22 | (:require
|
23 | 23 | [clojure.java.io :as io]
|
24 |
| - [clojure.string :as string] |
| 24 | + [clojure.string :as str] |
25 | 25 | [orchard.java.modules :as modules]
|
26 | 26 | [orchard.java.source-files :as src-files]
|
27 | 27 | [orchard.misc :as misc])
|
|
126 | 126 | "Using parse tree info, return the type's name equivalently to the `typesym`
|
127 | 127 | function in `orchard.java`."
|
128 | 128 | ([n ^DocletEnvironment env]
|
129 |
| - (let [t (string/replace (str n) #"<.*>" "") ; drop generics |
| 129 | + (let [t (str/replace (str n) #"<.*>" "") ; drop generics |
130 | 130 | util (.getElementUtils env)]
|
131 | 131 | (if-let [c (.getTypeElement util t)]
|
132 | 132 | (let [pkg (str (.getPackageOf util c) ".")
|
133 |
| - cls (-> (string/replace-first t pkg "") |
134 |
| - (string/replace "." "$"))] |
| 133 | + cls (-> (str/replace-first t pkg "") |
| 134 | + (str/replace "." "$"))] |
135 | 135 | (symbol (str pkg cls))) ; classes
|
136 | 136 | (symbol t))))) ; primitives
|
137 | 137 |
|
|
294 | 294 | xs))
|
295 | 295 |
|
296 | 296 | (defn remove-left-margin [s]
|
297 |
| - (->> (string/split s #"\r?\n" -1) ;; split-lines without losing trailing newlines |
| 297 | + (->> (str/split s #"\r?\n" -1) ;; split-lines without losing trailing newlines |
298 | 298 | (map-indexed (fn [i s]
|
299 | 299 | (let [first? (zero? i)
|
300 |
| - blank? (string/blank? s)] |
| 300 | + blank? (str/blank? s)] |
301 | 301 | (cond-> s
|
302 | 302 | (and (not first?)
|
303 | 303 | (not blank?))
|
304 |
| - (string/replace #"^ +" ""))))) |
305 |
| - (string/join "\n"))) |
| 304 | + (str/replace #"^ +" ""))))) |
| 305 | + (str/join "\n"))) |
306 | 306 |
|
307 | 307 | (defn cleanup-whitespace [fragments]
|
308 | 308 | (into []
|
|
311 | 311 | :as x}]
|
312 | 312 | (let [text? (= content-type "text")]
|
313 | 313 | (assoc x :content (-> content
|
314 |
| - (string/replace #"^ +" " ") |
315 |
| - (string/replace #" +$" " ") |
316 |
| - (string/replace #"\s*\n+\s*\n+\s*" "\n\n") |
317 |
| - (string/replace #"\n +$" "\n") |
| 314 | + (str/replace #"^ +" " ") |
| 315 | + (str/replace #" +$" " ") |
| 316 | + (str/replace #"\s*\n+\s*\n+\s*" "\n\n") |
| 317 | + (str/replace #"\n +$" "\n") |
318 | 318 | (cond-> text? remove-left-margin
|
319 |
| - text? (string/replace #"^ +\." ".") |
320 |
| - text? (string/replace #"^ +," ","))))))) |
| 319 | + text? (str/replace #"^ +\." ".") |
| 320 | + text? (str/replace #"^ +," ","))))))) |
321 | 321 | fragments))
|
322 | 322 |
|
323 | 323 | (defn docstring
|
|
345 | 345 | :found-closing-tags-types
|
346 | 346 | found-closing-tags-types))
|
347 | 347 | :result)]
|
348 |
| - {:doc (some-> env .getElementUtils (.getDocComment e) string/trim) |
| 348 | + {:doc (some-> env .getElementUtils (.getDocComment e) str/trim) |
349 | 349 | :doc-first-sentence-fragments (-> first-sentence coalesce cleanup-whitespace)
|
350 | 350 | :doc-fragments (-> full-body coalesce cleanup-whitespace)
|
351 | 351 | :doc-block-tags-fragments (-> block-tags coalesce cleanup-whitespace)}))
|
|
382 | 382 | (= kind TypeKind/TYPEVAR)
|
383 | 383 | (upper-bound type))
|
384 | 384 | str
|
385 |
| - (string/replace #"<.*>" "") ;; Remove generics |
| 385 | + (str/replace #"<.*>" "") ;; Remove generics |
386 | 386 | symbol)]
|
387 | 387 | (some-> (or best
|
388 | 388 | (type->sym element))
|
389 | 389 | str
|
390 |
| - (string/replace "$" ".") |
| 390 | + (str/replace "$" ".") |
391 | 391 | symbol)))
|
392 | 392 | parameters)
|
393 | 393 | :argnames (mapv #(-> ^VariableElement % .getSimpleName str symbol) (.getParameters m))}))
|
|
0 commit comments