ptx: contexts stop at line ends without -S, and -S drops the sentence end
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
Direzione di ricerca
Start in src/uu/ptx/src/ptx.rs, especially read_lines around line 327 and the -S handling around line 323. Compare default and -S output with the two examples in the issue, then check the ptx tests for coverage. Done means default mode joins contexts across lines as GNU ptx does, while -S preserves the matched sentence end and does not mark the final sentence as truncated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Without -S, GNU ptx (in its default GNU mode) builds contexts from sentences, not lines: a sentence ends at ., ? or ! (optionally followed by closing quotes or brackets) that is followed by an end of line, a tab or two spaces, and lines in between are joined. uutils ptx uses each line on its own:
$ printf 'one two\nthree four\n' > f
$ ptx f
three four
one two
three four
one two
$ gnuptx f # GNU coreutils 9.12
one two three four
one two three four
one two three four
one two three four
-G output matches, as there a line is the unit for both.
Passing a sentence regexp with -S gets closer, but two more differences show up there: the matched sentence end is dropped from the context, and the last sentence ends with a truncation flag because the final newline becomes a trailing space:
$ printf 'Hello world. Foo bar\n' > g
$ ptx -S '\. ' g
Foo bar/
Hello world
Foo bar/
Hello world
$ gnuptx -S '\. ' g
Foo bar
Hello world.
Foo bar
Hello world.
The line split is buffer.lines() in read_lines (src/uu/ptx/src/ptx.rs:327); with -S, re.split(&buffer) throws away the matched text and s.replace('\n', " ") (ptx.rs:323) turns the final newline into the trailing space.
uutils coreutils main 91d4f6ada, GNU coreutils 9.12.
- Lingua principale
- Rust
- Stelle
- 24.3k
- Fork
- 2.1k
- Merge medio
- 1g 20h
- PR unite (30g)
- 380
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di uutils/coreutils
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
fold: tab after an 8 KiB buffer flush exceeds the requested widthForse già presa @gibkim l’ha presa 1 giorno fa. ApertaU - fold
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
ls: `--block-size=0` is accepted when `--si` comes laterForse già presa @Logic769 l’ha presa 3 giorni fa. Apertagood first issue U - ls
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
uutils/coreutils#15962 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
B - high priority U - tr
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di uutils/coreutils
Issue simili
-
example
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
rust-lang-nursery/rust-cookbook#954 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 70/100
OpenZeppelin/openzeppelin-relayer#967 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
DecisionOutcome::label() / n_dosed(): engine-side mapping so downstream needs no wildcard armAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
src/runs.rs:1987: a missing --source-run-id now answers 400 "Source run ... does not exist", not 404Apertanightly-audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
antithesishq/snouty#602 ·
I maintainer di solito rispondono entro 1 giorno