diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-16 18:54:35 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-08-19 13:41:55 +0200 |
commit | c07334e7bb613774d3535663433c90b6dde86943 (patch) | |
tree | 56907f1e62718d7caa21d6fc05db1b8e66578e65 /src/emitter.rs | |
parent | 26cd63394f640920db4ea9402d77cec1358fb098 (diff) |
break!: rename doctype _identifier methods/fields to _id
Just a bit more succinct. And now rustdoc also no longer
cuts off the names of these Emitter methods in its sidebar.
Diffstat (limited to 'src/emitter.rs')
-rw-r--r-- | src/emitter.rs | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/emitter.rs b/src/emitter.rs index cf22a44..ffd51f8 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -140,22 +140,22 @@ pub trait Emitter<O> { /// Assuming the _current token_ is a doctype, set its "public identifier" to the empty string. /// /// If the current token is not a doctype, this method may panic. - fn init_doctype_public_identifier(&mut self); + fn init_doctype_public_id(&mut self); /// Assuming the _current token_ is a doctype, set its "system identifier" to the empty string. /// /// If the current token is not a doctype, this method may panic. - fn init_doctype_system_identifier(&mut self); + fn init_doctype_system_id(&mut self); /// Assuming the _current token_ is a doctype, append a string to its "public identifier" to the given string. /// /// If the current token is not a doctype, this method may panic. - fn push_doctype_public_identifier(&mut self, s: &str); + fn push_doctype_public_id(&mut self, s: &str); /// Assuming the _current token_ is a doctype, append a string to its "system identifier" to the given string. /// /// If the current token is not a doctype, this method may panic. - fn push_doctype_system_identifier(&mut self, s: &str); + fn push_doctype_system_id(&mut self, s: &str); } /// The default implementation of [`Emitter`], used to produce tokens. @@ -372,8 +372,8 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { self.current_token = Some(Token::Doctype(Doctype { name: String::new(), force_quirks: false, - public_identifier: None, - system_identifier: None, + public_id: None, + system_id: None, })); } @@ -403,31 +403,29 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { let current_attr = self.current_attribute.as_mut().unwrap(); current_attr.1.value.push_str(s); } - fn init_doctype_public_identifier(&mut self) { + fn init_doctype_public_id(&mut self) { if let Some(Token::Doctype(Doctype { - ref mut public_identifier, - .. + ref mut public_id, .. })) = self.current_token { - *public_identifier = Some("".to_owned()); + *public_id = Some("".to_owned()); } else { debug_assert!(false); } } - fn init_doctype_system_identifier(&mut self) { + fn init_doctype_system_id(&mut self) { if let Some(Token::Doctype(Doctype { - ref mut system_identifier, - .. + ref mut system_id, .. })) = self.current_token { - *system_identifier = Some("".to_owned()); + *system_id = Some("".to_owned()); } else { debug_assert!(false); } } - fn push_doctype_public_identifier(&mut self, s: &str) { + fn push_doctype_public_id(&mut self, s: &str) { if let Some(Token::Doctype(Doctype { - public_identifier: Some(ref mut id), + public_id: Some(ref mut id), .. })) = self.current_token { @@ -436,9 +434,9 @@ impl<O: Offset> Emitter<O> for DefaultEmitter<O> { debug_assert!(false); } } - fn push_doctype_system_identifier(&mut self, s: &str) { + fn push_doctype_system_id(&mut self, s: &str) { if let Some(Token::Doctype(Doctype { - system_identifier: Some(ref mut id), + system_id: Some(ref mut id), .. })) = self.current_token { @@ -514,9 +512,9 @@ impl<O: Offset> Comment<O> { /// A doctype. Some examples: /// /// * `<!DOCTYPE {name}>` -/// * `<!DOCTYPE {name} PUBLIC '{public_identifier}'>` -/// * `<!DOCTYPE {name} SYSTEM '{system_identifier}'>` -/// * `<!DOCTYPE {name} PUBLIC '{public_identifier}' '{system_identifier}'>` +/// * `<!DOCTYPE {name} PUBLIC '{public_id}'>` +/// * `<!DOCTYPE {name} SYSTEM '{system_id}'>` +/// * `<!DOCTYPE {name} PUBLIC '{public_id}' '{system_id}'>` #[derive(Debug, Eq, PartialEq)] pub struct Doctype { /// The ["force quirks"](https://html.spec.whatwg.org/#force-quirks-flag) flag. @@ -526,10 +524,10 @@ pub struct Doctype { pub name: String, /// The doctype's public identifier. - pub public_identifier: Option<String>, + pub public_id: Option<String>, /// The doctype's system identifier. - pub system_identifier: Option<String>, + pub system_id: Option<String>, } /// The token type used by default. You can define your own token type by implementing the |