Tag: yaml

你怎么做在YAML阻止评论?

有没有人知道如何评论在yaml线块?

JavaScript YAMLparsing器

我正在寻找一个JavaScript YAMLparsing器,它将YAML转换成HTML页面中可用的东西。 我已经在Github( https://github.com/visionmedia/js-yaml )上试过这个版本,但是它看起来只能用于node.js 我应该使用哪些库,是否有示例代码来显示示例用法?

如何使用YamlPropertiesFactoryBean使用Spring Framework 4.1加载YAML文件?

我有一个目前正在使用* .properties文件的弹簧应用程序,我想使用YAML文件。 我发现YamlPropertiesFactoryBean类似乎有能力做我所需要的。 我的问题是,我不知道如何在我的Spring应用程序(它使用基于注释的configuration)中使用这个类。 看来我应该使用setBeanFactory方法在PropertySourcesPlaceholderConfigurer中configuration它。 以前我使用@PropertySource加载属性文件如下: @Configuration @PropertySource("classpath:/default.properties") public class PropertiesConfig { @Bean public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } } 如何在PropertySourcesPlaceholderConfigurer中启用YamlPropertiesFactoryBean以便我可以直接加载YAML文件? 还是有另一种方法呢? 谢谢。 我的应用程序使用基于注解的configuration,我使用的是Spring Framework 4.1.4。 我发现了一些信息,但它总是指向我的Spring Boot,就像这个 。

YAML当前date在rmarkdown

我想知道是否有一个把当前date放在YAML文件的前端,由knitr和rmarkdown包处理的rmarkdown 。 我曾经在我的维基页面的顶部有以下行, _baptiste, `r format(Sys.time(), "%d %B, %Y")`_ 它会在html输出中转换为baptiste,2014年5月3日 。 现在,我想利用由rmarkdown提供的高级pandoc包装器,但是在YAML头文件中使用r代码似乎不起作用: — title: "Sample Document" output: html_document: toc: true theme: united date: `r format(Sys.time(), "%d %B, %Y")` author: baptiste — Error in yaml::yaml.load(front_matter) : Scanner error: while scanning for the next token at line 6, column 7 found character that cannot start any token […]

rails的错误,无法parsingYAML

更新gem后,我有这个: /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 182 column 9 (Psych::SyntaxError) from /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse_stream' from /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:119:in `parse' from /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:106:in `load' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth/formatters/latex.rb:6:in `<module:LATEX>' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth/formatters/latex.rb:3:in `<top (required)>' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth.rb:21:in `require' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/redcloth.rb:21:in `<top (required)>' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/case_sensitive_require/RedCloth.rb:6:in `require' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/RedCloth-4.2.3/lib/case_sensitive_require/RedCloth.rb:6:in `<top (required)>' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `block (2 levels) in require' from /home/megas/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each' […]

如何从JSON获取string对象而不是Unicode?

我使用Python 2从ASCII编码的文本文件中parsingJSON。 当用json或simplejson加载这些文件时,我所有的string值都被转换为Unicode对象而不是string对象。 问题是,我必须使用一些只接受string对象的库的数据。 我不能更改库或更新它们。 是否有可能获得string对象而不是Unicode的? 例 >>> import json >>> original_list = ['a', 'b'] >>> json_list = json.dumps(original_list) >>> json_list '["a", "b"]' >>> new_list = json.loads(json_list) >>> new_list [u'a', u'b'] # I want these to be of type `str`, not `unicode` 更新 很久以前,当我被Python 2困住时,这个问题被问到了 。 今天一个简单而干净的解决scheme就是使用Python的最新版本 – 即Python 3和forward。

在YAML中,我如何分割多行的string?

在YAML中,我有一个很长的string。 我想保留在编辑器的80列左右,所以我想打破这个string。 这是什么语法? 换句话说,我有这个: Key: 'this is my very very very very very very long string' 我想要这个(或者是这个效果): Key: 'this is my very very very ' + 'long string' 我想使用上面的引号,所以我不需要在string中的任何内容。