Internet Architecture Board (IAB) K. Watsen Internet-Draft Juniper Networks Intended status: Best Current Practice June 6, 2018 Expires: December 8, 2018 Handling Long Lines in Artwork in Drafts draft-kwatsen-netmod-artwork-folding-01 Abstract This document introduces a simple and yet time-proven strategy for handling long lines in artwork in drafts using a backslash ('\') character where line-folding has occurred. The strategy works on any text based artwork, producing consistent results regardless the artwork content. Using a per-artwork notice, the strategy is both self-documenting and enables automated reconstitution of the original artwork. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on December 8, 2018. Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of Watsen Expires December 8, 2018 [Page 1] Internet-Draft Handling Long Lines in Artwork in Drafts June 2018 the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 2 3. Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1. Automated folding of long lines in artwork . . . . . . . 3 3.2. Automated reconstitution of original artwork . . . . . . 3 4. Limitations . . . . . . . . . . . . . . . . . . . . . . . . . 3 4.1. Doesn't work well on graphical artwork . . . . . . . . . 3 4.2. Doesn't work as well as format-specific options . . . . . 4 5. Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5.1. Folding . . . . . . . . . . . . . . . . . . . . . . . . . 4 5.2. Unfolding . . . . . . . . . . . . . . . . . . . . . . . . 5 6. Security Considerations . . . . . . . . . . . . . . . . . . . 6 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 6 8.1. Normative References . . . . . . . . . . . . . . . . . . 6 8.2. Informative References . . . . . . . . . . . . . . . . . 6 Appendix A. POSIX Shell Script . . . . . . . . . . . . . . . . . 7 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 11 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 11 1. Introduction Internet drafts many times contain artwork that exceed the 72 character limit specified by RFC 7994 [RFC7994]. The "xml2rfc" utility, in an effort to maintain clean formatting, issues a warning whenever artwork lines exceed 69 characters. According to RFC Editor, there is currently no convention in place for how to handle long lines, other than clearly indicating that some manipulation has occurred. This document introduces a simple and yet time-proven strategy for handling long lines using a backslash ('\') character where line- folding has occurred. The strategy works on any text based artwork, producing consistent results regardless the artwork content. Using a per-artwork notice, the strategy is both self-documenting and enables automated reconstitution of the original artwork. 2. Requirements Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP Watsen Expires December 8, 2018 [Page 2] Internet-Draft Handling Long Lines in Artwork in Drafts June 2018 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. 3. Goals 3.1. Automated folding of long lines in artwork Automated folding of long lines is needed in order to support draft compilations that entail a) validation of source input files (e.g., YANG, XML, JSON, ABNF, ASN.1) and/or b) dynamic generation of output (e.g., tree diagrams) that are stitched into the final draft to be submitted. Generally, in order for tooling to be able to process input files, the files must be in their original/natural state, which may include having some long lines. Thus, these source files need to be modified before inclusion in the draft in order to satisfy the line length limits. This modification SHOULD be automated to reduce effort and errors resulting from manual effort. Similarly, dynamically generated output (e.g., tree diagrams) must also be modified, if necessary, in order for the resulting I-D to satisfy the line length limits. When needed, this effort again SHOULD be automated to reduce effort and errors resulting from manual effort. 3.2. Automated reconstitution of original artwork Automated reconstitution of the original artwork is needed to support validation of artwork extracted from drafts. Already YANG modules are extracted from drafts and validated as part of the draft- submission process. Additionally, there has been some discussion regarding needing to do the same for examples contained within drafts ([yang-doctors-list]). Thus, it SHOULD be possible to mechanically reconstitute artwork in order to satisfy the tooling input parsers. 4. Limitations 4.1. Doesn't work well on graphical artwork While the solution presented in this document will work on any kind of text-based artwork, it is most useful on artwork that represents sourcecode (e.g., YANG, XML, JSON, etc.) or, more generally, on artwork that has not been laid out in two dimensions (e.g., diagrams). The issue regards the readability of the folded artwork in the draft. Artwork that is unpredictable is especially susceptible is looking Watsen Expires December 8, 2018 [Page 3] Internet-Draft Handling Long Lines in Artwork in Drafts June 2018 bad when folded; falling into this category are most UML diagrams. Artwork that is somewhat structured (e.g., YANG tree diagrams [RFC8340]) fair better when folded, as the eyes seem to be able to still see the vertical lines, even when they are interrupted. It is thus NOT RECOMMENDED to use the solution presented in this document on graphical artwork. 4.2. Doesn't work as well as format-specific options The solution presented in this document works generically for all artwork, as it only views artwork as plain text. However, various formats sometimes have mechanisms that can be used to prevent long lines. For instance, some source formats allow any quoted string to be broken up into substrings separated by a concatenation character ('+'), any of which can by on a different line. In another example, some languages allow factoring out chucks of code out into "functions" or "groupings". Using such call outs is especially helpful when in some deeply-nested code, as it typically resets the indentation back to the first column. As such, it is RECOMMENDED that authors do as much as possible within the selected format to avoid long lines. 5. Solution The following two sections provide the folding and unfolding algorithms that MUST be implemented to align with this BCP. 5.1. Folding Scan the artwork to see if any line exceeds the desired maximum. If no line exceeds the desired maximum, exit (this artwork does not need to be folded). Scan the artwork to ensure no existing lines already end with a '\' character on the desired maximum column, as this would be ambiguous. If such a line is found, exit (this artwork cannot be folded) Otherwise, as it is determined the artwork needs to be folded, prepend one of the following two 3-line headers as follows: If the desired maximum is 69, which is what is needed for `xml2rfc`, use the following header (RFC Ed. replace XX below with the assigned value for this BCP): Watsen Expires December 8, 2018 [Page 4] Internet-Draft Handling Long Lines in Artwork in Drafts June 2018 \n[Note: '\' line wrapping added per BCP XX]\n\n Otherwise, if the desired maximum is anything other than 69, use the followig header (RFC Ed. replace XX below with the assigned value for this BCP): \n[Note: '\' line wrapping added on