Re: [xml2rfc] Question about “tocInclude” in xml2rfc

Stuart Cheshire <cheshire@apple.com> Thu, 04 March 2021 05:02 UTC

Return-Path: <cheshire@apple.com>
X-Original-To: xml2rfc@ietfa.amsl.com
Delivered-To: xml2rfc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 35ED73A10BA for <xml2rfc@ietfa.amsl.com>; Wed, 3 Mar 2021 21:02:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.367
X-Spam-Level:
X-Spam-Status: No, score=-2.367 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=apple.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6PqVEW5EC7fR for <xml2rfc@ietfa.amsl.com>; Wed, 3 Mar 2021 21:02:58 -0800 (PST)
Received: from ma1-aaemail-dr-lapp03.apple.com (ma1-aaemail-dr-lapp03.apple.com [17.171.2.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DD14E3A10B8 for <xml2rfc@ietf.org>; Wed, 3 Mar 2021 21:02:57 -0800 (PST)
Received: from pps.filterd (ma1-aaemail-dr-lapp03.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp03.apple.com (8.16.0.42/8.16.0.42) with SMTP id 1244wAQq034726 for <xml2rfc@ietf.org>; Wed, 3 Mar 2021 21:02:55 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : content-type : content-transfer-encoding : mime-version : subject : message-id : date : to; s=20180706; bh=AcsmsLKrY/ebncvjn2elXbQTiZNK/KGJGQxTAzx+Lp8=; b=KwJrmQwFdE6TBdVejbY4JO0PhuN4LQH4LZwsi9lJXX+vtyKhF8TiN2bt0yJ5JmimNL9N 450PNxfFBg3MHo5pl69N0GFQN2l/i8tE+GcUwen08T5uLg14S1LTHy4vfZNLa//0inLT FojKuxaMJSH83VrPSmJehgP2ES1o8yGcLAOat5ki37Y0Le01V4Crg3TClNYyBKjdVXLA Y6Gu6i0RKjNB4/vXbGLyQBunkElsQcD4JJbTzKszCyFDypVlU3fVkHzNFp7yHyZ80TaN xnv6pt44H+41TNVzFQmh2TxSe3HTyvqgLmf+lX7fOLEZxldXmzi45GPHsysQbkBnbguR WQ==
Received: from rn-mailsvcp-mta-lapp03.rno.apple.com (rn-mailsvcp-mta-lapp03.rno.apple.com [10.225.203.151]) by ma1-aaemail-dr-lapp03.apple.com with ESMTP id 36yny0tm38-16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for <xml2rfc@ietf.org>; Wed, 03 Mar 2021 21:02:55 -0800
Received: from rn-mailsvcp-mmp-lapp03.rno.apple.com (rn-mailsvcp-mmp-lapp03.rno.apple.com [17.179.253.16]) by rn-mailsvcp-mta-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.7.20201203 64bit (built Dec 3 2020)) with ESMTPS id <0QPF009BHI0V1TG0@rn-mailsvcp-mta-lapp03.rno.apple.com> for xml2rfc@ietf.org; Wed, 03 Mar 2021 21:02:55 -0800 (PST)
Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp03.rno.apple.com by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.7.20201203 64bit (built Dec 3 2020)) id <0QPF00U00HWI7800@rn-mailsvcp-mmp-lapp03.rno.apple.com> for xml2rfc@ietf.org; Wed, 03 Mar 2021 21:02:55 -0800 (PST)
X-V-A:
X-V-T-CD: 827d2dc74289835954c562e64b1c0212
X-V-E-CD: 83d97402840187eac8d50f5bc84dedac
X-V-R-CD: 57f4795f99c6bc9d1d0b05012da4c7e3
X-V-CD: 0
X-V-ID: 9a57aeba-bf8a-4cfb-8626-2344968d18d8
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-04_01:2021-03-03, 2021-03-04 signatures=0
Received: from [17.234.66.40] (unknown [17.234.66.40]) by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.7.20201203 64bit (built Dec 3 2020)) with ESMTPSA id <0QPF00T5CI0UWO00@rn-mailsvcp-mmp-lapp03.rno.apple.com> for xml2rfc@ietf.org; Wed, 03 Mar 2021 21:02:55 -0800 (PST)
From: Stuart Cheshire <cheshire@apple.com>
Content-type: text/plain; charset="utf-8"
Content-transfer-encoding: quoted-printable
MIME-version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
Message-id: <9E21EA4E-2989-46F8-A02D-344E214FC7D4@apple.com>
Date: Wed, 03 Mar 2021 21:02:54 -0800
To: xml2rfc@ietf.org
X-Mailer: Apple Mail (2.3608.120.23.2.1)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-04_01:2021-03-03, 2021-03-04 signatures=0
Archived-At: <https://mailarchive.ietf.org/arch/msg/xml2rfc/wOGLYDa7yqLgTBEQZn3vOLt2PM0>
Subject: Re: [xml2rfc] Question about “tocInclude” in xml2rfc
X-BeenThere: xml2rfc@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: <xml2rfc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/xml2rfc>, <mailto:xml2rfc-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/xml2rfc/>
List-Post: <mailto:xml2rfc@ietf.org>
List-Help: <mailto:xml2rfc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/xml2rfc>, <mailto:xml2rfc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Mar 2021 05:02:59 -0000

I may have just found the solution myself.

The error message said “object has no attribute ‘xpath’ in add_pageno_placeholders.”

I added a single “if” statement so that it doesn’t try to get toc.xpath for a document that has no TOC. That seemed to fix it.

  % diff -u text-orig.py text.py   
  --- text-orig.py    2021-03-03 19:58:39.000000000 -0800
  +++ text.py         2021-03-03 20:50:34.000000000 -0800
  @@ -369,8 +369,9 @@

       def add_pageno_placeholders(self):
           toc = self.root.find('./front/toc/section')
  -        for e in toc.xpath('.//xref[2]'):
  -            e.set('pageno', '0000')
  +        if toc:
  +            for e in toc.xpath('.//xref[2]'):
  +                e.set('pageno', '0000')

       def paginate(self, lines):
           """

Stuart Cheshire