Open Gerst20051 opened 1 year ago
I would like to do something like the following operations on an HTML file. Can you think of a way to do this?
[$]> echo "$(htmlq ".html.head.title = \"React App Title\"" $react_project_dir/index.html)" > $react_project_dir/index.html
[$]> echo "$(htmlq ".html.head.meta[name=description].content = \"React App Description\"" $react_project_dir/index.html)" > $react_project_dir/index.html
Current Options:
Similar Discussions:
I was able to do the following withyq/xq but it converts HTML to XML.
yq/xq
[$]> xq -x '.html.head.title = "Updated Title" | (.html.head.meta[] | select(."@name" == "description") | ."@content") |= "Updated Description"' index.html
Also interested in this use case. Being able to update a node, statically or via a command.
I would like to do something like the following operations on an HTML file. Can you think of a way to do this?
[$]> echo "$(htmlq ".html.head.title = \"React App Title\"" $react_project_dir/index.html)" > $react_project_dir/index.html
[$]> echo "$(htmlq ".html.head.meta[name=description].content = \"React App Description\"" $react_project_dir/index.html)" > $react_project_dir/index.html
Current Options:
Similar Discussions:
I was able to do the following with
yq/xq
but it converts HTML to XML.[$]> xq -x '.html.head.title = "Updated Title" | (.html.head.meta[] | select(."@name" == "description") | ."@content") |= "Updated Description"' index.html