Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Problem with context raw?

未关闭
#43 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@kou 已经在做这个了。

开始于 2021年2月2日。

评估

这个 Issue 还没有评估数据。

描述

question

Running ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [i386-mingw32]

  xml_string = '<root><foo>&amp;</foo><bar>&lt;</bar><baz>&gt;</baz><bat>&quot;</bat></root>'
  d = Document.new(xml_string, {raw: ['foo', 'baz']})
  d.to_s # => "<root><foo>&amp;</foo><bar>&lt;</bar><baz>&gt;</baz><bat>&quot;</bat></root>"
  root = d.root # => <root> ... </>
  foo, bar, baz, bat = *d.root
  # Each is an Element object:
  [foo, bar, baz, bat].map {|e| e.class }.uniq # => [REXML::Element]
  # Each element is marked as raw/not-raw as appropriate:
  [foo, bar, baz, bat].map {|e| e.raw } # => [true, false, true, false]
  # The first child of each is a Text object:
  [foo, bar, baz, bat].map {|e| e.first.class }.uniq # => [REXML::Text]
  # Each text is marked as raw/not-raw as appropriate:
  [foo, bar, baz, bat].map {|e| e.first.raw } # => [true, true, true, true]

Is this correct? I expected that last result to be [true, false, true, false].

主要语言
Ruby
星标
181
派生
105
平均合并
11 小时 3 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/rexml 的其他 Issue

查看 ruby/rexml 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。