how to display the part of the html using emacs-w3m - emacs

I found a w3m plugin in w3m-extension.el for English-Chinese dict like this:
(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))
I configue the w3m plugin to search the dict online using the youdao dict website.
(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))
But I found that the result info is too large to read .
What i want is just
<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. </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>很少有吉他手唱歌能唱得跟弹得一样好,而艾迪是个例外。</p>
</div>
</div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> The law makes no exceptions. </p>
<p>法律不搞例外。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">2. </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>现在市场营销用于任何事物,图书也不例外。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">3. </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>他也厌恶被暗中监视。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">4. </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>昨天每个人休一天假,洛伦佐除外。</p>
</div>
</div>
</li>
</div>
</div>
</div>
</div>
</div>
when i search the word "exception" not the whole page.
How can I use the w3m to download the page and get what i want part of the html and then display in the emacs buffer?

M-x w3m-view-source, display source code
M-x html-mode, or any other mode providing the convenient key-binding
Mark the part of interest
M-x copy-to-buffer MY_NEW_BUFFER
Add <html>``</html> tags if missing in section
M-x w3m-buffer, display selected content

Related

How to use Schema.org for the list of my customers?

I am having trouble using Schema.org and working out which itemtypes to use for the list of my customers.
I have some thing like this:
<div class='famouse-brands'>
<h1> my famous customers </h1>
<div>Company name1 </div>
<div>Company name2 </div>
<div>Company name3 </div>
</div>
Not sure if I should use ItemList or customer and Invoice.
There are 2 ways to display the Customer using schema.org
Schema Type Invoice
<div itemscope itemtype="http://schema.org/Invoice">
<h1 itemprop="description">Invoice 1</h1>
<div itemprop="customer" itemscope itemtype="http://schema.org/Person">
<b itemprop="name">Jane Doe</b>
</div>
</div>
Schema Type Order
<div itemscope itemtype="http://schema.org/Order">
<h1 itemprop="description">Order 1</h1>
<div itemprop="customer" itemscope itemtype="http://schema.org/Person">
<b itemprop="name">Jane Doe</b>
</div>
</div>
You can use any of above schema as per your current website structure.
Also, you can refer the detailed schema demos with Microdata, RDFa and JSON-LD on the links given above for Invoice and Order.

How to use "offers" for small business that offers childcare services?

Using Google Rich Snippet to present my business as ChildCare ("A Childcare center.") how I can point to the services (programs) which I am offering in the facility as Offer in itemprop="offers"?
For example I am offering 3 services (programs) in the childcare like programs for "Infant, Toddlers, and Preschoolers". How I can use the offer to point these services and their options?
If you want to model the services as Offer, you can use the makesOffer property from ChildCare:
<div itemscope itemtype="http://schema.org/ChildCare">
<div itemprop="makesOffer" itemscope itemtype="http://schema.org/Offer">
<span itemprop="name">For Infants</span>
</div>
<div itemprop="makesOffer" itemscope itemtype="http://schema.org/Offer">
<span itemprop="name">For Toddlers</span>
</div>
<div itemprop="makesOffer" itemscope itemtype="http://schema.org/Offer">
<span itemprop="name">For Preschoolers</span>
</div>
</div>
If you want to model the services as Service, you can use the provider property from Service:
<!-- because itemref gets used, this element may not be a child of another Microdata item -->
<div itemprop="provider" itemscope itemtype="http://schema.org/ChildCare" id="the-childcare-business">
</div>
<div itemscope itemtype="http://schema.org/Service" itemref="the-childcare-business">
<span itemprop="name serviceType">Childcare for Infants</span>
</div>
<div itemscope itemtype="http://schema.org/Service" itemref="the-childcare-business">
<span itemprop="name serviceType">Childcare for Toddlers</span>
</div>
<div itemscope itemtype="http://schema.org/Service" itemref="the-childcare-business">
<span itemprop="name serviceType">Childcare for Preschoolers</span>
</div>
The main difference is that you may provide a price (price/priceCurrency) for an Offer, but not for a Service.
You could of course also use both types.

Can't validate Event rich snippet with PostalAddress and no Place

I'm defining a http://schema.org/Event for an "open house" tour of a residential home. The event's name is "Open House," but the location doesn't have a "name" (other than its address).
According to https://developers.google.com/structured-data/rich-snippets/events I ought to be able to use a PostalAddress for the location field of the snippet, perhaps like this:
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span>
</div>
</div>
</div>
But this fails in the Rich Snippet test tool. https://developers.google.com/structured-data/testing-tool/ It says that my location requires "name" and "address" properties.
That makes perfect sense if the location is a named Place, e.g. a restaurant or business venue. For example, this validates in the test tool:
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<div itemprop="name">WHAT DO I PUT HERE?!</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span></div>
</div>
</div>
</div>
The problem is, I have no idea what name to use for a residential home. It doesn't have a name, other than its address.
What's the right way to construct this snippet? Is Google's documentation incorrect? If the test tool is correct, do I have to name a nameless Place?
Right after posting my question, I realized that I could nest the address inside the name, making the name be equal to the address. The test tool accepts this. (But this feels wrong.)
<div itemscope itemtype="http://schema.org/Event">
<div itemprop="name">Open House</div>
<div itemprop="startDate" content="2015-07-04T13:00-0700">Sat, July 4th at 1pm</div>
<div itemprop="location" itemscope itemtype="http://schema.org/Place">
<div itemprop="name">
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div>
<span itemprop="streetAddress">123 Main St</span>,
<span itemprop="addressLocality">San Francisco</span>,
<span itemprop="addressRegion">CA</span>,
<span itemprop="postalCode">94111</span></div>
</div>
</div>
</div>
</div>

How to prevent an element from appearing under a parent schema?

I have some slightly awkward markup and need to reference some elements from a separate container, and prevent those elements from appearing under the parent in their hierarchy. How can I do this?
Here's my (simplified) markup:
<body itemscope itemtype='https://schema.org/AboutPage'>
<div itemscope itemtype="https://schema.org/ProfessionalService">
<ul>
<li><img id="photo-emp1" itemprop="image" src="..."/></li>
<li><img id="photo-emp2" itemprop="image" src="..."/></li>
<li><img id="photo-emp3" itemprop="image" src="..."/></li>
<li><img id="photo-emp4" itemprop="image" src="..."/></li>
</ul>
<div id="tab-emp1" itemprop="employee" itemscope itemtype="https://schema.org/Person"
itemref="photo-emp1">
<h1 itemprop="name">John Doe</h1>
<h2 itemprop="jobTitle">Vice President, Finance</h2>
<div itemprop="description">John is...</div>
</div>
<div id="tab-emp2" itemprop="employee" itemscope itemtype="https://schema.org/Person"
itemref="photo-emp2">
<h1 itemprop="name">Jane Roe</h1>
<h2 itemprop="jobTitle">Vice President, Operations</h2>
<div itemprop="description">Jane is...</div>
</div>
...
</div>
</body>
The structure is required for a tab control, so I can't rearrange the markup.
The itemref attribute on the Person correctly drags the image 'under' the https://schema.org/Person node.
However, the image elements ALSO appear as properties under the https://schema.org/ProfessionalService node, which is not correct or desired.
How can I keep the image elements in their current location, reference them under Person, but prevent them from appearing under ProfessionalService?
Just add the itemscope attribute to the ul element. You'll get an extra, disconnected, item, but the images will no longer be part of the ProfessionalService item.

schema.org event syntax for all day events and subEvents

Tried to Google out but came empty handed. I'm looking for a snippet containing example markup.
How should I mark all-day events?
How should I mark concerts having multiple performances with varying locations (for same data multiple start and end dates) aka. subEvents? This is what I tried:
<section itemscope itemtype="http://data-vocabulary.org/Event"><!-- section per event -->
<a href="/test#event_17" id="event_17" itemprop="url">
<h3><!-- visual title when and where -->
<div itemprop="summary"><!-- summary what the event is for -->
Summary text
</div>
</h3>
</a>
<span itemprop="location" class="location">
Location name
</span>
<span itemprop="subEvent" itemscope itemtype="http://data-vocabulary.org/Event">
<a href="/test#event_17_1" id="event_17_1" itemprop="url">
<time itemprop="startDate" datetime="2014-09-15T15:00:00+03:00">00:00</time>
—
<time itemprop="endDate" datetime="2014-09-15T17:00:00+03:00">00:00</time>
</a>
</span>
<span itemprop="subEvent" itemscope itemtype="http://data-vocabulary.org/Event">
<a href="/test#event_17_2" id="event_17_2" itemprop="url">
<time itemprop="startDate" datetime="2014-10-10T20:00:00+03:00">00:00</time>
—
<time itemprop="endDate" datetime="2014-10-10T22:00:00+03:00">00:00</time>
</a>
</span>
<div itemprop="description"><!-- details of the event -->
Description
</div>
</section>
Based solely on http://www.google.com/webmasters/tools/richsnippets
How should I mark all-day events?
For all day events it seems that the appropriate way is to give only datetime value. End date is not required.
2015/02/17
How should I mark concerts having multiple performances with varying locations (for same data multiple start and end dates) aka. subEvents?
Notice itemref to concert name.
<h1 itemscope=""><span id="concertName" itemprop="name">Foo</h1>
<p>
<span itemscope="" itemtype="http://schema.org/MusicEvent" itemref="concertName">
<strong>Wed 3.12.2014</strong> 10:05
<span itemprop="location" itemscope="" itemtype="http://schema.org/Place">
<span itemprop="name">Concert Hall</span>
</span>
<meta itemprop="startDate" content="2014-12-03T10:05:00+02:00" />
<meta itemprop="url" content="http://www.example.com/concert/8" />
</span>
<span itemscope="" itemtype="http://schema.org/MusicEvent" itemref="concertName">
<strong>Fri 26.12.2014</strong> 10:05
<span itemprop="location" itemscope="" itemtype="http://schema.org/Place">
<span itemprop="name">Concert Hall</span>
</span>
<meta itemprop="startDate" content="2014-12-26T10:05:00+02:00" />
<meta itemprop="url" content="http://www.example.com/concert/8" />
</span>
</p>