#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 - config
when: when:
- os: mac - os: mac
"<winAppData>/flightgear.org/ (Versions before FlightGear 3.0)": "<winAppData>/flightgear.org":
tags: tags:
- config - config
when: when:
- os: windows - os: windows
"<winDocuments>/FlightGear (FlightGear 3.0 to FlightGear 2018.3)": "<winDocuments>/FlightGear":
tags: tags:
- config - config
when: when:
@ -376726,12 +376726,12 @@ McPixel:
id: 220860 id: 220860
McPixel 3: McPixel 3:
files: files:
"<base>/progress.json (itch.io Windows 95 and Windows NT versions)": "<base>/progress.json":
tags: tags:
- config - config
when: when:
- os: windows - os: windows
"<base>/settings.json (itch.io Windows 95 and Windows NT versions)": "<base>/settings.json":
tags: tags:
- save - save
when: when:
@ -387174,13 +387174,13 @@ Minecraft Legends:
when: when:
- os: windows - os: windows
store: microsoft store: microsoft
"<winLocalAppData>/Packages/Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe/LocalState/games/com.mojang/minecraftWorlds/ (Preview)": "<winLocalAppData>/Packages/Microsoft.MinecraftWindowsBeta_8wekyb3d8bbwe/LocalState/games/com.mojang/minecraftWorlds":
tags: tags:
- save - save
when: when:
- os: windows - os: windows
store: microsoft 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: tags:
- config - config
when: when:
@ -641806,7 +641806,7 @@ The Sims 2:
- save - save
when: when:
- os: mac - 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: tags:
- save - save
when: when:

View file

@ -746,12 +746,27 @@ pub struct MappedPath {
pub fn flatten_path(attribute: &Attribute) -> WikiPath { pub fn flatten_path(attribute: &Attribute) -> WikiPath {
let mut out = WikiPath::default(); let mut out = WikiPath::default();
let mut maybe_irregular_text = false;
for piece in &attribute.value.pieces { for piece in &attribute.value.pieces {
match piece { match piece {
TextPiece::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); 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() { TextPiece::DoubleBraceExpression { tag, attributes } => match tag.to_string().to_lowercase().trim() {
"p" | "path" => { "p" | "path" => {
for attribute in attributes { for attribute in attributes {