1

w3m-extension.el で w3m プラグインを見つけて、次のような英語-中国語辞書を作成しました。

(defun w3m-search-dict-cn ()
   "Translate input word and search from dict.cn."
   (interactive)
   (w3m-search-advance "http://dict.cn/search/?q=" "English Dict.cn" 'gbk))

youdao dict Web サイトを使用してオンラインで dict を検索するように w3m プラグインを構成します。

(defun w3m-search-dict-cn ()
    "Translate input word and search from youdao.cn."
    (interactive)
    (w3m-search-advance "http://dict.youdao.com/search?q=" "English youdao.cn" 'UTF-8))

しかし、結果情報が大きすぎて読めないことがわかりました。

私が欲しいのはただ

<div id="collinsResult" class="tab-content">
 <div class="trans-container">
     <div class="trans-content">
         <div class="collinsToggle trans-container">
             <div class="wt-container">
                 <h4>
                     <span class="title">exception</span>
                     <em class="additional spell phonetic">/ɪkˈsɛpʃən/</em>
                     <span class="star star3" title="使用频率"></span>
                     <span class="via rank">CET4 TEM4</span>


                     <span class="additional pattern">(
                         exceptions
                         )</span>

                 </h4>

                 <ul class="ol">

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">1.&nbsp;</span>
                             <p>
                                 <span class="additional" title="可数名词">N-COUNT</span>
                                 An <b>exception</b> is a particular thing, person, or situation that is not included in a general statement, judgment, or rule. 例外

                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> Few guitarists can sing as well as they can play; Eddie, however, is an exception. </p>
                                 <p>很少有吉他手唱歌能唱得跟弹得一样好,而艾迪是个例外。&lt;/p>
                             </div>
                         </div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> The law makes no exceptions. </p>
                                 <p>法律不搞例外。&lt;/p>
                             </div>
                         </div>
                     </li>

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">2.&nbsp;</span>
                             <p>
                                 <span class="additional" title="习语">PHRASE</span>
                                 If you make a general statement, and then say that something or someone is <b>no exception</b>, you are emphasizing that they are included in that statement. 不例外; 无例外

                                 <span class="additional">[强调]</span>
                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> Marketing is applied to everything these days, and books are no exception. </p>
                                 <p>现在市场营销用于任何事物,图书也不例外。&lt;/p>
                             </div>
                         </div>
                     </li>

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">3.&nbsp;</span>
                             <p>
                                 <span class="additional" title="习语">PHRASE</span>
                                 If you <b>take exception to</b> something, you feel offended or annoyed by it, usually with the result that you complain about it. 厌恶; 反感

                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> He also took exception to having been spied on. </p>
                                 <p>他也厌恶被暗中监视。&lt;/p>
                             </div>
                         </div>
                     </li>

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">4.&nbsp;</span>
                             <p>
                                 <span class="additional" title="习语">PHRASE</span>
                                 You use <b>with the exception of</b> to introduce a thing or person that is not included in a general statement that you are making. 除外

                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> Yesterday was a day off for everybody, with the exception of Lorenzo. </p>
                                 <p>昨天每个人休一天假,洛伦佐除外。&lt;/p>
                             </div>
                         </div>
                     </li>
             </div>
         </div>
     </div>
 </div>
</div>

ページ全体ではなく「例外」という単語を検索すると。

w3m を使用してページをダウンロードし、HTML の必要な部分を取得してから、emacs バッファーに表示するにはどうすればよいですか?

4

1 に答える 1

2

M-x w3m-view-source、ソースコードを表示

M-x html-mode、または便利なキーバインドを提供するその他のモード

気になる部分に印をつける

M-x copy-to-bufferMY_NEW_BUFFER

<html>``</html>セクションにない場合はタグを追加

Mx w3m-buffer、選択したコンテンツを表示

于 2013-09-17T05:40:16.437 に答える