범위 선택기를 만들려고 노력 중이며 바닥에서 벗어날 수 없습니다.확대 범위 선택기
내가 좋아하는 일을하려고 해요 :
(sniptest "<div><p class='start'>Hi</p><p class='end'>There</p></div>"
[{[:.start] [:.end]}] (content "Hello"))
그리고 그것은 단지 공급 된 HTML을 반환합니다. 나는 그것이 몸 "안녕하세요"와 div를 반환 기대합니다.
어떻게하면됩니까?
편집
바로 이것이 내가 deftemplate 진짜 html 파일로 무슨 짓을했는지, 더 간결하기 :
HTML
<html>
<head>
<title></title>
</head>
<body>
<h1>Not hello</h1>
<div class="start">
foo
</div>
<div class="end">
bar
</div>
</body>
</html>
CLJ
(ns compojure-blog-test.views.landing-page
(:require [net.cgrand.enlive-html :as html]))
(html/deftemplate landing-page "compojure_blog_test/views/landing_page.html"
[blogs]
{[:.start] [:.end]} (html/content "Blah blah"))
나는 this tutorial과 함께 팔로우하고 있지만 범위와 일치 시키려면 스 니펫을 사용합니다. 이게 필요한가?
sniptest
으로 테스트 할 수 있습니까?
내가 오해 될 수있다 :
이것은 당신이
당신은 또한
do->
대신clone-for
사용할 수있는 조각의 위치에 따라 더 재미있는 일을 할 수 있습니다 , (콘텐츠 "안녕하세요") 대신 (콘텐츠 "안녕하세요") 의미 했습니까? –아니요, 콘텐츠가 일치하는 콘텐츠를 대체 할 것으로 생각했습니다. 잘못인가? – Khanzor