Browse Source

Added further commentary, made an adjustment, taking multibple arguments, no quoting requierd.

Sam Flint 10 years ago
parent
commit
93ca4e8a0c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      isbn2BibTeX.org

+ 4 - 2
isbn2BibTeX.org

@@ -117,6 +117,7 @@ We also have to actually query the server, this is simple, especially since we w
   data = json.loads(jsondata)
 #+end_src
 #+Caption: Query the API and parse to a data structure (QueryAndParse)
+Okay, so we have our query url, we now retrive it, and use `json.load` to turn it into a data structure.
 
 *** Create BibTeX Key
 Okay, every BibTeX entry must have a key, right? well, we have to create a key, and this is how we do it.
@@ -128,6 +129,7 @@ Okay, every BibTeX entry must have a key, right? well, we have to create a key,
   bibtexkey = authorlast[0] + str(rand)
 #+end_src
 #+Caption: Create a BibTeX key (KeyCreation)
+We're in the loop!  We need to use some of data to create the BibTeX key, the lastname of the first author, and a random integer between 0 and 3000.  I chose 0-3000 for the reason that you are unlikely to come across any bokks from past then at this current time.
 
 *** Format BibTeX Entry
 We now have to create the entry, and output it.
@@ -135,8 +137,7 @@ We now have to create the entry, and output it.
 #+begin_src python
   authoritem = ""
   first = 1
-  authorstruct = book['author_data']
-  for author in authorstruct:
+  for author in book['author_data']:
       authorname = author['name']
       if first == 0:
           authoritem = authoritem + " and  " + authorname
@@ -149,6 +150,7 @@ We now have to create the entry, and output it.
   print(entry)
 #+end_src
 #+Caption: Construct the entry and output it (BibTeXOutput)
+So the first thing done here is create an author string, by going through the author data and concatinating the names of each of the authors with the previous and the word `and`.  We then retrive the book's title and publisher.  From their, we output a fully formed BibTeX entry.
 
 ** Final Code
 #+begin_src python :tangle isbn2bibtex.py :shebang #!/usr/bin/python :exports code