Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve node prefix #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

brandonros
Copy link

addresses #27

@@ -379,7 +379,13 @@ fn convert_node(el: &Element, config: &Config, path: &String) -> Option<Value> {
for child in el.children() {
match convert_node(child, config, &path) {
Some(val) => {
let name = &child.name().to_string();
let name = if child.prefix().is_some() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels awkward. There is probably a more idiomatic way of achieving the same.

@@ -379,7 +379,13 @@ fn convert_node(el: &Element, config: &Config, path: &String) -> Option<Value> {
for child in el.children() {
match convert_node(child, config, &path) {
Some(val) => {
let name = &child.name().to_string();
let name = if child.prefix().is_some() {
let formatted_name = format!("{}:{}", child.prefix().unwrap(), child.name().to_string());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format!() macro is a slow way of string concatenation. Consider [].concat()

@rimutaka
Copy link
Collaborator

@brandonros , thank you for the PR. I'm not sure what to do with it.

There was a talk of archiving this repo because it outlived its usefulness.
I hear that there are better alternatives. Did you find any?

If you think this repo is still relevant, I'm happy to work with you on the PR.

  1. I left some comments in the code
  2. We need to add a test for this feature and update the existing tests.
  3. I'm not sure how it affects everything else

Thanks again for the effort and let us know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants