draft-ietf-netmod-artwork-folding-05.txt | draft-ietf-netmod-artwork-folding-06.txt | |||
---|---|---|---|---|
NETMOD Working Group K. Watsen | NETMOD Working Group K. Watsen | |||
Internet-Draft Watsen Networks | Internet-Draft Watsen Networks | |||
Intended status: Best Current Practice A. Farrel | Intended status: Best Current Practice A. Farrel | |||
Expires: December 22, 2019 Old Dog Consulting | Expires: December 29, 2019 Old Dog Consulting | |||
Q. Wu | Q. Wu | |||
Huawei Technologies | Huawei Technologies | |||
June 20, 2019 | June 27, 2019 | |||
Handling Long Lines in Inclusions in Internet-Drafts and RFCs | Handling Long Lines in Inclusions in Internet-Drafts and RFCs | |||
draft-ietf-netmod-artwork-folding-05 | draft-ietf-netmod-artwork-folding-06 | |||
Abstract | Abstract | |||
This document defines two strategies for handling long lines in | This document defines two strategies for handling long lines in | |||
width-bounded text content. One strategy is based on the historic | width-bounded text content. One strategy is based on the historic | |||
use of a single backslash ('\') character to indicate where line- | use of a single backslash ('\') character to indicate where line- | |||
folding has occurred, with the continuation occurring with the first | folding has occurred, with the continuation occurring with the first | |||
non-space (' ') character on the next line. The second strategy | non-space (' ') character on the next line. The second strategy | |||
extends the first strategy by adding a second backslash character to | extends the first strategy by adding a second backslash character to | |||
identify where the continuation begins and thereby able to handle | identify where the continuation begins and thereby able to handle | |||
skipping to change at page 1, line 42 ¶ | skipping to change at page 1, line 42 ¶ | |||
Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
Drafts is at https://datatracker.ietf.org/drafts/current/. | Drafts is at https://datatracker.ietf.org/drafts/current/. | |||
Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
This Internet-Draft will expire on December 22, 2019. | This Internet-Draft will expire on December 29, 2019. | |||
Copyright Notice | Copyright Notice | |||
Copyright (c) 2019 IETF Trust and the persons identified as the | Copyright (c) 2019 IETF Trust and the persons identified as the | |||
document authors. All rights reserved. | document authors. All rights reserved. | |||
This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
(https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
publication of this document. Please review these documents | publication of this document. Please review these documents | |||
skipping to change at page 2, line 50 ¶ | skipping to change at page 2, line 50 ¶ | |||
8.2. Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 10 | 8.2. Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 10 | |||
8.2.1. Folding . . . . . . . . . . . . . . . . . . . . . . . 10 | 8.2.1. Folding . . . . . . . . . . . . . . . . . . . . . . . 10 | |||
8.2.2. Unfolding . . . . . . . . . . . . . . . . . . . . . . 11 | 8.2.2. Unfolding . . . . . . . . . . . . . . . . . . . . . . 11 | |||
9. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 12 | 9. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 12 | |||
9.1. Example Showing Boundary Conditions . . . . . . . . . . . 12 | 9.1. Example Showing Boundary Conditions . . . . . . . . . . . 12 | |||
9.1.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 12 | 9.1.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 12 | |||
9.1.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 13 | 9.1.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 13 | |||
9.2. Example Showing Multiple Wraps of a Single Line . . . . . 13 | 9.2. Example Showing Multiple Wraps of a Single Line . . . . . 13 | |||
9.2.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 13 | 9.2.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 13 | |||
9.2.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 13 | 9.2.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 13 | |||
9.3. Example Showing Smart Folding . . . . . . . . . . . . . . 13 | 9.3. Example Showing "Smart" Folding . . . . . . . . . . . . . 13 | |||
9.3.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 14 | 9.3.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 14 | |||
9.3.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 15 | 9.3.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 15 | |||
10. Security Considerations . . . . . . . . . . . . . . . . . . . 16 | 10. Security Considerations . . . . . . . . . . . . . . . . . . . 16 | |||
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 | 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 | |||
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 | 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 | |||
12.1. Normative References . . . . . . . . . . . . . . . . . . 16 | 12.1. Normative References . . . . . . . . . . . . . . . . . . 16 | |||
12.2. Informative References . . . . . . . . . . . . . . . . . 16 | 12.2. Informative References . . . . . . . . . . . . . . . . . 16 | |||
Appendix A. POSIX Shell Script . . . . . . . . . . . . . . . . . 18 | Appendix A. POSIX Shell Script: rfcfold . . . . . . . . . . . . 18 | |||
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 25 | Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 26 | |||
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 | |||
1. Introduction | 1. Introduction | |||
[RFC7994] sets out the requirements for plain-text RFCs and states | [RFC7994] sets out the requirements for plain-text RFCs and states | |||
that each line of an RFC (and hence of an Internet-Draft) must be | that each line of an RFC (and hence of an Internet-Draft) must be | |||
limited to 72 characters followed by the character sequence that | limited to 72 characters followed by the character sequence that | |||
denotes an end-of-line (EOL). | denotes an end-of-line (EOL). | |||
Internet-Drafts and RFCs often include example text or code | Internet-Drafts and RFCs often include example text or code | |||
skipping to change at page 13, line 47 ¶ | skipping to change at page 13, line 47 ¶ | |||
9.2.2. Using '\\' | 9.2.2. Using '\\' | |||
========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) =========== | ========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) =========== | |||
12345678901234567890123456789012345678901234567890123456789012345678\ | 12345678901234567890123456789012345678901234567890123456789012345678\ | |||
\9012345678901234567890123456789012345678901234567890123456789012345\ | \9012345678901234567890123456789012345678901234567890123456789012345\ | |||
\6789012345678901234567890123456789012345678901234567890123456789012\ | \6789012345678901234567890123456789012345678901234567890123456789012\ | |||
\3456789012345678901234567890123456789012345678901234567890123456789\ | \3456789012345678901234567890123456789012345678901234567890123456789\ | |||
\01234567890 | \01234567890 | |||
9.3. Example Showing Smart Folding | 9.3. Example Showing "Smart" Folding | |||
This example illustrates how readability can be improved via "smart" | This example illustrates how readability can be improved via "smart" | |||
folding, whereby folding occurs at format-specific locations and | folding, whereby folding occurs at format-specific locations and | |||
format-specific indentations are used. | format-specific indentations are used. | |||
The text content was manually folded, since the script in the | The text content was manually folded, since the script in the | |||
appendix does not implement smart folding. | appendix does not implement smart folding. | |||
Note that the header is surrounded by different printable characters | Note that the header is surrounded by different printable characters | |||
then shown in the script-generated examples. | then shown in the script-generated examples. | |||
skipping to change at page 18, line 5 ¶ | skipping to change at page 18, line 5 ¶ | |||
<https://www.rfc-editor.org/info/rfc8340>. | <https://www.rfc-editor.org/info/rfc8340>. | |||
[xiax] "The `xiax` Python Package", | [xiax] "The `xiax` Python Package", | |||
<https://pypi.org/project/xiax/>. | <https://pypi.org/project/xiax/>. | |||
[yang-doctors-thread] | [yang-doctors-thread] | |||
"[yang-doctors] automating yang doctor reviews", | "[yang-doctors] automating yang doctor reviews", | |||
<https://mailarchive.ietf.org/arch/msg/yang-doctors/ | <https://mailarchive.ietf.org/arch/msg/yang-doctors/ | |||
DCfBqgfZPAD7afzeDFlQ1Xm2X3g>. | DCfBqgfZPAD7afzeDFlQ1Xm2X3g>. | |||
Appendix A. POSIX Shell Script | Appendix A. POSIX Shell Script: rfcfold | |||
This non-normative appendix section includes a shell script that can | This non-normative appendix section includes a shell script that can | |||
both fold and unfold text content using both the single and double | both fold and unfold text content using both the single and double | |||
backslash strategies described in Section 7 and Section 8 | backslash strategies described in Section 7 and Section 8 | |||
respectively. | respectively. | |||
This script is intended to be applied to a single text content | This script is intended to be applied to a single text content | |||
instance. If it is desired to fold or unfold test content instances | instance. If it is desired to fold or unfold text content instances | |||
within a larger document (e.g., an Internet draft or RFC), then | within a larger document (e.g., an Internet draft or RFC), then | |||
another tool must be used to extract the content from the larger | another tool must be used to extract the content from the larger | |||
document before utilizing this script. | document before utilizing this script. | |||
For readability purposes, this script forces the minimally supported | For readability purposes, this script forces the minimally supported | |||
line length to be eight characters longer than the raw header text | line length to be eight characters longer than the raw header text | |||
defined in Section 7.1.1 and Section 8.1.1 so as to ensure that the | defined in Section 7.1.1 and Section 8.1.1 so as to ensure that the | |||
header can be wrapped by a space (' ') character and three equal | header can be wrapped by a space (' ') character and three equal | |||
('=') characters on each side of the raw header text. | ('=') characters on each side of the raw header text. | |||
This script does not implement the "forced folding" logic described | This script does not implement the "forced folding" logic described | |||
in Section 8.2.1. In such cases the script will exit with the | in Section 8.2.1. In such cases the script will exit with the | |||
message: | message: | |||
Error: infile has a line ending with a '\\' character | Error: infile has a line ending with a '\' character | |||
followed by a '\\' character as the first non-space | followed by a '\' character as the first non-space | |||
character on the next line. This file cannot be folded. | character on the next line. This script cannot fold | |||
this file using '\\' strategy without there being | ||||
false positives produced in the unfolding (i.e., this | ||||
script does not attempt to proactively force-fold such | ||||
lines, as described in RFC XXXX). | ||||
Shell-level end-of-line backslash ('\') characters have been | Shell-level end-of-line backslash ('\') characters have been | |||
purposely added to the script so as to ensure that the script is | purposely added to the script so as to ensure that the script is | |||
itself not folded in this document, thus simplify the ability to | itself not folded in this document, thus simplify the ability to | |||
copy/paste the script for local use. As should be evident by the | copy/paste the script for local use. As should be evident by the | |||
lack of the mandatory header described in Section 7.1.1, these | lack of the mandatory header described in Section 7.1.1, these | |||
backslashes do not designate a folded line, such as described in | backslashes do not designate a folded line, such as described in | |||
Section 7. | Section 7. | |||
<CODE BEGINS> | <CODE BEGINS> | |||
#!/bin/bash --posix # must be `bash` (not `sh`) | #!/bin/bash --posix | |||
# must use `bash` (not `sh`) | ||||
# This script may need some adjustments to work on a given system. | ||||
# For instance, the utilities `pcregrep` and `gsed` may need to | ||||
# be installed. | ||||
print_usage() { | print_usage() { | |||
echo | echo | |||
echo "Folds the text file, only if needed, at the specified" | echo "Folds the text file, only if needed, at the specified" | |||
echo "column, according to BCP XX." | echo "column, according to BCP XX." | |||
echo | echo | |||
echo "Usage: $0 [-s <strategy>] [-c <col>] [-r] -i <infile>" | echo "Usage: $0 [-s <strategy>] [-c <col>] [-r] -i <infile>" | |||
echo " -o <outfile>" | echo " -o <outfile>" | |||
echo | echo | |||
echo " -s: strategy to use, '1' or '2' (default: try 1, else 2)" | echo " -s: strategy to use, '1' or '2' (default: try 1, else 2)" | |||
skipping to change at page 19, line 30 ¶ | skipping to change at page 19, line 40 ¶ | |||
reversed=0 | reversed=0 | |||
infile="" | infile="" | |||
outfile="" | outfile="" | |||
maxcol=69 # default, may be overridden by param | maxcol=69 # default, may be overridden by param | |||
hdr_txt_1="NOTE: '\\' line wrapping per BCP XX (RFC XXXX)" | hdr_txt_1="NOTE: '\\' line wrapping per BCP XX (RFC XXXX)" | |||
hdr_txt_2="NOTE: '\\\\' line wrapping per BCP XX (RFC XXXX)" | hdr_txt_2="NOTE: '\\\\' line wrapping per BCP XX (RFC XXXX)" | |||
equal_chars="==============================================" | equal_chars="==============================================" | |||
space_chars=" " | space_chars=" " | |||
temp_dir="" | temp_dir="" | |||
# determine name of [g]sed binary | ||||
type gsed > /dev/null 2>&1 && SED=gsed || SED=sed | ||||
# warn if a non-GNU sed utility is used | ||||
"$SED" --version < /dev/null 2> /dev/null \ | ||||
| grep GNU >/dev/null 2>&1 || echo 'Warning: not using GNU sed' | ||||
# verify the availability of pcregrep | ||||
type pcregrep > /dev/null 2>&1 || { | ||||
echo 'Error: missing utility `pcregrep`' | ||||
exit 1 | ||||
} | ||||
cleanup() { | ||||
rm -rf "$temp_dir" | ||||
} | ||||
trap 'cleanup' EXIT | ||||
fold_it_1() { | fold_it_1() { | |||
# ensure input file doesn't contain the fold-sequence already | # ensure input file doesn't contain the fold-sequence already | |||
pcregrep -M "\\\\\n" $infile >> /dev/null 2>&1 | pcregrep -M "\\\\\n" $infile >> /dev/null 2>&1 | |||
if [[ $? -eq 0 ]]; then | if [[ $? -eq 0 ]]; then | |||
if [[ $quiet -eq 0 ]]; then | if [[ $quiet -eq 0 ]]; then | |||
echo | echo | |||
echo "Error: infile $infile has a line ending with a '\\'" | echo "Error: infile $infile has a line ending with a '\\'" | |||
echo "character. This file cannot be folded using the '\\'" | echo "character. This file cannot be folded using the '\\'" | |||
echo "strategy." | echo "strategy." | |||
echo | echo | |||
fi | fi | |||
return 1 | return 1 | |||
fi | fi | |||
# stash some vars | # where to fold | |||
testcol=`expr "$maxcol" + 1` | ||||
foldcol=`expr "$maxcol" - 1` # for the inserted '\' char | foldcol=`expr "$maxcol" - 1` # for the inserted '\' char | |||
# ensure input file doesn't contain whitespace on the fold column | # ensure input file doesn't contain whitespace on the fold column | |||
grep "^.\{$foldcol\} " $infile >> /dev/null 2>&1 | grep "^.\{$foldcol\} " $infile >> /dev/null 2>&1 | |||
if [[ $? -eq 0 ]]; then | if [[ $? -eq 0 ]]; then | |||
if [[ $quiet -eq 0 ]]; then | if [[ $quiet -eq 0 ]]; then | |||
echo | echo | |||
echo "Error: infile has a space character occuring on the" | echo "Error: infile has a space character occuring on the" | |||
echo "folding column. This file cannot be folded using the" | echo "folding column. This file cannot be folded using the" | |||
echo "'\\' strategy." | echo "'\\' strategy." | |||
skipping to change at page 20, line 23 ¶ | skipping to change at page 20, line 49 ¶ | |||
# center header text | # center header text | |||
length=`expr ${#hdr_txt_1} + 2` | length=`expr ${#hdr_txt_1} + 2` | |||
left_sp=`expr \( "$maxcol" - "$length" \) / 2` | left_sp=`expr \( "$maxcol" - "$length" \) / 2` | |||
right_sp=`expr "$maxcol" - "$length" - "$left_sp"` | right_sp=`expr "$maxcol" - "$length" - "$left_sp"` | |||
header=`printf "%.*s %s %.*s" "$left_sp" "$equal_chars"\ | header=`printf "%.*s %s %.*s" "$left_sp" "$equal_chars"\ | |||
"$hdr_txt_1" "$right_sp" "$equal_chars"` | "$hdr_txt_1" "$right_sp" "$equal_chars"` | |||
# generate outfile | # generate outfile | |||
echo "$header" > $outfile | echo "$header" > $outfile | |||
echo "" >> $outfile | echo "" >> $outfile | |||
gsed "/.\{$testcol\}/s/\(.\{$foldcol\}\)/\1\\\\\n/g"\ | "$SED" 's/\(.\{'"$foldcol"'\}\)\(..\)/\1\\\n\2/;t M;b;:M;P;D;'\ | |||
< $infile >> $outfile | < $infile >> $outfile 2>/dev/null | |||
if [[ $? -ne 0 ]]; then | ||||
return 1 | ||||
fi | ||||
return 0 | return 0 | |||
} | } | |||
fold_it_2() { | fold_it_2() { | |||
if [ "$temp_dir" == "" ]; then | # where to fold | |||
temp_dir=`mktemp -d` | foldcol=`expr "$maxcol" - 1` # for the inserted '\' char | |||
fi | ||||
# ensure input file doesn't contain the fold-sequence already | # ensure input file doesn't contain the fold-sequence already | |||
pcregrep -M "\\\\\n[\ ]*\\\\" $infile >> /dev/null 2>&1 | pcregrep -M "\\\\\n[\ ]*\\\\" $infile >> /dev/null 2>&1 | |||
if [[ $? -eq 0 ]]; then | if [[ $? -eq 0 ]]; then | |||
if [[ $quiet -eq 0 ]]; then | if [[ $quiet -eq 0 ]]; then | |||
echo | echo | |||
echo "Error: infile has a line ending with a '\\' character" | echo "Error: infile has a line ending with a '\\' character" | |||
echo "followed by a '\\' character as the first non-space" | echo "followed by a '\\' character as the first non-space" | |||
echo "character on the next line. This file cannot be folded" | echo "character on the next line. This script cannot fold" | |||
echo "using the '\\\\' strategy." | echo "this file using '\\\\' strategy without there being" | |||
echo "false positives produced in the unfolding (i.e., this" | ||||
echo "script does not attempt to proactively force-fold such" | ||||
echo "lines, as described in RFC XXXX)." | ||||
echo | echo | |||
fi | fi | |||
return 1 | return 1 | |||
fi | fi | |||
# center header text | # center header text | |||
length=`expr ${#hdr_txt_2} + 2` | length=`expr ${#hdr_txt_2} + 2` | |||
left_sp=`expr \( "$maxcol" - "$length" \) / 2` | left_sp=`expr \( "$maxcol" - "$length" \) / 2` | |||
right_sp=`expr "$maxcol" - "$length" - "$left_sp"` | right_sp=`expr "$maxcol" - "$length" - "$left_sp"` | |||
header=`printf "%.*s %s %.*s" "$left_sp" "$equal_chars"\ | header=`printf "%.*s %s %.*s" "$left_sp" "$equal_chars"\ | |||
"$hdr_txt_2" "$right_sp" "$equal_chars"` | "$hdr_txt_2" "$right_sp" "$equal_chars"` | |||
# fold using recursive passes ('g' used in fold_it_1 didn't work) | # generate outfile | |||
if [ -z "$1" ]; then | echo "$header" > $outfile | |||
# init recursive env | echo "" >> $outfile | |||
cp $infile $temp_dir/wip | "$SED" 's/\(.\{'"$foldcol"'\}\)\(..\)/\1\\\n\\\2/;t M;b;:M;P;D;'\ | |||
fi | < $infile >> $outfile 2>/dev/null | |||
testcol=`expr "$maxcol" + 1` | if [[ $? -ne 0 ]]; then | |||
foldcol=`expr "$maxcol" - 1` # for the inserted '\' char | return 1 | |||
gsed "/.\{$testcol\}/s/\(.\{$foldcol\}\)/\1\\\\\n\\\\/" \ | ||||
< $temp_dir/wip >> $temp_dir/wip2 | ||||
diff $temp_dir/wip $temp_dir/wip2 > /dev/null 2>&1 | ||||
if [ $? -eq 1 ]; then | ||||
mv $temp_dir/wip2 $temp_dir/wip | ||||
fold_it_2 "recursing" | ||||
else | ||||
echo "$header" > $outfile | ||||
echo "" >> $outfile | ||||
cat $temp_dir/wip2 >> $outfile | ||||
rm -rf $temp_dir | ||||
fi | fi | |||
return 0 | return 0 | |||
} | } | |||
fold_it() { | fold_it() { | |||
# ensure input file doesn't contain a TAB | # ensure input file doesn't contain a TAB | |||
grep $'\t' $infile >> /dev/null 2>&1 | grep $'\t' $infile >> /dev/null 2>&1 | |||
if [[ $? -eq 0 ]]; then | if [[ $? -eq 0 ]]; then | |||
if [[ $quiet -eq 0 ]]; then | if [[ $quiet -eq 0 ]]; then | |||
echo | echo | |||
skipping to change at page 22, line 4 ¶ | skipping to change at page 22, line 23 ¶ | |||
# check if file needs folding | # check if file needs folding | |||
testcol=`expr "$maxcol" + 1` | testcol=`expr "$maxcol" + 1` | |||
grep ".\{$testcol\}" $infile >> /dev/null 2>&1 | grep ".\{$testcol\}" $infile >> /dev/null 2>&1 | |||
if [ $? -ne 0 ]; then | if [ $? -ne 0 ]; then | |||
if [[ $debug -eq 1 ]]; then | if [[ $debug -eq 1 ]]; then | |||
echo "nothing to do" | echo "nothing to do" | |||
fi | fi | |||
cp $infile $outfile | cp $infile $outfile | |||
return -1 | return -1 | |||
fi | fi | |||
if [[ $strategy -eq 1 ]]; then | if [[ $strategy -eq 1 ]]; then | |||
fold_it_1 | fold_it_1 | |||
return $? | return $? | |||
fi | fi | |||
if [[ $strategy -eq 2 ]]; then | if [[ $strategy -eq 2 ]]; then | |||
fold_it_2 | fold_it_2 | |||
return $? | return $? | |||
fi | fi | |||
quiet_sav=$quite | quiet_sav=$quiet | |||
quiet=1 | quiet=1 | |||
fold_it_1 | fold_it_1 | |||
result=$? | result=$? | |||
quiet=$quiet_sav | quiet=$quiet_sav | |||
if [[ $result -ne 0 ]]; then | if [[ $result -ne 0 ]]; then | |||
if [[ $debug -eq 1 ]]; then | if [[ $debug -eq 1 ]]; then | |||
echo "Folding strategy 1 didn't succeed, trying strategy 2..." | echo "Folding strategy 1 didn't succeed, trying strategy 2..." | |||
fi | fi | |||
fold_it_2 | fold_it_2 | |||
return $? | return $? | |||
skipping to change at page 22, line 32 ¶ | skipping to change at page 23, line 4 ¶ | |||
return $? | return $? | |||
fi | fi | |||
return 0 | return 0 | |||
} | } | |||
unfold_it_1() { | unfold_it_1() { | |||
temp_dir=`mktemp -d` | temp_dir=`mktemp -d` | |||
# output all but the first two lines (the header) to wip file | # output all but the first two lines (the header) to wip file | |||
awk "NR>2" $infile > $temp_dir/wip | awk "NR>2" $infile > $temp_dir/wip | |||
# unfold wip file | # unfold wip file | |||
gsed ":x; /.*\\\\$/N; s/\\\\\n[ ]*//; tx" $temp_dir/wip > $outfile | "$SED" ':S;$!N;s/\\\n *//;t S;P;D' $temp_dir/wip > $outfile | |||
# clean up and return | ||||
rm -rf $temp_dir | ||||
return 0 | return 0 | |||
} | } | |||
unfold_it_2() { | unfold_it_2() { | |||
temp_dir=`mktemp -d` | temp_dir=`mktemp -d` | |||
# output all but the first two lines (the header) to wip file | # output all but the first two lines (the header) to wip file | |||
awk "NR>2" $infile > $temp_dir/wip | awk "NR>2" $infile > $temp_dir/wip | |||
# unfold wip file | # unfold wip file | |||
gsed ":x; /.*\\\\$/N; s/\\\\\n[ ]*\\\\//; tx" $temp_dir/wip \ | "$SED" ':S;$!N;s/\\\n *\\//;t S;P;D' $temp_dir/wip > $outfile | |||
> $outfile | ||||
# clean up and return | ||||
rm -rf $temp_dir | ||||
return 0 | return 0 | |||
} | } | |||
unfold_it() { | unfold_it() { | |||
# check if file needs unfolding | # check if file needs unfolding | |||
line=`head -n 1 $infile` | line=`head -n 1 $infile` | |||
result=`echo $line | fgrep "$hdr_txt_1"` | result=`echo $line | fgrep "$hdr_txt_1"` | |||
if [ $? -eq 0 ]; then | if [ $? -eq 0 ]; then | |||
unfold_it_1 | unfold_it_1 | |||
return $? | return $? | |||
skipping to change at page 25, line 39 ¶ | skipping to change at page 26, line 4 ¶ | |||
process_input $@ | process_input $@ | |||
if [[ $reversed -eq 0 ]]; then | if [[ $reversed -eq 0 ]]; then | |||
fold_it | fold_it | |||
code=$? | code=$? | |||
else | else | |||
unfold_it | unfold_it | |||
code=$? | code=$? | |||
fi | fi | |||
exit $code | exit $code | |||
} | } | |||
main "$@" | main "$@" | |||
<CODE ENDS> | <CODE ENDS> | |||
Acknowledgements | Acknowledgements | |||
The authors thank the RFC Editor for confirming that there was | ||||
previously no set convention for handling long lines in sourcecode | ||||
inclusions, thus instigating this work. | ||||
The authors thank the following folks for their various contributions | The authors thank the following folks for their various contributions | |||
(sorted by first name): Benoit Claise, Gianmarco Bruno, Italo Busi, | while producing this document (sorted by first name): Benoit Claise, | |||
Joel Jaeggli, Jonathan Hansford, Lou Berger, Martin Bjorklund, and | Erik Auerswald, Gianmarco Bruno, Italo Busi, Joel Jaeggli, Jonathan | |||
Rob Wilton. | Hansford, Lou Berger, Martin Bjorklund, and Rob Wilton. | |||
The authors additionally thank the RFC Editor for confirming that | Special acknowledgement to Erik Auerswald for his contributions to | |||
there is no set convention today for handling long lines in artwork/ | the `rfcfold` script, especially for greatly improving the `sed` one- | |||
sourcecode inclusions. | liners used therein. | |||
Authors' Addresses | Authors' Addresses | |||
Kent Watsen | Kent Watsen | |||
Watsen Networks | Watsen Networks | |||
EMail: kent+ietf@watsen.net | EMail: kent+ietf@watsen.net | |||
Adrian Farrel | Adrian Farrel | |||
Old Dog Consulting | Old Dog Consulting | |||
End of changes. 28 change blocks. | ||||
57 lines changed or deleted | 75 lines changed or added | |||
This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |