From 9454b89d8e1b3331808d68fbc8b65c3f78b6ba5c Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 5 Feb 2024 11:46:36 +0100 Subject: [PATCH] add doc test --- src/risparser/mod.rs | 1 + src/risparser/overview.rs | 8 ++++++++ src/risparser/paragraphs.rs | 1 + 3 files changed, 10 insertions(+) create mode 100644 src/risparser/paragraphs.rs diff --git a/src/risparser/mod.rs b/src/risparser/mod.rs index 907bbfd..3b210cc 100644 --- a/src/risparser/mod.rs +++ b/src/risparser/mod.rs @@ -1,4 +1,5 @@ //! This deals with accessing RIS data. pub mod overview; +pub mod paragraphs; mod parser; diff --git a/src/risparser/overview.rs b/src/risparser/overview.rs index c909051..27381b8 100644 --- a/src/risparser/overview.rs +++ b/src/risparser/overview.rs @@ -24,6 +24,14 @@ use super::parser::OgdSearchResult; /// /// - `Ok(Vec)`: A vector of XML file links representing paragraphs from the given law text. /// - `Err(Error)`: An error if there was an issue fetching or parsing the law text. +/// +/// # Example +/// ``` +/// use risp::risparser::overview::parse; +/// +/// let list_with_xml_links_to_paragraphs = parse(10001905).unwrap(); +/// assert_eq!(list_with_xml_links_to_paragraphs.len(), 31); // TEG has 31 paragraphs +/// assert_eq!(list_with_xml_links_to_paragraphs[0], "https://www.ris.bka.gv.at/Dokumente/Bundesnormen/NOR12025190/NOR12025190.xml"); // Link to first paragraph /// ``` pub fn parse(law_id: usize) -> Result, Error> { let mut page = 1; diff --git a/src/risparser/paragraphs.rs b/src/risparser/paragraphs.rs new file mode 100644 index 0000000..221a663 --- /dev/null +++ b/src/risparser/paragraphs.rs @@ -0,0 +1 @@ +//! Deals with getting all paragraphs for a given law text