将多个html片段文件与enlive、clojure组合
我有多个html文件,这些文件将被合并成一个html文件。这些多个文件类似于页眉、页脚等,它们是多个文件的公用文件。我正在使用enlive的将多个html片段文件与enlive、clojure组合,clojure,enlive,Clojure,Enlive,我有多个html文件,这些文件将被合并成一个html文件。这些多个文件类似于页眉、页脚等,它们是多个文件的公用文件。我正在使用enlive的html资源方法。但是,这种方法将丢失的html标记插入到最终文件中,这是我不想要的 以下是输出图 ({:tag :html, :attrs nil, :content ( {:tag :head, :attrs nil, :content ( {:tag :meta, :attrs {:content text/html; charset=utf-8,
html资源
方法。但是,这种方法将丢失的html标记插入到最终文件中,这是我不想要的
以下是输出图
({:tag :html, :attrs nil, :content (
{:tag :head, :attrs nil, :content (
{:tag :meta, :attrs {:content text/html; charset=utf-8, :http-equiv Content-Type}, :content ()}
{:tag :title, :attrs nil, :content (HewaniLife | Changing The Way You Live)}
{:tag :link, :attrs {:href styles/main.css, :rel stylesheet, :type text/css}, :content ()} )}
{:tag :body, :attrs nil, :content (
{:tag :html, :attrs nil, :content ({:tag :body, :attrs nil, :content ({:tag :div, :attrs {:id header}, :content (
{:tag :h1, :attrs nil, :content ({:tag :a, :attrs {:href index.xhtml, :id logo}, :content (
{:tag :span, :attrs {:class img-replace}, :content (hewaniLife)})})}
{:tag :div, :attrs {:id main-nav}, :content (
{:tag :ul, :attrs nil, :content (
{:tag :li, :attrs nil, :content ({:tag :a, :attrs {:href login.xhtml, :id btn-login}, :content (
{:tag :span, :attrs {:class img-replace}, :content (Login)})})}
{:tag :li, :attrs nil, :content ({:tag :a, :attrs {:href index.xhtml, :id btn-home}, :content (
{:tag :span, :attrs {:class img-replace}, :content (Home)})})}
{:tag :li, :attrs nil, :content ({:tag :a, :attrs {:href search.xhtml, :id btn-search}, :content (
{:tag :span, :attrs {:class img-replace}, :content (Search)})})})})}
{:type :comment, :data end of div#main-nav }
{:tag :br, :attrs {:class clear-all}, :content nil})} {:type :comment, :data end of div#header })})})})}
在这里,您可以看到我插入文件时嵌套的html标记
有没有办法插入这些文件
任何人都可以使用任何其他方法吗?我在名为
的html代码片段中找到了一个方法。您可以使用它来组合多个html片段代码。您应该使用defsnippet
并指定您感兴趣的部分。
您的所有片段甚至可以驻留在一个页面中,defsnippet将提取不同的片段
html片段
主要用于在repl上播放