zoukankan      html  css  js  c++  java
  • sed case1

    sed -i 's/class=notification-bar/class=notification-bar id=notification-bar/g' *.html
    sed -i 's/class="sidebar site__sidebar"/class="sidebar site__sidebar" id=rmsidebar/g' *.html
    sed -i 's/class=navigation__inner/class=navigation__inner id=navigation__inner/g' *.html
    sed -i 's/class=navigation-sub>/class=navigation-sub id=navigation-sub>/g' *.html
    sed -i 's/class=sponsors>/class=sponsors id=sponsors>/g' *.html
    sed -i 's/class=page-links>/class=page-links id=page-links>/g' *.html
    sed -i 's#<h1>Printable</h1>##g' *.html
    sed -i 's/class=gitter__button/class=gitter__button id=gitter__button/g' *.html
    sed -i 's/class=footer>/class=footer id=footer>/g' *.html
    sed -i 's/class=contributors>/class=contributors id=contributors>/g' *.html
    sed -i -e '/</footer>/{r sci.js' -e 'd}' *.html
    

    找到匹配子段</footer>,注意有转义,替换为sci.js文件中的内容

    sci.js

    <script>
        //to remove sidebar, add "rmsidebar"
    var tobeRm=["notification-bar", "navigation__inner", "navigation-sub", "sponsors", "page-links", "gitter__button", "footer", "contributors"];
    
    for(let i=0;i<tobeRm.length;++i){
        let n = tobeRm[i];
        let e = document.getElementById(n)
        if(e && e.parentNode){
            e.parentNode.removeChild(e);
            console.log("dom:"+n + " removed!");
        }
        else
            console.log("!!@@## Can find by id:"+n);
    };
    </script></footer>
    
  • 相关阅读:
    nginx配置文件语法高亮显示方法
    GitLab服务器搭建及配置
    Git服务器搭建及配置
    SVN-Server搭建及配置
    python之subprocess
    jenkins配置从节点
    jenkins邮箱配置以及结合ansible进行批量构建
    tomcat+svn+maven+jenkins实现自动构建
    tomcat结合memcached构建session服务器
    基于tomcat集群做session共享
  • 原文地址:https://www.cnblogs.com/Searchor/p/13899422.html
Copyright © 2011-2022 走看看