0

私は最近プログラミングを始めたばかりで、この問題を抱えているので、この HTML スニペットがあります。img の src 属性を解析し、urly パスの正規化で正規化し、src に新しいパスを追加します。

<html>
<body>
    <div class="content">lorem ipsum
        <img style="margin-top: -5px;" src="/img/car.png" />
    </div>
    <img style="margin-top: -5px;" src="/img/chair.png" />
</body>
</html>

これになる

<html>
<body>
    <div class="content">lorem ipsum
        <img style="margin-top: -5px;" src="/path1/img/car.png" />
    </div>
    <img style="margin-top: -5px;" src="/path1/img/chair.png" />
</body>
</html>

私はこの方法を考えていますが、src値を取得する方法が見つかりません

(html/deftemplate template-about "../resources/public/build/about/index.html"
[]
[:img] (html/set-attr :src (str "path1" (urly/path-of ("the src value")))
)
4

1 に答える 1