Subject: [xml2rfc-dev] Script to generate RFC reference including abstract?

From: "Andrew G. Malis" <[email-masked]>
Date: Sun, 24 Jan 2021 12:03:41 -0500

Just to save myself a bit of work if this already exists ....

Have any of you written a script when, given a list of RFC numbers, will
generate an xml2rfc-ish reference and pull out the abstract for each RFC?
Something like, when given "8660", will produce:

   [RFC8660]  Bashandy, A., Ed., Filsfils, C., Ed., Previdi, S.,
              Decraene, B., Litkowski, S., and R. Shakir, "Segment
              Routing with the MPLS Data Plane", RFC 8660,
              DOI 10.17487/RFC8660, December 2019,
              <https://www.rfc-editor.org/info/rfc8660>.

   Segment Routing (SR) leverages the source-routing paradigm.  A node
   steers a packet through a controlled set of instructions, called
   segments, by prepending the packet with an SR header.  In the MPLS
   data plane, the SR header is instantiated through a label stack.
   This document specifies the forwarding behavior to allow
   instantiating SR over the MPLS data plane (SR-MPLS).

Thanks,
Andy

---

From: "StJohns, Michael" <[email-masked]>
Date: Sun, 24 Jan 2021 14:21:01 -0500

Maybe try this?
http://web-harvest.sourceforge.net/manual.php

On Sun, Jan 24, 2021 at 12:04 Andrew G. Malis <[email-masked]> wrote:

> _______________________________________________
> rfc-interest mailing list
> [email-masked]
> https://www.rfc-editor.org/mailman/listinfo/rfc-interest
>

---

From: "Andrew G. Malis" <[email-masked]>
Date: Sun, 24 Jan 2021 16:39:02 -0500

Mike,

Thanks, not quite what I was looking for, but it might be useful as a basis
for scripting.

Cheers,
Andy

---

From: Ronald Tse <[email-masked]>
Date: Sun, 24 Jan 2021 23:43:24 +0000

Hi Andy,

Relaton’s CLI (https://github.com/relaton/relaton-cli/) supports something like this:

——
$ gem install relaton-cli
$ relaton fetch --type=IETF "RFC 8660"
——

STDOUT:
——
<bibitem id="RFC8660" type="standard">
  <fetched>2021-01-25</fetched>
  <title format="text/plain" language="en" script="Latn">Segment Routing with the MPLS Data Plane</title>
  <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8660.xml</uri>
  <uri type="src">https://www.rfc-editor.org/info/rfc8660</uri>
  <docidentifier type="IETF">RFC 8660</docidentifier>
  <docidentifier type="rfc-anchor">RFC8660</docidentifier>
  <docidentifier type="DOI">10.17487/RFC8660</docidentifier>
…
  <contributor>
    <role type="editor"/>
    <person>
      <name>
        <completename language="en">A. Bashandy</completename>
      </name>
      <affiliation>
        <organization>
          <name>Internet Engineering Task Force</name>
          <abbreviation>IETF</abbreviation>
        </organization>
      </affiliation>
    </person>
  </contributor>
...
  <language>en</language>
  <script>Latn</script>
  <abstract format="text/plain" language="en" script="Latn">Segment Routing (SR) leverages the source-routing paradigm.  A node steers a packet through a controlled set of instructions, called segments, by prepending the packet with an SR header.  In the MPLS data plane, the SR header is instantiated through a label stack. This document specifies the forwarding behavior to allow instantiating SR over the MPLS data plane (SR-MPLS).</abstract>
  <series type="main">
    <title format="text/plain" language="en" script="Latn">RFC</title>
    <number>8660</number>
  </series>
  <place>Fremont, CA</place>
</bibitem>
——

The output is Relaton XML, which you could re-format into the format desired using XPath utilities like xmllint or xmlstarlet.

e.g.
——
$ relaton fetch --type=IETF "RFC 8660"> foo.xml 2>/dev/null
$ xmllint --xpath '/bibitem/abstract/text()' foo.xml
Segment Routing (SR) leverages the source-routing paradigm.  …
——

You could also output the bibtex format:
——
$ relaton fetch --type=IETF --format=bibtex "RFC 8660"> foo.bib 2>/dev/null
$ cat foo.bib
@misc{RFC8660,
  author = {Previdi, S. and Decraene, B. and Litkowski, S. and Shakir, R.},
  publisher = {Internet Engineering Task Force},
  address = {Fremont, CA},
  year = {2019},
  month = dec,
  timestamp = {2021-01-25},
  url = {https://www.rfc-editor.org/info/rfc8660},
  month_numeric = {12}
}
——

Hope this helps!

Ron

P.S. Relaton CLI supports references to most SDOs including ISO, IEC, etc using a unified bibliographic metadata model.

_____________________________________

Ronald Tse
Ribose Inc.

On Jan 25, 2021, at 5:39 AM, Andrew G. Malis <[email-masked]<mailto:[email-masked]>> wrote:

Mike,

Thanks, not quite what I was looking for, but it might be useful as a basis for scripting.

Cheers,
Andy

On Sun, Jan 24, 2021 at 2:21 PM StJohns, Michael <[email-masked]<mailto:[email-masked]>> wrote:
Maybe try this?
http://web-harvest.sourceforge.net/manual.php

On Sun, Jan 24, 2021 at 12:04 Andrew G. Malis <[email-masked]<mailto:[email-masked]>> wrote:
Just to save myself a bit of work if this already exists ....

Have any of you written a script when, given a list of RFC numbers, will generate an xml2rfc-ish reference and pull out the abstract for each RFC? Something like, when given "8660", will produce:

Thanks,
Andy

_______________________________________________
rfc-interest mailing list
[email-masked]<mailto:[email-masked]>
https://www.rfc-editor.org/mailman/listinfo/rfc-interest
_______________________________________________
xml2rfc-dev mailing list
[email-masked]<mailto:[email-masked]>
https://www.ietf.org/mailman/listinfo/xml2rfc-dev

---

From: "Martin Thomson" <[email-masked]>
Date: Mon, 25 Jan 2021 17:59:19 +1100

To get the reference:
curl -sSf https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml

To get just the abstract:
curl -sSf https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml | \
  xmllint --xpath '//abstract/t/text()' /dev/stdin

On Mon, Jan 25, 2021, at 04:03, Andrew G. Malis wrote:
> Have any of you written a script when, given a list of RFC numbers, 
> will generate an xml2rfc-ish reference and pull out the abstract for 
> each RFC? Something like, when given "8660", will produce:
> 
> [email-masked]

---

From: "Andrew G. Malis" <[email-masked]>
Date: Mon, 25 Jan 2021 08:01:08 -0500

Ron,

Thanks, that helps a lot! Lots of great tools out there.

Cheers,
Andy

On Sun, Jan 24, 2021 at 6:43 PM Ronald Tse <[email-masked]> wrote:

>   <uri type="xml">
> https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8660.xml</uri>
>   <abstract format="text/plain" language="en" script="Latn">Segment
> Routing (SR) leverages the source-routing paradigm.  A node steers a packet
> through a controlled set of instructions, called segments, by prepending
> the packet with an SR header.  In the MPLS data plane, the SR header is
> instantiated through a label stack. This document specifies the forwarding
> behavior to allow instantiating SR over the MPLS data plane
> (SR-MPLS).</abstract>
>   <series type="main">
> The output is Relaton XML, which you could re-format into the format
> desired using XPath utilities like xmllint or xmlstarlet.
>
> e.g.
> ——
> P.S. Relaton CLI supports references to most SDOs including ISO, IEC, etc
> using a unified bibliographic metadata model.
>
> On Jan 25, 2021, at 5:39 AM, Andrew G. Malis <[email-masked]> wrote:
>
> Mike,
>

---

From: "Andrew G. Malis" <[email-masked]>
Date: Mon, 25 Jan 2021 08:07:32 -0500

Martin,

Thanks, that's an awesome use of curl, which I've used before for other
purposes.

And I had forgotten that the bibxml includes the abstracts.

Cheers,
Andy

On Mon, Jan 25, 2021 at 1:59 AM Martin Thomson <[email-masked]> wrote:

> To get the reference:
> curl -sSf
> https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml
>
> curl -sSf
> https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml |
> \