[hugo/fix] wrong internal link
This commit is contained in:
parent
271b82999b
commit
2809634cda
1 changed files with 13 additions and 10 deletions
|
@ -12,15 +12,18 @@
|
||||||
|
|
||||||
|
|
||||||
(defn clean-html
|
(defn clean-html
|
||||||
[docs]
|
[docs hugo]
|
||||||
(-> (.select docs "style[data-emotion-css~=^[a-z0-9]*$]")
|
(let [replace-str (if hugo
|
||||||
(.remove))
|
"/hp/"
|
||||||
(doseq [a (.select docs "a")]
|
"#/item/")]
|
||||||
(.attr a "href"
|
(-> (.select docs "style[data-emotion-css~=^[a-z0-9]*$]")
|
||||||
(-> (.attr a "href")
|
(.remove))
|
||||||
(str/replace "https://link.zhihu.com/?target=" "")
|
(doseq [a (.select docs "a")]
|
||||||
(str/replace "https://zhuanlan.zhihu.com/p/" "#/item/")
|
(.attr a "href"
|
||||||
(url-decode)))))
|
(-> (.attr a "href")
|
||||||
|
(str/replace "https://link.zhihu.com/?target=" "")
|
||||||
|
(str/replace "https://zhuanlan.zhihu.com/p/" replace-str)
|
||||||
|
(url-decode))))))
|
||||||
|
|
||||||
|
|
||||||
(defn clean-images
|
(defn clean-images
|
||||||
|
@ -48,7 +51,7 @@
|
||||||
title (.getElementsByClass page "Post-Title")
|
title (.getElementsByClass page "Post-Title")
|
||||||
post-time (.getElementsByClass page "ContentItem-time")
|
post-time (.getElementsByClass page "ContentItem-time")
|
||||||
docs (.getElementsByClass page "Post-RichTextContainer")]
|
docs (.getElementsByClass page "Post-RichTextContainer")]
|
||||||
(clean-html docs)
|
(clean-html docs hugo)
|
||||||
(clean-images docs)
|
(clean-images docs)
|
||||||
(render-linkcard docs)
|
(render-linkcard docs)
|
||||||
(let [content {:content (.toString docs)
|
(let [content {:content (.toString docs)
|
||||||
|
|
Loading…
Reference in a new issue