This commit is contained in:
parent
92d3adc923
commit
3beb5cd830
@ -11,7 +11,8 @@ use opts::Opts;
|
|||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::{stdin, Read};
|
use std::io::Write;
|
||||||
|
use std::io::{stdin, stdout, Read};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
extern crate kuchiki;
|
extern crate kuchiki;
|
||||||
|
|
||||||
@ -74,9 +75,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||||||
// Let's get the actual text in this text node. A text node wraps around
|
// Let's get the actual text in this text node. A text node wraps around
|
||||||
// a RefCell<String>, so we need to call borrow() to get a &str out.
|
// a RefCell<String>, so we need to call borrow() to get a &str out.
|
||||||
//let text = text_node.as_text().unwrap().borrow();
|
//let text = text_node.as_text().unwrap().borrow();
|
||||||
|
write!(stdout(), "{}", serialize_node(as_node)?);
|
||||||
|
/*if let Some(child) = as_node.first_child() {
|
||||||
|
|
||||||
if let Some(child) = as_node.first_child() {
|
|
||||||
dbg!(serialize_node(&child));
|
|
||||||
//TODO: Convert Nodes to String, as this only works for Nodes containing plain text
|
//TODO: Convert Nodes to String, as this only works for Nodes containing plain text
|
||||||
if let Some(text) = child.as_text() {
|
if let Some(text) = child.as_text() {
|
||||||
// Prints:
|
// Prints:
|
||||||
@ -85,7 +86,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||||||
// "I love HTML"
|
// "I love HTML"
|
||||||
println!("{:?}", text.borrow());
|
println!("{:?}", text.borrow());
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user