#43: Fix handling of italic comments after path

This commit is contained in:
mtkennerly 2024-05-28 21:10:07 -04:00
parent 01a2a4fd95
commit 6b5a70e9cf
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
2 changed files with 24 additions and 9 deletions

View file

@ -231194,12 +231194,12 @@ FlightGear Flight Simulator:
- config
when:
- os: mac
"<winAppData>/flightgear.org/ (Versions before FlightGear 3.0)":
"<winAppData>/flightgear.org":
tags:
- config
when:
- os: windows
"<winDocuments>/FlightGear (FlightGear 3.0 to FlightGear 2018.3)":
"<winDocuments>/FlightGear":
tags:
- config
when:
@ -376726,12 +376726,12 @@ McPixel:
id: 220860
McPixel 3:
files:
"<base>/progress.json (itch.io Windows 95 and Windows NT versions)":
"<base>/progress.json":
tags:
- config
when:
- os: windows
"<base>/settings.json (itch.io Windows 95 and Windows NT versions)":
"<base>/settings.json":
tags:
- save
when:
@ -387174,13 +387174,13 @@ Minecraft Legends:
when:
- os: windows
store: microsoft
"<winLocalAppData>/Packages/Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe/LocalState/games/com.mojang/minecraftWorlds/ (Preview)":
"<winLocalAppData>/Packages/Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe/LocalState/games/com.mojang/minecraftWorlds":
tags:
- save
when:
- os: windows
store: microsoft
"<winLocalAppData>/Packages/Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe/LocalState/games/com.mojang/minecraftpe/options.txt (Preview)":
"<winLocalAppData>/Packages/Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe/LocalState/games/com.mojang/minecraftpe/options.txt":
tags:
- config
when:
@ -641806,7 +641806,7 @@ The Sims 2:
- save
when:
- os: mac
"<home>/Library/Containers/com.aspyr.sims2.appstore/Data/Library/Application Support/Aspyr/The Sims 2 (Mac App Store version)":
"<home>/Library/Containers/com.aspyr.sims2.appstore/Data/Library/Application Support/Aspyr/The Sims 2":
tags:
- save
when:

View file

@ -746,11 +746,26 @@ pub struct MappedPath {
pub fn flatten_path(attribute: &Attribute) -> WikiPath {
let mut out = WikiPath::default();
let mut maybe_irregular_text = false;
for piece in &attribute.value.pieces {
match piece {
TextPiece::Text { text, .. } => {
out.incorporate_text(text);
TextPiece::Text { text, formatting } => {
match formatting {
wikitext_parser::TextFormatting::Normal => {
if maybe_irregular_text && !text.trim().is_empty() {
out.regularity = Regularity::Irregular;
}
out.incorporate_text(text);
}
wikitext_parser::TextFormatting::Italic
| wikitext_parser::TextFormatting::Bold
| wikitext_parser::TextFormatting::ItalicBold => {
// Italic or bold notes can appear after the path,
// but if we see any more text afterward, then there's a problem.
maybe_irregular_text = true;
}
}
}
TextPiece::DoubleBraceExpression { tag, attributes } => match tag.to_string().to_lowercase().trim() {
"p" | "path" => {