Skip to content

Commit

Permalink
fix 2 recipes by loading a default lorem ipsum. v3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jdum committed Oct 7, 2023
1 parent 42cc0c9 commit ce16c08
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion odfdo/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
# Authors: Jerome Dumonteil <[email protected]>
"""Version number of the package
"""
__version__ = "3.3.333"
__version__ = "3.3.4"
2 changes: 1 addition & 1 deletion recipes/_test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tot=0
for script in *.py ; do
let tot++
echo -en "${script} :"
$(python3.6 "${script}" &> /dev/null) && echo " passed." || { echo " failed !"; let err++ ; }
$(python3.10 "${script}" &> /dev/null) && echo " passed." || { echo " failed !"; let err++ ; }
done
echo "-------------------------"
echo "total scripts: $tot, failed scripts: $err"
21 changes: 4 additions & 17 deletions recipes/create_a_basic_text_document_with_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,20 @@
import os

# Uncommented parts are explained in: create_a_basic_text_document.py

# Some utilities
import urllib.request, urllib.parse, urllib.error


def random_text(sentences):
uri = "http://enneagon.org/phrases/%s" % sentences
try:
text = urllib.request.urlopen(uri).read().decode("iso8859-1")
except:
text = "Almost no text."
return text


from odfdo import Document, Header, Paragraph

lorem_ipsum = open("./lorem.txt", "r", encoding="utf8").read()
# Create the document
my_document = Document("text")
body = my_document.body

# Add content (See Create_a_basic_document.py)
title1 = Header(1, random_text(1)[:70])
title1 = Header(1, "Main title")
body.append(title1)
for p in range(3):
title = Header(2, random_text(1)[:70])
title = Header(2, f"title {p}")
body.append(title)
paragraph = Paragraph(random_text(10))
paragraph = Paragraph(lorem_ipsum[:240])

# Adding Annotation
# Annotations are notes that don’t appear in the document but
Expand Down
22 changes: 5 additions & 17 deletions recipes/create_a_basic_text_document_with_footnotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,21 @@
import os

# Uncommented parts are explained in: create_a_basic_text_document.py

# Some utilities
import urllib.request, urllib.parse, urllib.error


def random_text(sentences):
uri = "http://enneagon.org/phrases/%s" % sentences
try:
text = urllib.request.urlopen(uri).read().decode("iso8859-1")
except:
text = "Almost no text."
return text


from odfdo import Document, Header, Paragraph

lorem_ipsum = open("./lorem.txt", "r", encoding="utf8").read()

# Create the document
my_document = Document("text")
body = my_document.body

# Add content (See Create_a_basic_document.py)
title1 = Header(1, random_text(1)[:70])
title1 = Header(1, "Main title")
body.append(title1)
for p in range(3):
title = Header(2, random_text(1)[:70])
title = Header(2, f"title {p}")
body.append(title)
paragraph = Paragraph(random_text(10))
paragraph = Paragraph(lorem_ipsum[:240])

# Adding Footnote
# Now we add a footnote on each paragraph
Expand Down
28 changes: 28 additions & 0 deletions recipes/lorem.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus.
Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed,
dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper
congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est
eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu
massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue.
Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue.
Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed
dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed
pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales
hendrerit. Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut
orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non
tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae
ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur
aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non
mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam
faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat.
Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et
tristique ligula justo vitae magna. Aliquam convallis sollicitudin purus.
Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac
euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo.
Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet.
Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla
tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis
magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu
amet.

0 comments on commit ce16c08

Please sign in to comment.