code-reviews

hmatheisen 2023-08-25T16:16:25.126189Z

Hello team, this is my first time posting here, I’m quite new new to Clojure and decided to make a first project to learn it. I started to make an EPUB parser and felt the need to have my code reviewed by some Clojure experts before writing more πŸ˜„ For now all it does is: β€’ Look for the entries in the EPUB zip file β€’ Check the mimetype of the given zip file β€’ Finds the the β€œcontainer” file to get the path of the the β€œpackage” document (requires some xml parsing) β€’ Print the ordered list of the files making the content actual book aka. the spine The code lives here: https://github.com/hmatheisen/epub-clj I realise now it may require some knowledge on how EPUB files work but it’s not that complex (https://www.w3.org/TR/epub-33/) I’d love to have some feedback on it ! Thanks a lot πŸ™‚

πŸ‘ 1
phronmophobic 2023-08-25T18:47:16.250089Z

Looks pretty reasonable. It looks like xml search functions like package-list-items look in a specific relative position which may be kind of brittle (I'm not familiar with the epub format). Since you're already using zippers, you might be able to use something like https://grishaev.me/en/zippo/ to do a more precise recursive search of the xml contents.