您好,我有一个包含评论 (http://schema.org/WebPage) 的页面 (http://schema.org/Review)
问题是:
例子:
<html itemscope itemtype="http://schema.org/WebPage">
<meta name="description" content="_________" itemprop="description">
...
<div itemscope itemtype="http://schema.org/Review">
<div itemprop="description">_________</div>
</div>
...
</html>
描述属于评论和网页,所以...在这种情况下我应该写什么?
(注意:在前面的例子中字符串“__”是同一个文本段落,重复了两次)
编辑:
这可以解决吗? (html5规范没有讲这个,但是定义了itemref属性)
<html itemscope itemtype="http://schema.org/WebPage" id="WEBPAGE">
...
<div itemscope itemtype="http://schema.org/Review" id="REVIEW">
<div itemprop="description" itemref="WEBPAGE REVIEW">_________</div>
</div>
...
</html>
欢迎改进问题!
最佳答案
通过换行包含
当您使用 itemref 属性时,您将引用元素中包含的所有属性都包含在不同的范围内。
<body itemscope itemtype="http://schema.org/WebPage" itemref="wrapper">
...
<div itemscope itemtype="http://schema.org/Review">
...
<div id="wrapper">
<div itemprop="description">_________</div>
<div itemprop="some-other-property">_________</div>
</div>
...
</div>
...
</body>
通过换行包含 - 一个不同的例子
假设您的产品提供范围之外的一些不同报价。
<div itemscope itemtype="http://schema.org/Product" itemref="wrapper">
...
</div>
<div id="wrapper">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
...
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
...
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
...
</div>
</div>
包含特定属性
您可能只希望在范围之外包含一个特定属性,为此我们可以简单地直接在目标元素上设置 id,并指定 itemprop。
<body itemscope itemtype="http://schema.org/WebPage" itemref="target">
...
<div itemscope itemtype="http://schema.org/Review">
<div id="target" itemprop="description">_________</div>
</div>
...
</body>
多次引用
也许包装器不适用,那么您可以使用多个引用。您只需用空格将它们分开。
<body itemscope itemtype="http://schema.org/WebPage" itemref="desc name">
...
<div itemscope itemtype="http://schema.org/Review">
<div id="desc" itemprop="description">_________</div>
<div id="name" itemprop="name">_________</div>
</div>
...
</body>
另请参阅这些页面以获取一些其他解释和示例:
http://www.w3.org/TR/2011/WD-microdata-20110405/
http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html
关于html - 微数据 schema.org : how to mix together schemas?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10421334/
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳
我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.
我正在学习http://ruby.railstutorial.org/chapters/static-pages上的RubyonRails教程并遇到以下错误StaticPagesHomepageshouldhavethecontent'SampleApp'Failure/Error:page.shouldhave_content('SampleApp')Capybara::ElementNotFound:Unabletofindxpath"/html"#(eval):2:in`text'#./spec/requests/static_pages_spec.rb:7:in`(root)'
我正在尝试使用Curbgem执行以下POST以解析云curl-XPOST\-H"X-Parse-Application-Id:PARSE_APP_ID"\-H"X-Parse-REST-API-Key:PARSE_API_KEY"\-H"Content-Type:image/jpeg"\--data-binary'@myPicture.jpg'\https://api.parse.com/1/files/pic.jpg用这个:curl=Curl::Easy.new("https://api.parse.com/1/files/lion.jpg")curl.multipart_form_
无论您是想搭建桌面端、WEB端或者移动端APP应用,HOOPSPlatform组件都可以为您提供弹性的3D集成架构,同时,由工业领域3D技术专家组成的HOOPS技术团队也能为您提供技术支持服务。如果您的客户期望有一种在多个平台(桌面/WEB/APP,而且某些客户端是“瘦”客户端)快速、方便地将数据接入到3D应用系统的解决方案,并且当访问数据时,在各个平台上的性能和用户体验保持一致,HOOPSPlatform将帮助您完成。利用HOOPSPlatform,您可以开发在任何环境下的3D基础应用架构。HOOPSPlatform可以帮您打造3D创新型产品,HOOPSSDK包含的技术有:快速且准确的CAD
本教程将在Unity3D中混合Optitrack与数据手套的数据流,在人体运动的基础上,添加双手手指部分的运动。双手手背的角度仍由Optitrack提供,数据手套提供双手手指的角度。 01 客户端软件分别安装MotiveBody与MotionVenus并校准人体与数据手套。MotiveBodyMotionVenus数据手套使用、校准流程参照:https://gitee.com/foheart_1/foheart-h1-data-summary.git02 数据转发打开MotiveBody软件的Streaming,开始向Unity3D广播数据;MotionVenus中设置->选项选择Unit