diff --git a/manual/src/introduction.md b/manual/src/introduction.md index 96b421be9..7e2c40e3e 100644 --- a/manual/src/introduction.md +++ b/manual/src/introduction.md @@ -31,8 +31,8 @@ let ts_lang = language_override
$ difft old.rs new.rs
-1 1 let ts_lang = language_override
-. 2 .or_else(|| guess(path, guess_src))
+1 1 let ts_lang = language_override
+. 2 .or_else(|| guess(path, guess_src))
. 3 .map(tsp::from_language);
@@ -45,8 +45,8 @@ A line-oriented diff does a much worse job here.
$ diff -u old.rs new.rs @@ -1 +1,3 @@ --let ts_lang = guess(path, guess_src).map(tsp::from_language); -+let ts_lang = language_override +-let ts_lang = guess(path, guess_src).map(tsp::from_language); ++let ts_lang = language_override + .or_else(|| guess(path, guess_src)) + .map(tsp::from_language);diff --git a/manual/src/tricky_cases.md b/manual/src/tricky_cases.md index db629a8ed..521bf86b5 100644 --- a/manual/src/tricky_cases.md +++ b/manual/src/tricky_cases.md @@ -15,7 +15,7 @@ x (x) ``` -Desired result:(x)+Desired result:(x)This is tricky because `x` has changed its depth in the tree, but `x` itself is unchanged. @@ -48,7 +48,7 @@ than the `x`. (x y) ``` -Desired output:(x y)+Desired output:(x y)In this case, we want to highlight `y`. Highlighting the delimiters could make `x` look changed. @@ -75,10 +75,10 @@ This should be highlighted similar to the expanding delimiter case. (foo (novel) (bar)) ``` -Desired result:(foo (novel) (bar)+Desired result:(foo (novel) (bar)It is easy to end up with -(foo (novel) (bar)), +(foo (novel) (bar)), where a later pair of delimiters are chosen. ## Rewrapping Large Nodes @@ -109,7 +109,7 @@ minimal diff. (y x) ``` -Desired result:(y x)+Desired result:(y x)We want to highlight the list contents and not the delimiters. @@ -123,7 +123,7 @@ foo(bar(123)) foo(extra(bar(123))) ``` -Desired result:foo(extra(bar(123)))+Desired result:foo(extra(bar(123)))We want to consider both `foo` and `bar` to be unchanged. This case is challenging for diffing algorithms that do a bottom-up then top-down @@ -175,8 +175,8 @@ old1(old2) old1(new1(old2)) ``` -Should this beold1(new1(old2))or -old1(new1(old2))? +Should this beold1(new1(old2))or +old1(new1(old2))? The correct answer depends on the language. Most languages want to prefer the inner delimiter, whereas Lisps and JSON prefer the outer diff --git a/translation/zh-CN/manual-zh-CN/src/introduction.md b/translation/zh-CN/manual-zh-CN/src/introduction.md index e67840f99..87247194d 100644 --- a/translation/zh-CN/manual-zh-CN/src/introduction.md +++ b/translation/zh-CN/manual-zh-CN/src/introduction.md @@ -25,8 +25,8 @@ let ts_lang = language_override@@ -38,8 +38,8 @@ let ts_lang = language_override$ difft old.rs new.rs -1 1 let ts_lang = language_override -. 2 .or_else(|| guess(path, guess_src)) +1 1 let ts_lang = language_override +. 2 .or_else(|| guess(path, guess_src)) . 3 .map(tsp::from_language);$ diff -u old.rs new.rs @@ -1 +1,3 @@ --let ts_lang = guess(path, guess_src).map(tsp::from_language); -+let ts_lang = language_override +-let ts_lang = guess(path, guess_src).map(tsp::from_language); ++let ts_lang = language_override + .or_else(|| guess(path, guess_src)) + .map(tsp::from_language);diff --git a/translation/zh-CN/manual-zh-CN/src/tricky_cases.md b/translation/zh-CN/manual-zh-CN/src/tricky_cases.md index 25dacc33b..71c769f83 100644 --- a/translation/zh-CN/manual-zh-CN/src/tricky_cases.md +++ b/translation/zh-CN/manual-zh-CN/src/tricky_cases.md @@ -14,7 +14,7 @@ x (x) ``` -理想输出:(x)+理想输出:(x)这个是十分棘手,因为`x`已经改变了它在树中的深度,但`x`本身却未发生改变。 @@ -42,7 +42,7 @@ x (x y) ``` -理想输出:(x y)+理想输出:(x y)在这个例子下,我们想要去高亮`y`。高亮显示定界符的话可能会让`x`看起来有所变化。 @@ -68,9 +68,9 @@ x (foo (novel) (bar)) ``` -理想输出:(foo (novel) (bar)+理想输出:(foo (novel) (bar)-很容易会变成:(foo (novel) (bar)), +很容易会变成:(foo (novel) (bar)), 其中后一组的定界符会被选中。 ## 重新组织大节点 @@ -97,7 +97,7 @@ x (y x) ``` -理想输出:(y x)+理想输出:(y x)我们想突出显示列表的内容,而不是定界符。 @@ -111,7 +111,7 @@ foo(bar(123)) foo(extra(bar(123))) ``` -理想输出:foo(extra(bar(123)))+理想输出:foo(extra(bar(123)))我们想把`foo`和`bar`都看作是不变的。这种情况对于对树进行自下而上然后自上而下匹配的衍合算法来说是具有挑战性的。 @@ -155,8 +155,8 @@ old1(old2) old1(new1(old2)) ``` -这个应该是old1(new1(old2))还是 -old1(new1(old2))? +这个应该是old1(new1(old2))还是 +old1(new1(old2))? 正确的答案是取决于语言。大多数语言希望优先使用内部分隔符,而Lisps和JSON则喜欢使用外部分隔符。