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>
    
  • 相关阅读:
    机器学习知识点总结(1)
    RPC基本原理
    Oracle中ORA-01113,ORA-01110的简单解决
    跟着whatwg看一遍事件循环
    node进程间通信
    白话协程【前端视角】
    白话typescript中的【extends】和【infer】(含vue3的UnwrapRef)
    原来rollup这么简单之插件篇
    面试官: 说说你对async的理解
    白话web安全
  • 原文地址:https://www.cnblogs.com/Searchor/p/13899422.html
Copyright © 2011-2022 走看看