Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the concept of a line for text sort #301

Closed
xml-project opened this issue Dec 19, 2019 · 6 comments · Fixed by #309
Closed

Clarify the concept of a line for text sort #301

xml-project opened this issue Dec 19, 2019 · 6 comments · Fixed by #309
Assignees

Comments

@xml-project
Copy link
Contributor

@xml-project xml-project commented Dec 19, 2019

In a discussion in the test suite repo @ndw discovered that the concept of a line for p:text-sort needs clarification:

<p:text-sort>
  <p:with-input>
    <p:inline content-type="text/plain">C
D
B
A
</p:inline>
</p:with-input>
</p:text-sort>

The problem raises from the "new-line" after "A". If lines are separated by "line-line" this text has 5 lines (the last is empty) and the correct result is:
empty line, A B C D

If lines are terminated by "new-line" we have 4 lines and the correct result is "A B C D".
But then, what to do about:

<p:inline content-type="text/plain">C
D
B
A</p:inline>
@xatapult

This comment has been minimized.

Copy link
Contributor

@xatapult xatapult commented Dec 19, 2019

The usual thing that happens in theses cases (in editors and in programs that interpret text files) is to consider the last line-ending optional. So if there's no LF after the last line (as in your second example) it is silently assumed to be there.

This means that both examples above yield the same result.

@xatapult

This comment has been minimized.

Copy link
Contributor

@xatapult xatapult commented Dec 19, 2019

Stated in a rule: Lines are terminated with a line-end (usually LF). For the last line this is optional.

@xml-project

This comment has been minimized.

Copy link
Contributor Author

@xml-project xml-project commented Dec 19, 2019

@xatapult 👍 This is (I think) what Norm and I would like to have. Let's state this in the specs.

@ndw

This comment has been minimized.

Copy link
Collaborator

@ndw ndw commented Dec 19, 2019

I'm fine with making the final trailing newline optional on input. Do we want to say whether the output is required to, required not to, or may optionally have a trailing newline?

@xml-project

This comment has been minimized.

Copy link
Contributor Author

@xml-project xml-project commented Dec 19, 2019

Yes, we should do this because I would expect, that a p:text-count before and after a p:text-sort return the same value. Shouldn't it?

@ndw

This comment has been minimized.

Copy link
Collaborator

@ndw ndw commented Dec 19, 2019

Trailing newline is optional, but all text steps must behave consistently. On output, the trailing newline should be output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.