| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
use linkify::LinkFinder; |
| 21 |
use linkify::LinkKind; |
| 22 |
use regex::Regex; |
| 23 |
|
| 24 |
use crate::i18n::i18n_f; |
| 25 |
use html5ever::tendril::TendrilSink; |
| 26 |
use html5ever::tree_builder::TreeBuilderOpts; |
| 27 |
use html5ever::{ParseOpts, expanded_name, parse_document}; |
| 28 |
use markup5ever_rcdom::{ |
| 29 |
Handle, |
| 30 |
NodeData::{Document, Element, Text}, |
| 31 |
RcDom, |
| 32 |
}; |
| 33 |
|
| 34 |
const INDENT: i32 = 4; |
| 35 |
|
| 36 |
#[derive(Clone)] |
| 37 |
enum NewlineHandling { |
| 38 |
ToSpace, |
| 39 |
Remove, |
| 40 |
Keep, |
| 41 |
} |
| 42 |
|
| 43 |
fn escape_text(t: &str, newline_handling: NewlineHandling) -> String { |
| 44 |
let escaped = t |
| 45 |
.replace('&', "&") |
| 46 |
.replace('<', "<") |
| 47 |
.replace('>', ">") |
| 48 |
|
| 49 |
.replace("&amp;", "&") |
| 50 |
.replace("<lt;", "<") |
| 51 |
.replace(">gt;", ">"); |
| 52 |
let newlined_text = match newline_handling { |
| 53 |
NewlineHandling::ToSpace => escaped.replace('\n', " "), |
| 54 |
NewlineHandling::Remove => escaped.replace('\n', ""), |
| 55 |
NewlineHandling::Keep => escaped, |
| 56 |
}; |
| 57 |
collapse_whitespaces(newlined_text) |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
fn collapse_whitespaces(string: String) -> String { |
| 62 |
let mut was_space = false; |
| 63 |
string |
| 64 |
.chars() |
| 65 |
.filter(|c| { |
| 66 |
let is_space = c.eq(&' '); |
| 67 |
if is_space && was_space { |
| 68 |
return false; |
| 69 |
} |
| 70 |
was_space = is_space || c.eq(&'\n'); |
| 71 |
true |
| 72 |
}) |
| 73 |
.collect() |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
#[derive(Debug)] |
| 78 |
enum NewlineStyle { |
| 79 |
Text, |
| 80 |
Tag, |
| 81 |
} |
| 82 |
enum ListStyle { |
| 83 |
Ordered(i32), |
| 84 |
Unordered, |
| 85 |
} |
| 86 |
struct ParserState { |
| 87 |
nl_style: NewlineStyle, |
| 88 |
skip_leading_spaces: bool, |
| 89 |
indent: i32, |
| 90 |
list_style: Vec<ListStyle>, |
| 91 |
inside_link: i32, |
| 92 |
} |
| 93 |
|
| 94 |
fn find_newline_style(node: &Handle) -> NewlineStyle { |
| 95 |
match &node.data { |
| 96 |
Document => { |
| 97 |
let children = node.children.borrow(); |
| 98 |
for el in children.iter() { |
| 99 |
if let NewlineStyle::Tag = find_newline_style(el) { |
| 100 |
return NewlineStyle::Tag; |
| 101 |
} |
| 102 |
} |
| 103 |
} |
| 104 |
Element { name, .. } => { |
| 105 |
match name.expanded() { |
| 106 |
expanded_name!(html "p") => { |
| 107 |
return NewlineStyle::Tag; |
| 108 |
} |
| 109 |
expanded_name!(html "br") => { |
| 110 |
return NewlineStyle::Tag; |
| 111 |
} |
| 112 |
_ => (), |
| 113 |
}; |
| 114 |
let children = node.children.borrow(); |
| 115 |
for el in children.iter() { |
| 116 |
if let NewlineStyle::Tag = find_newline_style(el) { |
| 117 |
return NewlineStyle::Tag; |
| 118 |
} |
| 119 |
} |
| 120 |
} |
| 121 |
_ => (), |
| 122 |
} |
| 123 |
NewlineStyle::Text |
| 124 |
} |
| 125 |
|
| 126 |
fn handle_child(buffer: &mut String, node: &Handle, state: &mut ParserState) { |
| 127 |
match &node.data { |
| 128 |
Document => { |
| 129 |
let children = node.children.borrow(); |
| 130 |
for el in children.iter() { |
| 131 |
handle_child(buffer, el, state); |
| 132 |
} |
| 133 |
} |
| 134 |
Element { name, attrs, .. } => { |
| 135 |
let mut wrapper_href = None; |
| 136 |
let mut is_p_tag = false; |
| 137 |
let mut is_list_tag = false; |
| 138 |
let wrapper_tag = match name.expanded() { |
| 139 |
|
| 140 |
|
| 141 |
expanded_name!(html "a") => { |
| 142 |
let local_name = local_name!("href"); |
| 143 |
wrapper_href = attrs |
| 144 |
.borrow() |
| 145 |
.iter() |
| 146 |
.find(|attr| attr.name.local == local_name) |
| 147 |
.cloned(); |
| 148 |
|
| 149 |
|
| 150 |
wrapper_href.as_ref().map(|_| "a") |
| 151 |
} |
| 152 |
expanded_name!(html "p") => { |
| 153 |
is_p_tag = true; |
| 154 |
None |
| 155 |
} |
| 156 |
expanded_name!(html "br") => { |
| 157 |
buffer.push('\n'); |
| 158 |
state.skip_leading_spaces = true; |
| 159 |
None |
| 160 |
} |
| 161 |
expanded_name!(html "img") => { |
| 162 |
let local_name = local_name!("alt"); |
| 163 |
let alt = attrs |
| 164 |
.borrow() |
| 165 |
.iter() |
| 166 |
.find(|attr| attr.name.local == local_name) |
| 167 |
.cloned(); |
| 168 |
if let Some(alt_text) = alt { |
| 169 |
let escaped_alt = escape_text(&alt_text.value, NewlineHandling::ToSpace); |
| 170 |
buffer.push('['); |
| 171 |
buffer.push_str(escaped_alt.as_str()); |
| 172 |
buffer.push_str("]\n"); |
| 173 |
state.skip_leading_spaces = true; |
| 174 |
} |
| 175 |
None |
| 176 |
} |
| 177 |
expanded_name!(html "ol") => { |
| 178 |
state.list_style.push(ListStyle::Ordered(1)); |
| 179 |
state.indent += INDENT; |
| 180 |
is_list_tag = true; |
| 181 |
is_p_tag = true; |
| 182 |
None |
| 183 |
} |
| 184 |
expanded_name!(html "ul") => { |
| 185 |
state.list_style.push(ListStyle::Unordered); |
| 186 |
state.indent += INDENT; |
| 187 |
is_list_tag = true; |
| 188 |
is_p_tag = true; |
| 189 |
None |
| 190 |
} |
| 191 |
expanded_name!(html "li") => { |
| 192 |
buffer.push('\n'); |
| 193 |
for _ in 0..state.indent { |
| 194 |
buffer.push(' '); |
| 195 |
} |
| 196 |
if let Some(style) = state.list_style.last_mut() { |
| 197 |
match style { |
| 198 |
ListStyle::Unordered => buffer.push_str("• "), |
| 199 |
ListStyle::Ordered(i) => { |
| 200 |
buffer.push_str(&format!("{}. ", i)); |
| 201 |
*style = ListStyle::Ordered(*i + 1); |
| 202 |
} |
| 203 |
} |
| 204 |
} |
| 205 |
state.skip_leading_spaces = true; |
| 206 |
None |
| 207 |
} |
| 208 |
expanded_name!(html "b") => Some("b"), |
| 209 |
expanded_name!(html "i") => Some("i"), |
| 210 |
expanded_name!(html "s") => Some("s"), |
| 211 |
expanded_name!(html "u") => Some("u"), |
| 212 |
expanded_name!(html "tt") => Some("tt"), |
| 213 |
expanded_name!(html "pre") => Some("tt"), |
| 214 |
expanded_name!(html "code") => Some("tt"), |
| 215 |
expanded_name!(html "sub") => Some("sub"), |
| 216 |
expanded_name!(html "sup") => Some("sup"), |
| 217 |
_ => None, |
| 218 |
}; |
| 219 |
|
| 220 |
let skip_tag = if let Some(href) = wrapper_href.as_ref() { |
| 221 |
wrapper_tag == Some("a") |
| 222 |
&& (href.value.trim_start().starts_with('#') |
| 223 |
|| href.value.trim().is_empty() |
| 224 |
|| href.value.trim_start().starts_with("jump:")) |
| 225 |
} else { |
| 226 |
false |
| 227 |
}; |
| 228 |
let wrote_tag = if skip_tag { |
| 229 |
false |
| 230 |
} else if let Some(tag) = wrapper_tag { |
| 231 |
buffer.push('<'); |
| 232 |
buffer.push_str(tag); |
| 233 |
let is_link; |
| 234 |
if let Some(href) = wrapper_href { |
| 235 |
buffer.push_str(" href=\""); |
| 236 |
buffer.push_str(&escape_text(&href.value, NewlineHandling::Remove)); |
| 237 |
buffer.push('"'); |
| 238 |
state.inside_link += 1; |
| 239 |
is_link = true; |
| 240 |
} else { |
| 241 |
is_link = false; |
| 242 |
} |
| 243 |
|
| 244 |
buffer.push('>'); |
| 245 |
|
| 246 |
let children = node.children.borrow(); |
| 247 |
for el in children.iter() { |
| 248 |
handle_child(buffer, el, state); |
| 249 |
} |
| 250 |
buffer.push_str("</"); |
| 251 |
buffer.push_str(tag); |
| 252 |
buffer.push('>'); |
| 253 |
|
| 254 |
if is_link { |
| 255 |
state.inside_link -= 1; |
| 256 |
} |
| 257 |
true |
| 258 |
} else { |
| 259 |
false |
| 260 |
}; |
| 261 |
|
| 262 |
if !wrote_tag { |
| 263 |
let children = node.children.borrow(); |
| 264 |
for el in children.iter() { |
| 265 |
handle_child(buffer, el, state); |
| 266 |
} |
| 267 |
if is_p_tag { |
| 268 |
buffer.push_str("\n\n"); |
| 269 |
state.skip_leading_spaces = true; |
| 270 |
} |
| 271 |
if is_list_tag { |
| 272 |
state.indent -= INDENT; |
| 273 |
state.list_style.pop(); |
| 274 |
} |
| 275 |
} |
| 276 |
} |
| 277 |
Text { contents } => { |
| 278 |
let nl_handling = match state.nl_style { |
| 279 |
NewlineStyle::Tag => NewlineHandling::ToSpace, |
| 280 |
NewlineStyle::Text => NewlineHandling::Keep, |
| 281 |
}; |
| 282 |
|
| 283 |
if state.skip_leading_spaces { |
| 284 |
let text = escape_text(contents.borrow().trim_start(), nl_handling.clone()); |
| 285 |
if !text.is_empty() { |
| 286 |
state.skip_leading_spaces = false; |
| 287 |
} |
| 288 |
if state.inside_link > 0 { |
| 289 |
|
| 290 |
push_remaining_text(buffer, &text) |
| 291 |
} else { |
| 292 |
push_timestamped_text(buffer, &text, nl_handling) |
| 293 |
} |
| 294 |
} else { |
| 295 |
let text = escape_text(&contents.borrow(), nl_handling.clone()); |
| 296 |
if state.inside_link > 0 { |
| 297 |
|
| 298 |
push_remaining_text(buffer, &text) |
| 299 |
} else { |
| 300 |
push_timestamped_text(buffer, &text, nl_handling) |
| 301 |
} |
| 302 |
} |
| 303 |
} |
| 304 |
_ => (), |
| 305 |
} |
| 306 |
} |
| 307 |
|
| 308 |
fn push_timestamped_text(buffer: &mut String, text: &str, nl_handling: NewlineHandling) { |
| 309 |
let mut position = 0; |
| 310 |
if let Ok(re) = Regex::new(r"([0-9]+):([0-9]+)(?::([0-9]+))?") { |
| 311 |
for captures in re.captures_iter(text) { |
| 312 |
let first: Option<i32> = captures.get(1).and_then(|c| c.as_str().parse().ok()); |
| 313 |
let second: Option<i32> = captures.get(2).and_then(|c| c.as_str().parse().ok()); |
| 314 |
let third: Option<i32> = captures.get(3).and_then(|c| c.as_str().parse().ok()); |
| 315 |
if let (Some(hours), Some(minutes), Some(seconds)) = (first, second, third) { |
| 316 |
let jump_time = (hours * 60 * 60) + (minutes * 60) + seconds; |
| 317 |
|
| 318 |
let title = i18n_f( |
| 319 |
"Jump to {}:{}:{}", |
| 320 |
&[ |
| 321 |
&format!("{:02}", hours), |
| 322 |
&format!("{:02}", minutes), |
| 323 |
&format!("{:02}", seconds), |
| 324 |
], |
| 325 |
); |
| 326 |
let range = captures.get(0).unwrap().range(); |
| 327 |
|
| 328 |
push_text_with_links(buffer, &text[position..range.start], nl_handling.clone()); |
| 329 |
buffer |
| 330 |
.push_str(format!("<a href=\"jump:{jump_time}\" title=\"{title}\">").as_str()); |
| 331 |
buffer.push_str(&text[range.start..range.end]); |
| 332 |
buffer.push_str("</a>"); |
| 333 |
position = range.end; |
| 334 |
} else if let (Some(minutes), Some(seconds)) = (first, second) { |
| 335 |
let jump_time = (minutes * 60) + seconds; |
| 336 |
|
| 337 |
let title = i18n_f( |
| 338 |
"Jump to {}:{}", |
| 339 |
&[&format!("{:02}", minutes), &format!("{:02}", seconds)], |
| 340 |
); |
| 341 |
let range = captures.get(0).unwrap().range(); |
| 342 |
|
| 343 |
push_text_with_links(buffer, &text[position..range.start], nl_handling.clone()); |
| 344 |
buffer.push_str( |
| 345 |
format!("<a href=\"jump:{}\" title=\"{title}\">", jump_time).as_str(), |
| 346 |
); |
| 347 |
buffer.push_str(&text[range.start..range.end]); |
| 348 |
buffer.push_str("</a>"); |
| 349 |
position = range.end; |
| 350 |
} |
| 351 |
} |
| 352 |
push_text_with_links(buffer, &text[position..], nl_handling); |
| 353 |
} else { |
| 354 |
push_text_with_links(buffer, text, nl_handling); |
| 355 |
} |
| 356 |
} |
| 357 |
|
| 358 |
fn push_text_with_links(buffer: &mut String, text: &str, nl_handling: NewlineHandling) { |
| 359 |
let mut finder = LinkFinder::new(); |
| 360 |
finder.url_must_have_scheme(false); |
| 361 |
let mut position = 0; |
| 362 |
for link in finder.links(text) { |
| 363 |
let link_str = link.as_str(); |
| 364 |
let remaining_link_text = escape_text(&text[position..link.start()], nl_handling.clone()); |
| 365 |
push_remaining_text(buffer, &remaining_link_text); |
| 366 |
|
| 367 |
match link.kind() { |
| 368 |
LinkKind::Email => { |
| 369 |
buffer.push_str(format!("<a href=\"mailto:{}\">", link_str).as_str()); |
| 370 |
} |
| 371 |
LinkKind::Url => { |
| 372 |
if link.as_str().starts_with("http://") || link_str.starts_with("https://") { |
| 373 |
buffer.push_str(format!("<a href=\"{}\">", link_str).as_str()); |
| 374 |
} else { |
| 375 |
buffer.push_str(format!("<a href=\"https:{}\">", link_str).as_str()); |
| 376 |
} |
| 377 |
} |
| 378 |
_ => { |
| 379 |
buffer.push_str(format!("<a href=\"{}\">", link_str).as_str()); |
| 380 |
} |
| 381 |
} |
| 382 |
push_remaining_text(buffer, &text[(link.start())..(link.end())]); |
| 383 |
buffer.push_str("</a>"); |
| 384 |
position = link.end(); |
| 385 |
} |
| 386 |
|
| 387 |
let end_text = escape_text(&text[position..], nl_handling); |
| 388 |
push_remaining_text(buffer, &end_text); |
| 389 |
} |
| 390 |
|
| 391 |
pub fn push_remaining_text(buffer: &mut String, text: &str) { |
| 392 |
|
| 393 |
buffer.push_str(text); |
| 394 |
} |
| 395 |
|
| 396 |
pub fn html2pango_markup(t: &str) -> String { |
| 397 |
let mut buffer = String::with_capacity(t.len()); |
| 398 |
let opts = ParseOpts { |
| 399 |
tree_builder: TreeBuilderOpts { |
| 400 |
drop_doctype: true, |
| 401 |
..Default::default() |
| 402 |
}, |
| 403 |
..Default::default() |
| 404 |
}; |
| 405 |
let dom: RcDom = parse_document(RcDom::default(), opts) |
| 406 |
.from_utf8() |
| 407 |
.read_from(&mut t.as_bytes()) |
| 408 |
.unwrap(); |
| 409 |
|
| 410 |
let root: Handle = dom.document; |
| 411 |
let nl_style = find_newline_style(&root); |
| 412 |
handle_child( |
| 413 |
&mut buffer, |
| 414 |
&root, |
| 415 |
&mut ParserState { |
| 416 |
nl_style, |
| 417 |
skip_leading_spaces: true, |
| 418 |
indent: 0, |
| 419 |
list_style: vec![], |
| 420 |
inside_link: 0, |
| 421 |
}, |
| 422 |
); |
| 423 |
buffer |
| 424 |
} |
| 425 |
|
| 426 |
#[cfg(test)] |
| 427 |
mod tests { |
| 428 |
use super::*; |
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
#[test] |
| 450 |
fn test_html_based() { |
| 451 |
let description = "<p>Here is an unlocked Britainology to hopefully brighten your weekend. Yes, it was a little bit late when it came out. It was late because Nate and Milo got exposed to covid right before Christmas and couldn\'t record while waiting on test results. But we have in fact discussed Jim Davidson\'s terrible bawdy Cinderella pantomime from 1995, entitled \'Sinderella\', and discussed the concept of pantos in general. Hope you enjoy!</p>\n\n<p>We\'ve also unlocked the Dogging episode of Britainology to the $5 tier--get it here: <a href=\"https://www.patreon.com/posts/51682396\">https://www.patreon.com/posts/51682396</a></p>\n\n<p>And if you want two (2) Britainologies a month, sign up on the $10 tier on Patreon! This month\'s second episode features us discussing the British Army with friend of the show, veteran, leftist, and author Joe Glenton: <a href=\"https://www.patreon.com/posts/56590770\">https://www.patreon.com/posts/56590770</a></p>\n\n<p>*MILO ALERT* Smoke returns for another night of new material from pro-comics featuring Edinburgh Comedy Award winner Jordan Brookes. See it all, for the low price of £5, on September 28 at 8 pm at The Sekforde Arms (34 Sekforde Street London EC1R 0HA): <a href=\"https://www.eventbrite.co.uk/e/smoke-comedy-featuring-jordan-brookes-tickets-171869475227\">https://www.eventbrite.co.uk/e/smoke-comedy-featuring-jordan-brookes-tickets-171869475227</a></p>\n\n<p>Trashfuture are: Riley (<a href=\"https://twitter.com/raaleh\">@raaleh</a>), Milo (<a href=\"https://twitter.com/Milo_Edwards\">@Milo_Edwards</a>), Hussein (<a href=\"https://twitter.com/HKesvani\">@HKesvani</a>), Nate (<a href=\"https://twitter.com/inthesedeserts\">@inthesedeserts</a>), and Alice (<a href=\"https://twitter.com/AliceAvizandum\">@AliceAvizandum</a>)</p>"; |
| 452 |
let expected = "Here is an unlocked Britainology to hopefully brighten your weekend. Yes, it was a little bit late when it came out. It was late because Nate and Milo got exposed to covid right before Christmas and couldn't record while waiting on test results. But we have in fact discussed Jim Davidson's terrible bawdy Cinderella pantomime from 1995, entitled 'Sinderella', and discussed the concept of pantos in general. Hope you enjoy!\n\nWe've also unlocked the Dogging episode of Britainology to the $5 tier--get it here: <a href=\"https://www.patreon.com/posts/51682396\">https://www.patreon.com/posts/51682396</a>\n\nAnd if you want two (2) Britainologies a month, sign up on the $10 tier on Patreon! This month's second episode features us discussing the British Army with friend of the show, veteran, leftist, and author Joe Glenton: <a href=\"https://www.patreon.com/posts/56590770\">https://www.patreon.com/posts/56590770</a>\n\n*MILO ALERT* Smoke returns for another night of new material from pro-comics featuring Edinburgh Comedy Award winner Jordan Brookes. See it all, for the low price of £5, on September 28 at 8 pm at The Sekforde Arms (34 Sekforde Street London EC1R 0HA): <a href=\"https://www.eventbrite.co.uk/e/smoke-comedy-featuring-jordan-brookes-tickets-171869475227\">https://www.eventbrite.co.uk/e/smoke-comedy-featuring-jordan-brookes-tickets-171869475227</a>\n\nTrashfuture are: Riley (<a href=\"https://twitter.com/raaleh\">@raaleh</a>), Milo (<a href=\"https://twitter.com/Milo_Edwards\">@Milo_Edwards</a>), Hussein (<a href=\"https://twitter.com/HKesvani\">@HKesvani</a>), Nate (<a href=\"https://twitter.com/inthesedeserts\">@inthesedeserts</a>), and Alice (<a href=\"https://twitter.com/AliceAvizandum\">@AliceAvizandum</a>)\n\n"; |
| 453 |
let markup = html2pango_markup(description); |
| 454 |
|
| 455 |
assert_eq!(expected, markup); |
| 456 |
} |
| 457 |
#[test] |
| 458 |
fn test_html_based2() { |
| 459 |
let description = "<p>So, in rank defiance of our recent promise to \'get back to the nazis\' instead we continue our James Lindsay coverage. (What... me? Irony? How dare you?) This time, Daniel patiently walks a distracted, slightly hyperactive, and increasingly incredulous Jack through the infamous \'Grievance Studies Hoax\' (AKA \'Sokal Squared\') in which Lindsay and colleagues Helen Pluckrose and Peter Boghossian tried (and then claimed) to prove something or other about modern Humanities academia by submitting a load of stupid fake papers to various feminist and fat studies journals. As Daniel reveals, the episode was an orgy of dishonesty and tactical point-missing that actually proved the opposite of what the team of snickering tricksters thought they were proving. Sadly, however, because we live in Hell, the trio have only raised their profiles as a result. A particular highlight of the episode is Lindsay revealing his staggering ignorance when \'responding\' to criticism.</p> <p>Content warnings, as ever.</p> <p><span>Podcast Notes:</span></p> <p>Please consider donating to help us make the show and stay independent. Patrons get exclusive access to one full extra episode a month.</p> <p>Daniel\'s Patreon: <a href=\"https://www.patreon.com/danielharper\">https://www.patreon.com/danielharper</a></p> <p>Jack\'s Patreon: <a href=\"https://www.patreon.com/user?u=4196618&fan_landing=true\">https://www.patreon.com/user?u=4196618</a></p> <p>IDSG Twitter: <a href=\"https://twitter.com/idsgpod\">https://twitter.com/idsgpod</a></p> <p>Daniel\'s Twitter: <a href=\"https://twitter.com/danieleharper\">@danieleharper</a></p> <p>Jack\'s Twitter: <a href=\"https://twitter.com/_Jack_Graham_\">@_Jack_Graham_</a></p> <p>IDSG on Apple Podcasts: <a href=\"https://podcasts.apple.com/us/podcast/i-dont-speak-german/id1449848509?ls=1\"> https://podcasts.apple.com/us/podcast/i-dont-speak-german/id1449848509?ls=1</a></p> <p> </p> <p><span>Show Notes:</span></p> <p>James Lindsay, New Discourses, \"Why You Can Be Transgender But Not Transracial.\"\" <a href=\"https://newdiscourses.com/2021/06/why-you-can-be-transgender-but-not-transracial/\"> https://newdiscourses.com/2021/06/why-you-can-be-transgender-but-not-transracial/</a></p> <p>James Lindsay has a day job, apparently. \"Maryville man walks path of healing and combat.\" <a href=\"https://www.thedailytimes.com/news/maryville-man-walks-path-of-healing-and-combat/article_5ea3c0ca-2e98-5283-9e59-06861b8588cb.html\"> https://www.thedailytimes.com/news/maryville-man-walks-path-of-healing-and-combat/article_5ea3c0ca-2e98-5283-9e59-06861b8588cb.html</a></p> <p>Areo Magazine, Academic Grievance Studies and the Corruption of Scholarship. <a href=\"https://areomagazine.com/2018/10/02/academic-grievance-studies-and-the-corruption-of-scholarship/\"> https://areomagazine.com/2018/10/02/academic-grievance-studies-and-the-corruption-of-scholarship/</a></p> <p>Full listing of Grievance Studies Papers and Reviews. <a href=\"https://drive.google.com/drive/folders/19tBy_fVlYIHTxxjuVMFxh4pqLHM_en18\"> https://drive.google.com/drive/folders/19tBy_fVlYIHTxxjuVMFxh4pqLHM_en18</a></p> <p>\'Mein Kampf\' and the \'Feminazis\': What Three Academics\' Hitler Hoax Really Reveals About \'Wokeness\'. <a href=\"https://web.archive.org/web/20210328112901/https://www.haaretz.com/us-news/.premium-hitler-hoax-academic-wokeness-culture-war-1.9629759\"> https://web.archive.org/web/20210328112901/https://www.haaretz.com/us-news/.premium-hitler-hoax-academic-wokeness-culture-war-1.9629759</a></p> <p>\"First and foremost, the source material. The chapter the hoaxers chose, not by coincidence, one of the least ideological and racist parts of Hitler\'s book. Chapter 12, probably written in April/May 1925, deals with how the newly refounded NSDAP should rebuild as a party and amplify its program.</p> <p>\"According to their own account, the writers took parts of the chapter and inserted feminist \"buzzwords\"; they \"significantly changed\" the \"original wording and intent” of the text to make the paper \"publishable and about feminism.\" An observant reader might ask: what could possibly remain of any Nazi content after that? But no one in the media, apparently, did.\"</p> <p>New Discourses, \"There Is No Good Part of Hitler\'s Mein Kampf\" <a href=\"https://newdiscourses.com/2021/03/there-is-no-good-part-of-hitlers-mein-kampf/\"> https://newdiscourses.com/2021/03/there-is-no-good-part-of-hitlers-mein-kampf/</a></p> <p>On this episode of the New Discourses Podcast, James Lindsay, who helped to write the paper and perpetrate the Grievance Studies Affair, talks about the project and the creation of this particular paper at unprecedented length and in unprecedented detail, revealing Nilssen not to know what he’s talking about. If you have ever wondered about what the backstory of the creation of the “Feminist Mein Kampf” paper really was, including why its authors did it, you won’t want to miss this long-form discussion and rare response to yet another underinformed critic of Lindsay, Boghossian, and Pluckrose’s work.</p> <p>The Grieveance Studies Affair Revealed. <a href=\"https://www.youtube.com/watch?v=kVk9a5Jcd1k\">https://www.youtube.com/watch?v=kVk9a5Jcd1k</a></p> <p>Reviewer 1 Comments on Dog Park Paper</p> <p>\"page 9 - the human subjects are afforded anonymity and not asked about income, etc for ethical reasons. yet, the author as researcher intruded into the dogs\' spaces to examine and record genitalia. I realize this was necessary to the project, but could the author acknowledge/explain/justify this (arguably, anthropocentric) difference? Indicating that it was necessary to the research would suffice but at least the difference should be acknowledged.\"</p> <p>Nestor de Buen, Anti-Science Humping in the Dog Park. <a href=\"https://conceptualdisinformation.substack.com/p/anti-science-humping-in-the-dog-park\"> https://conceptualdisinformation.substack.com/p/anti-science-humping-in-the-dog-park</a></p> <p>\"What is even more striking is that if the research had actually been conducted and the results showed what the paper says they show, there is absolutely no reason why it should not have been published. And moreover, what it proves is the opposite of what its intention is. It shows that one can make scientifically testable claims based on the conceptual framework of gender studies, and that the field has all the markings of a perfectly functional research programme.\"</p> <p>\"Yes, the dog park paper is based on false data and, like Sokal’s, contains a lot of unnecessary jargon, but it is not nonsense, and the distinction is far from trivial. Nonsense implies one cannot even obtain a truth value from a proposition. In fact, the paper being false, if anything, proves that it is not nonsense, yet the grievance hoaxers try to pass falsity as nonsense. Nonsense is something like Chomsky’s famous sentence “colorless green ideas sleep furiously.” It is nonsense because it is impossible to decide how one might evaluate whether it is true. A false sentence would be “the moon is cubical.” It has a definite meaning, it just happens not to be true. </p> <p>\"So, if the original Sokal Hoax is like Chomsky’s sentence, the dog park paper is much more like “the moon is cubical.” And in fact, a more accurate analogy would be “the moon is cubical and here is a picture that proves it,” and an attached doctored picture of the cubical moon.\"</p> <p>Reviewer 2 Comments on the Dog-Park Paper</p> <p>\"I am a bit curious about your methodology. Can you say more? You describe your methods here (procedures for collecting data), but not really your overall approach to methodology. Did you just show up, observe, write copious notes, talk to people when necessary, and then leave? If so, it might be helpful to explicitly state this. It sounds to me like you did a kind of ethnography (methodology — maybe multispecies ethnography?) but that’s not entirely clear here. Or are you drawing on qualitative methods in social behaviorism/symbolic interactionism? In either case, the methodology chosen should be a bit more clearly articulated.\"</p> <p>Counterweight. <a href=\"https://counterweightsupport.com/\">https://counterweightsupport.com/</a></p> <p>\"Welcome to Counterweight, the home of scholarship and advice on [Critical Social Justice](<a href=\"https://counterweightsupport.com/2021/02/17/what-do-we-mean-by-critical-social-justice/\">https://counterweightsupport.com/2021/02/17/what-do-we-mean-by-critical-social-justice/</a>) ideology. We are here to connect you with the resources, advice and guidance you need to address CSJ beliefs as you encounter them in your day-to-day life. The Counterweight community is a non-partisan, grassroots movement advocating for liberal concepts of social justice including individualism, universalism, viewpoint diversity and the free exchange of ideas. [Subscribe](https://counterweightsupport.com/subscribe-to-counterweight/) today to become part of the Counterweight movement.\"\"</p> <p>Inside Higher Ed, \"Blowback Against a Hoax.\" <a href=\"https://www.insidehighered.com/news/2019/01/08/author-recent-academic-hoax-faces-disciplinary-action-portland-state\"> https://www.insidehighered.com/news/2019/01/08/author-recent-academic-hoax-faces-disciplinary-action-portland-state</a></p> <p>Peter Boghossian Resignation Latter from PSU. <a href=\"https://bariweiss.substack.com/p/my-university-sacrificed-ideas-for\"> https://bariweiss.substack.com/p/my-university-sacrificed-ideas-for</a></p> <p> </p>"; |
| 460 |
|
| 461 |
let expected = "So, in rank defiance of our recent promise to 'get back to the nazis' instead we continue our James Lindsay coverage.\u{a0} (What... me? Irony? How dare you?)\u{a0} This time, Daniel patiently walks a distracted, slightly hyperactive, and increasingly incredulous Jack through the infamous 'Grievance Studies Hoax' (AKA 'Sokal Squared') in which Lindsay and colleagues Helen Pluckrose and Peter Boghossian tried (and then claimed) to prove something or other about modern Humanities academia by submitting a load of stupid fake papers to various feminist and fat studies journals.\u{a0} As Daniel reveals, the episode was an orgy of dishonesty and tactical point-missing that actually proved the opposite of what the team of snickering tricksters thought they were proving.\u{a0} Sadly, however, because we live in Hell, the trio have only raised their profiles as a result.\u{a0} A particular highlight of the episode is Lindsay revealing his staggering ignorance when 'responding' to criticism.\n\nContent warnings, as ever.\n\nPodcast Notes:\n\nPlease consider donating to help us make the show and stay independent.\u{a0} Patrons get exclusive access to one full extra episode a month.\n\nDaniel's Patreon: <a href=\"https://www.patreon.com/danielharper\">https://www.patreon.com/danielharper</a>\n\nJack's Patreon: <a href=\"https://www.patreon.com/user?u=4196618&fan_landing=true\">https://www.patreon.com/user?u=4196618</a>\n\nIDSG Twitter: <a href=\"https://twitter.com/idsgpod\">https://twitter.com/idsgpod</a>\n\nDaniel's Twitter: <a href=\"https://twitter.com/danieleharper\">@danieleharper</a>\n\nJack's Twitter: <a href=\"https://twitter.com/_Jack_Graham_\">@_Jack_Graham_</a>\n\nIDSG on Apple Podcasts: <a href=\"https://podcasts.apple.com/us/podcast/i-dont-speak-german/id1449848509?ls=1\"> https://podcasts.apple.com/us/podcast/i-dont-speak-german/id1449848509?ls=1</a>\n\n\n\nShow Notes:\n\nJames Lindsay, New Discourses, \"Why You Can Be Transgender But Not Transracial.\"\" <a href=\"https://newdiscourses.com/2021/06/why-you-can-be-transgender-but-not-transracial/\"> https://newdiscourses.com/2021/06/why-you-can-be-transgender-but-not-transracial/</a>\n\nJames Lindsay has a day job, apparently. \"Maryville man walks path of healing and combat.\" <a href=\"https://www.thedailytimes.com/news/maryville-man-walks-path-of-healing-and-combat/article_5ea3c0ca-2e98-5283-9e59-06861b8588cb.html\"> https://www.thedailytimes.com/news/maryville-man-walks-path-of-healing-and-combat/article_5ea3c0ca-2e98-5283-9e59-06861b8588cb.html</a>\n\nAreo Magazine, Academic Grievance Studies and the Corruption of Scholarship. <a href=\"https://areomagazine.com/2018/10/02/academic-grievance-studies-and-the-corruption-of-scholarship/\"> https://areomagazine.com/2018/10/02/academic-grievance-studies-and-the-corruption-of-scholarship/</a>\n\nFull listing of Grievance Studies Papers and Reviews. <a href=\"https://drive.google.com/drive/folders/19tBy_fVlYIHTxxjuVMFxh4pqLHM_en18\"> https://drive.google.com/drive/folders/19tBy_fVlYIHTxxjuVMFxh4pqLHM_en18</a>\n\n'Mein Kampf' and the 'Feminazis': What Three Academics' Hitler Hoax Really Reveals About 'Wokeness'. <a href=\"https://web.archive.org/web/20210328112901/https://www.haaretz.com/us-news/.premium-hitler-hoax-academic-wokeness-culture-war-1.9629759\"> https://web.archive.org/web/20210328112901/https://www.haaretz.com/us-news/.premium-hitler-hoax-academic-wokeness-culture-war-1.9629759</a>\n\n\"First and foremost, the source material. The chapter the hoaxers chose, not by coincidence, one of the least ideological and racist parts of Hitler's book. Chapter 12, probably written in April/May 1925, deals with how the newly refounded NSDAP should rebuild as a party and amplify its program.\n\n\"According to their own account, the writers took parts of the chapter and inserted feminist \"buzzwords\"; they \"significantly changed\" the \"original wording and intent” of the text to make the paper \"publishable and about feminism.\" An observant reader might ask: what could possibly remain of any Nazi content after that? But no one in the media, apparently, did.\"\n\nNew Discourses, \"There Is No Good Part of Hitler's Mein Kampf\" <a href=\"https://newdiscourses.com/2021/03/there-is-no-good-part-of-hitlers-mein-kampf/\"> https://newdiscourses.com/2021/03/there-is-no-good-part-of-hitlers-mein-kampf/</a>\n\nOn this episode of the New Discourses Podcast, James Lindsay, who helped to write the paper and perpetrate the Grievance Studies Affair, talks about the project and the creation of this particular paper at unprecedented length and in unprecedented detail, revealing Nilssen not to know what he’s talking about. If you have ever wondered about what the backstory of the creation of the “Feminist Mein Kampf” paper really was, including why its authors did it, you won’t want to miss this long-form discussion and rare response to yet another underinformed critic of Lindsay, Boghossian, and Pluckrose’s work.\n\nThe Grieveance Studies Affair Revealed. <a href=\"https://www.youtube.com/watch?v=kVk9a5Jcd1k\">https://www.youtube.com/watch?v=kVk9a5Jcd1k</a>\n\nReviewer 1 Comments on Dog Park Paper\n\n\"page 9 - the human subjects are afforded anonymity and not asked about income, etc for ethical reasons. yet, the author as researcher intruded into the dogs' spaces to examine and record genitalia. I realize this was necessary to the project, but could the author acknowledge/explain/justify this (arguably, anthropocentric) difference? Indicating that it was necessary to the research would suffice but at least the difference should be acknowledged.\"\n\nNestor de Buen, Anti-Science Humping in the Dog Park. <a href=\"https://conceptualdisinformation.substack.com/p/anti-science-humping-in-the-dog-park\"> https://conceptualdisinformation.substack.com/p/anti-science-humping-in-the-dog-park</a>\n\n\"What is even more striking is that if the research had actually been conducted and the results showed what the paper says they show, there is absolutely no reason why it should not have been published. And moreover, what it proves is the opposite of what its intention is. It shows that one can make scientifically testable claims based on the conceptual framework of gender studies, and that the field has all the markings of a perfectly functional research programme.\"\n\n\"Yes, the dog park paper is based on false data and, like Sokal’s, contains a lot of unnecessary jargon, but it is not nonsense, and the distinction is far from trivial. Nonsense implies one cannot even obtain a truth value from a proposition. In fact, the paper being false, if anything, proves that it is not nonsense, yet the grievance hoaxers try to pass falsity as nonsense. Nonsense is something like Chomsky’s famous sentence “colorless green ideas sleep furiously.” It is nonsense because it is impossible to decide how one might evaluate whether it is true. A false sentence would be “the moon is cubical.” It has a definite meaning, it just happens not to be true.\u{a0}\n\n\"So, if the original Sokal Hoax is like Chomsky’s sentence, the dog park paper is much more like “the moon is cubical.” And in fact, a more accurate analogy would be “the moon is cubical and here is a picture that proves it,” and an attached doctored picture of the cubical moon.\"\n\nReviewer 2 Comments on the Dog-Park Paper\n\n\"I am a bit curious about your methodology. Can you say more? You describe your methods here (procedures for collecting data), but not really your overall approach to methodology. Did you just show up, observe, write copious notes, talk to people when necessary, and then leave? If so, it might be helpful to explicitly state this. It sounds to me like you did a kind of ethnography (methodology — maybe multispecies ethnography?) but that’s not entirely clear here. Or are you drawing on qualitative methods in social behaviorism/symbolic interactionism? In either case, the methodology chosen should be a bit more clearly articulated.\"\n\nCounterweight. <a href=\"https://counterweightsupport.com/\">https://counterweightsupport.com/</a>\n\n\"Welcome to Counterweight, the home of scholarship and advice on [Critical Social Justice](<a href=\"https://counterweightsupport.com/2021/02/17/what-do-we-mean-by-critical-social-justice/\">https://counterweightsupport.com/2021/02/17/what-do-we-mean-by-critical-social-justice/</a>) ideology. We are here to connect you with the resources, advice and guidance you need to address CSJ beliefs as you encounter them in your day-to-day life. The Counterweight community is a non-partisan, grassroots movement advocating for liberal concepts of social justice including individualism, universalism, viewpoint diversity and the free exchange of ideas. [Subscribe](<a href=\"https://counterweightsupport.com/subscribe-to-counterweight/\">https://counterweightsupport.com/subscribe-to-counterweight/</a>) today to become part of the Counterweight movement.\"\"\n\nInside Higher Ed, \"Blowback Against a Hoax.\" <a href=\"https://www.insidehighered.com/news/2019/01/08/author-recent-academic-hoax-faces-disciplinary-action-portland-state\"> https://www.insidehighered.com/news/2019/01/08/author-recent-academic-hoax-faces-disciplinary-action-portland-state</a>\n\nPeter Boghossian Resignation Latter from PSU. <a href=\"https://bariweiss.substack.com/p/my-university-sacrificed-ideas-for\"> https://bariweiss.substack.com/p/my-university-sacrificed-ideas-for</a>\n\n\n\n"; |
| 462 |
let markup = html2pango_markup(description); |
| 463 |
|
| 464 |
assert_eq!(expected, markup); |
| 465 |
} |
| 466 |
|
| 467 |
#[test] |
| 468 |
fn test_newline_based() { |
| 469 |
let description = "Also available in video form at https://youtu.be/NUPWY_evu30\n\ |
| 470 |
\n\ |
| 471 |
In a recent view by Contrapoints, she goes over her account of envy and its connection with online politics. In doing so she utilizes Nietzsche (alongside a critique of Nietzsche). How accurate is this account to Nietzsche\'s work and where does it go wrong? \n\ |
| 472 |
\n\ |
| 473 |
Thank you to We\'re in Hell, BadEmpanada, and Chelsea Manning for the voice lines! \n\ |
| 474 |
\n\ |
| 475 |
Edited by Lexi Fontaine: https://twitter.com/softgothoutlaw \n\ |
| 476 |
\n\ |
| 477 |
Music by Alex Ballantyne: https://transistorriot.bandcamp.com \n\ |
| 478 |
\n\ |
| 479 |
This was an early release to my patrons at https://pateron.com/livagar \n\ |
| 480 |
\n\ |
| 481 |
Watch me stream on twitch at https://twitch.tv/livagar \n\ |
| 482 |
\n\ |
| 483 |
All of my links at https:// livagar.com"; |
| 484 |
|
| 485 |
let expected = "Also available in video form at <a href=\"https://youtu.be/NUPWY_evu30\">https://youtu.be/NUPWY_evu30</a>\n\ |
| 486 |
\n\ |
| 487 |
In a recent view by Contrapoints, she goes over her account of envy and its connection with online politics. In doing so she utilizes Nietzsche (alongside a critique of Nietzsche). How accurate is this account to Nietzsche's work and where does it go wrong? \n\ |
| 488 |
\n\ |
| 489 |
Thank you to We're in Hell, BadEmpanada, and Chelsea Manning for the voice lines! \n\ |
| 490 |
\n\ |
| 491 |
Edited by Lexi Fontaine: <a href=\"https://twitter.com/softgothoutlaw\">https://twitter.com/softgothoutlaw</a> \n\ |
| 492 |
\n\ |
| 493 |
Music by Alex Ballantyne: <a href=\"https://transistorriot.bandcamp.com\">https://transistorriot.bandcamp.com</a> \n\ |
| 494 |
\n\ |
| 495 |
This was an early release to my patrons at <a href=\"https://pateron.com/livagar\">https://pateron.com/livagar</a> \n\ |
| 496 |
\n\ |
| 497 |
Watch me stream on twitch at <a href=\"https://twitch.tv/livagar\">https://twitch.tv/livagar</a> \n\ |
| 498 |
\n\ |
| 499 |
All of my links at https:// <a href=\"https:livagar.com\">livagar.com</a>"; |
| 500 |
let markup = html2pango_markup(description); |
| 501 |
|
| 502 |
assert_eq!(expected, markup); |
| 503 |
} |
| 504 |
|
| 505 |
#[test] |
| 506 |
fn test_newline_based2() { |
| 507 |
let description = "We’re back to a normal-style ep after a week of interviews. We’re taking a look at the fast-tracked aid package to intelligence agents suffering unreality issues, the Biden administration addressing just the optics at the border, and AOC addressing just the optics of the Iron Dome bill. Finally, we having a reading series that functions as a bit of a coda to Will and Matt’s visit to Ozy Fest way back in 2018.\n\nOne last time, go subscribe to https://www.youtube.com/chapotraphouse\n\nAnd go grab some of Simon Roy’s great posters over at https://shop.chapotraphouse.com/\nMore merch coming soon!"; |
| 508 |
let expected = "We’re back to a normal-style ep after a week of interviews. We’re taking a look at the fast-tracked aid package to intelligence agents suffering unreality issues, the Biden administration addressing just the optics at the border, and AOC addressing just the optics of the Iron Dome bill. Finally, we having a reading series that functions as a bit of a coda to Will and Matt’s visit to Ozy Fest way back in 2018.\n\nOne last time, go subscribe to <a href=\"https://www.youtube.com/chapotraphouse\">https://www.youtube.com/chapotraphouse</a>\n\nAnd go grab some of Simon Roy’s great posters over at <a href=\"https://shop.chapotraphouse.com/\">https://shop.chapotraphouse.com/</a>\nMore merch coming soon!"; |
| 509 |
let markup = html2pango_markup(description); |
| 510 |
|
| 511 |
assert_eq!(expected, markup); |
| 512 |
} |
| 513 |
|
| 514 |
#[test] |
| 515 |
fn test_list_ordered() { |
| 516 |
let description = "<ol><li>first</li><li>second</li><li>third</li></ol>"; |
| 517 |
let expected = "\n 1. first\n 2. second\n 3. third\n\n"; |
| 518 |
let markup = html2pango_markup(description); |
| 519 |
|
| 520 |
assert_eq!(expected, markup); |
| 521 |
} |
| 522 |
|
| 523 |
#[test] |
| 524 |
fn test_list_unordered() { |
| 525 |
let description = "<ul><li>first</li><li>second</li><li>third</li></ul>"; |
| 526 |
let expected = "\n • first\n • second\n • third\n\n"; |
| 527 |
let markup = html2pango_markup(description); |
| 528 |
|
| 529 |
assert_eq!(expected, markup); |
| 530 |
} |
| 531 |
|
| 532 |
#[test] |
| 533 |
fn test_list_ordered_nested() { |
| 534 |
let description = "<ol><li>first</li><li>second<ol><li> sub list first</li><li> sub list second</li></li></ol><li>third</li></ol>"; |
| 535 |
let expected = "\n 1. first\n 2. second\n 1. sub list first\n 2. sub list second\n\n\n 3. third\n\n"; |
| 536 |
let markup = html2pango_markup(description); |
| 537 |
|
| 538 |
assert_eq!(expected, markup); |
| 539 |
} |
| 540 |
|
| 541 |
#[test] |
| 542 |
fn test_timecode() { |
| 543 |
let description = "<ul>\ |
| 544 |
<li>Twitter: <a href=\"https://twitter.com/rustaceanfm\">@rustaceanfm</a></li>\ |
| 545 |
<li>Discord: <a href=\"https://discord.gg/cHc3Gyc\">Rustacean Station</a></li>\ |
| 546 |
<li>Github: <a href=\"https://github.com/rustacean-station/\">@rustacean-station</a></li>\ |
| 547 |
<li>Email: <a href=\"mailto:[email protected]\">[email protected]</a></li>\ |
| 548 |
</ul>\ |
| 549 |
\ |
| 550 |
<h2 id=\"timestamps\">Timestamps</h2>\ |
| 551 |
<ul>\ |
| 552 |
<li>[@0:33] - Daniel’s introduction</li>\ |
| 553 |
<li>[@3:38] - Tauri’s focus on safety and security</li>\ |
| 554 |
<li>[@6:50] - Tauri’s mission to reduce their footprint</li>\ |
| 555 |
<li>[@14:48] - How does Tauri handles features that are not supported across different platforms</li>\ |
| 556 |
<li>[@23:56] - How does Tauri monetize to keep the project going?</li>\ |
| 557 |
<li>[@26:16] - Why choose Tauri over other solutions?</li>\ |
| 558 |
<li>[@28:57] - What are the tools being built with Tauri?</li>\ |
| 559 |
<li>[@31:09] - Tyler’s programming background</li>\ |
| 560 |
<li>[@35:11] - Tauri’s future release and features</li>\ |
| 561 |
<li>[@38:38] - ‘Tauri Foundations’ book by Daniel Thompson-Yvetot and Lucas Nogueira</li>\ |
| 562 |
<li>[@40:00] - Requirement on building a Tauri app</li>\ |
| 563 |
<li>[@43:13] - Parting thoughts</li>\ |
| 564 |
</ul>"; |
| 565 |
let expected = "\n\ |
| 566 |
\x20 • Twitter: <a href=\"https://twitter.com/rustaceanfm\">@rustaceanfm</a>\n\ |
| 567 |
\x20 • Discord: <a href=\"https://discord.gg/cHc3Gyc\">Rustacean Station</a>\n\ |
| 568 |
\x20 • Github: <a href=\"https://github.com/rustacean-station/\">@rustacean-station</a>\n\ |
| 569 |
\x20 • Email: <a href=\"mailto:[email protected]rg\">[email protected]</a>\n\ |
| 570 |
\n\ |
| 571 |
Timestamps\n\ |
| 572 |
\x20 • [@<a href=\"jump:33\" title=\"Jump to 00:33\">0:33</a>] - Daniel’s introduction\n\ |
| 573 |
\x20 • [@<a href=\"jump:218\" title=\"Jump to 03:38\">3:38</a>] - Tauri’s focus on safety and security\n\ |
| 574 |
\x20 • [@<a href=\"jump:410\" title=\"Jump to 06:50\">6:50</a>] - Tauri’s mission to reduce their footprint\n\ |
| 575 |
\x20 • [@<a href=\"jump:888\" title=\"Jump to 14:48\">14:48</a>] - How does Tauri handles features that are not supported across different platforms\n\ |
| 576 |
\x20 • [@<a href=\"jump:1436\" title=\"Jump to 23:56\">23:56</a>] - How does Tauri monetize to keep the project going?\n\ |
| 577 |
\x20 • [@<a href=\"jump:1576\" title=\"Jump to 26:16\">26:16</a>] - Why choose Tauri over other solutions?\n\ |
| 578 |
\x20 • [@<a href=\"jump:1737\" title=\"Jump to 28:57\">28:57</a>] - What are the tools being built with Tauri?\n\ |
| 579 |
\x20 • [@<a href=\"jump:1869\" title=\"Jump to 31:09\">31:09</a>] - Tyler’s programming background\n\ |
| 580 |
\x20 • [@<a href=\"jump:2111\" title=\"Jump to 35:11\">35:11</a>] - Tauri’s future release and features\n\ |
| 581 |
\x20 • [@<a href=\"jump:2318\" title=\"Jump to 38:38\">38:38</a>] - ‘Tauri Foundations’ book by Daniel Thompson-Yvetot and Lucas Nogueira\n\ |
| 582 |
\x20 • [@<a href=\"jump:2400\" title=\"Jump to 40:00\">40:00</a>] - Requirement on building a Tauri app\n\ |
| 583 |
\x20 • [@<a href=\"jump:2593\" title=\"Jump to 43:13\">43:13</a>] - Parting thoughts\n\ |
| 584 |
\n\ |
| 585 |
"; |
| 586 |
let markup = html2pango_markup(description); |
| 587 |
assert_eq!(expected, markup); |
| 588 |
} |
| 589 |
|
| 590 |
#[test] |
| 591 |
fn test_escape_lt_gt_and_img() { |
| 592 |
let description = "<p>\ |
| 593 |
<a href=\"http://faif.us/cast-media/FaiF_FOSSY-2023.ogg\"><img alt=\"[Direct download of cast in Ogg/Vorbis\n\ |
| 594 |
format]\" src=\"http://faif.us/img/cast/audio_ogg_button.png\"></a>\n\ |
| 595 |
<a href=\"http://faif.us/cast-media/FaiF_FOSSY-2023.mp3\"><img alt=\"[Direct download of cast in MP3 format]\" src=\"http://faif.us/img/cast/audio_mp3_button.png\"></a>\n\ |
| 596 |
</p>\n\ |
| 597 |
<p>\n\ |
| 598 |
Come to <a href=\"https://2023.fossy.us/\">FOSSY 2023</a>!\n\ |
| 599 |
</p>\n\ |
| 600 |
<h3>Show Notes:</h3>\n\ |
| 601 |
\n\ |
| 602 |
<a href=\"https://2023.fossy.us/\">FOSSY 2023</a> will happen next week in Portland, OR, USA.\n\ |
| 603 |
\n\ |
| 604 |
<hr width=\"80%\">\n\ |
| 605 |
\n\ |
| 606 |
<p>Send feedback and comments on the cast\n\ |
| 607 |
to <a href=\"mailto:[email protected]\"><[email protected]></a>.\n\ |
| 608 |
You can keep in touch with <a href=\"http://faif.us\">Free as in Freedom</a>\n\ |
| 609 |
by <a href=\"https://twitter.com/conservancy\">following Conservancy on\n\ |
| 610 |
on Twitter</a> and <a href=\"https://twitter.com/faifcast\">and FaiF on Twitter</a>. We are working on setting up a group chat again, too!</p>\n\ |
| 611 |
\n\ |
| 612 |
<p>Free as in Freedom is produced by <a href=\"http://danlynch.org/blog/\">Dan Lynch</a>\n\ |
| 613 |
of <a href=\"http://danlynch.org/\">danlynch.org</a>.\n\ |
| 614 |
Theme\n\ |
| 615 |
music written and performed\n\ |
| 616 |
by <a href=\"http://www.miketarantino.com\">Mike Tarantino</a>\n\ |
| 617 |
with <a href=\"http://www.charliepaxson.com\">Charlie Paxson</a> on drums.</p>\n\ |
| 618 |
\n\ |
| 619 |
<p><a href=\"https://creativecommons.org/licenses/by-sa/4.0/\"><img alt=\"Creative Commons License\" src=\"http://i.creativecommons.org/l/by-sa/4.0/88x31.png\"></a>\n\ |
| 620 |
The content\n\ |
| 621 |
of <span>this\n\ |
| 622 |
audcast</span>, and the accompanying show notes and music are licensed\n\ |
| 623 |
under the <a href=\"https://creativecommons.org/licenses/by-sa/4.0/\">Creative\n\ |
| 624 |
Commons Attribution-Share-Alike 4.0 license (CC BY-SA 4.0)</a>.\n\ |
| 625 |
</p>"; |
| 626 |
let expected = "<a href=\"http://faif.us/cast-media/FaiF_FOSSY-2023.ogg\">[[Direct download of cast in Ogg/Vorbis format]]\n\ |
| 627 |
</a><a href=\"http://faif.us/cast-media/FaiF_FOSSY-2023.mp3\">[[Direct download of cast in MP3 format]]\n\ |
| 628 |
</a>\n\ |
| 629 |
\n\ |
| 630 |
Come to <a href=\"https://2023.fossy.us/\">FOSSY 2023</a>! \n\ |
| 631 |
\n\ |
| 632 |
Show Notes: <a href=\"https://2023.fossy.us/\">FOSSY 2023</a> will happen next week in Portland, OR, USA. Send feedback and comments on the cast to <a href=\"mailto:[email protected]\"><[email protected]></a>. You can keep in touch with <a href=\"http://faif.us\">Free as in Freedom</a> by <a href=\"https://twitter.com/conservancy\">following Conservancy on on Twitter</a> and <a href=\"https://twitter.com/faifcast\">and FaiF on Twitter</a>. We are working on setting up a group chat again, too!\n\ |
| 633 |
\n\ |
| 634 |
Free as in Freedom is produced by <a href=\"http://danlynch.org/blog/\">Dan Lynch</a> of <a href=\"http://danlynch.org/\">danlynch.org</a>. Theme music written and performed by <a href=\"http://www.miketarantino.com\">Mike Tarantino</a> with <a href=\"http://www.charliepaxson.com\">Charlie Paxson</a> on drums.\n\ |
| 635 |
\n\ |
| 636 |
<a href=\"https://creativecommons.org/licenses/by-sa/4.0/\">[Creative Commons License]\n\ |
| 637 |
</a>The content of this audcast, and the accompanying show notes and music are licensed under the <a href=\"https://creativecommons.org/licenses/by-sa/4.0/\">Creative Commons Attribution-Share-Alike 4.0 license (CC BY-SA 4.0)</a>. \n\n"; |
| 638 |
|
| 639 |
let markup = html2pango_markup(description); |
| 640 |
assert_eq!(expected, markup); |
| 641 |
} |
| 642 |
|
| 643 |
#[test] |
| 644 |
fn test_hash_invalid_link() { |
| 645 |
let description = r#"<p><a href=" #whatever">🤷</a></p>"#; |
| 646 |
let expected = "🤷\n\n"; |
| 647 |
let markup = html2pango_markup(description); |
| 648 |
|
| 649 |
assert_eq!(expected, markup); |
| 650 |
} |
| 651 |
|
| 652 |
#[test] |
| 653 |
fn test_empty_link() { |
| 654 |
let description = r#"<p><a href="">🤷</a></p>"#; |
| 655 |
let expected = "🤷\n\n"; |
| 656 |
let markup = html2pango_markup(description); |
| 657 |
|
| 658 |
assert_eq!(expected, markup); |
| 659 |
} |
| 660 |
|
| 661 |
#[test] |
| 662 |
fn test_hash_timestamp_link() { |
| 663 |
let description = r##"<p><a href="#t=13:12">13:12</a></p>"##; |
| 664 |
let expected = "<a href=\"jump:792\" title=\"Jump to 13:12\">13:12</a>\n\n"; |
| 665 |
let markup = html2pango_markup(description); |
| 666 |
|
| 667 |
assert_eq!(expected, markup); |
| 668 |
} |
| 669 |
|
| 670 |
#[test] |
| 671 |
fn test_do_not_double_escape_sequences() { |
| 672 |
let description = r##"Will & Felix catch up on Democrats’ commitment to burning millions of dollars in search of a crumb of clout from the pod-mano-sphere, and John Fetterman’s chronic senate absenteeism as he searches for good vibes. Then, we’re joined by Lever News’ David Sirota & Arjun Singh to discuss their new podcast series Tax Revolt & the “Big Beautiful Bill” working its way through congress. We look at the devastating consequences of GOP tax policies, the increasing unpopularity of such drastic cuts, and how they fit in with the 50 year conservative war against taxes. |
| 673 |
|
| 674 |
Find all things Lever News at: https://www.levernews.com/ |
| 675 |
|
| 676 |
And listen to Tax Revolt here or wherever you get pods: https://the.levernews.com/tax-revolt/"##; |
| 677 |
let expected = "Will & Felix catch up on Democrats’ commitment to burning millions of dollars in search of a crumb of clout from the pod-mano-sphere, and John Fetterman’s chronic senate absenteeism as he searches for good vibes. Then, we’re joined by Lever News’ David Sirota & Arjun Singh to discuss their new podcast series Tax Revolt & the “Big Beautiful Bill” working its way through congress. We look at the devastating consequences of GOP tax policies, the increasing unpopularity of such drastic cuts, and how they fit in with the 50 year conservative war against taxes.\n\nFind all things Lever News at: <a href=\"https://www.levernews.com/\">https://www.levernews.com/</a>\n\nAnd listen to Tax Revolt here or wherever you get pods: <a href=\"https://the.levernews.com/tax-revolt/\">https://the.levernews.com/tax-revolt/</a>"; |
| 678 |
let markup = html2pango_markup(description); |
| 679 |
|
| 680 |
assert_eq!(expected, markup); |
| 681 |
} |
| 682 |
} |