Commits

Tomas Zulberti  committed dd47475

Updated the folder structure.
Solved a bug with the page size on rst2pdf.

  • Participants
  • Parent commits 345cdf6

Comments (0)

Files changed (1)

File pet_builder/basic_structure.py

 The final structure will be something like:
 
 ::
-    .
+
     ├── output
+    │   └── pdf
     └── templates
         ├── books
+        │   ├── epub
+        │   ├── fb2
+        │   └── mobi
         ├── html
         │   ├── articles
-        │   ├── Makefile
+        │   ├── Makefile
         │   └── pelican-theme
+        │       └── templates
         └── pdf
-            ├── a4_landscape
+            ├── A4_landscape
             │   ├── articles
-            │   └── Makefile
-            └── a4_portait
-
+            │   ├── images
+            │   ├── Makefile
+            │   ├── pdmaster.X.rst
+            │   ├── licence
+            │   └── styles
+            └── A4_portait
 
 where:
 
     is where the generated PDF, books, and HTML content will be set so
     it can be uploaded to the server (revista.python.org.ar) where the
     magazine is hosted.
+
 templates:
     the main folder that will be used to create the different distrubutions
     on each article.
         the same as the html, except that there will be a subfolder for
         each format.
 
+    pdf/images:
+        all the images required by the different articles
+
+    pdf/licence:
+        the licence that will be present on the PDF's
+
+    pdf/styles:
+        the different restructured text styles.
+
 '''
 
 import os
 
     create_html_basic_structure()
     create_pdf_structure()
-    """
-    html_folder = os.path.join(settings.pet_folder, 'templates', 'html')
-    pdf_folder = os.path.join(settings.pet_folder, 'templates', 'pdf')
-    book_folder = os.path.join(settings.pet_folder, 'templates', 'books')
-
-    folders_to_create = []
-    folders_to_create.append(os.path.join(settings.pet_folder, 'templates'))
-    folders_to_create.append(os.path.join(settings.pet_folder, 'output'))
-    folders_to_create.append(html_folder)
-    folders_to_create.append(pdf_folder)
-    folders_to_create.append(book_folder)
-
-    for page_size in PDF_PAGE_SIZES:
-        for page_orientation in PAGE_ORIENTATIONS:
-            folder_name = '%s_%s' % (page_size, page_orientation)
-            folders_to_create.append(os.path.join(pdf_folder, folder_name))
-
-    for book_format in BOOK_FORMATS:
-        book_format_folder = os.path.join(book_folder, book_format)
-        folders_to_create.append(book_format_folder)
-
-    os.makedirs(settings.pet_folder)
-
-    for folder_path in folders_to_create:
-        os.makedirs(folder_path)
-    """
 
 
 def create_html_basic_structure():
-    ''' Creates the basic html folders and copy the rendered files
+    ''' Creates the basic html folders and copy the rendered files.
+
+    It will create the following structure:
+
+    ::
+
+        ├── html
+            ├── articles
+            ├── Makefile
+            └── pelican-theme
+
+
     '''
     html_folder = os.path.join(settings.pet_folder, 'templates', 'html')
     articles_folder = os.path.join(html_folder, 'articles')
 
     base_style_file = os.path.join(CURRENT_DIR, 'templates', 'pdf', 'styles', 'base.style')
     licence_folder = os.path.join(CURRENT_DIR, 'templates', 'pdf', 'licence')
+
     for page_size in PDF_PAGE_SIZES:
         for page_orientation in PAGE_ORIENTATIONS:
-            rst2pdf_params = 'styles/%s,%s' % (page_orientation, page_size)
+            rst2pdf_params = 'styles/%s,%s' % (page_orientation, page_size.lower())
 
             # create the makefile
             folder_name = '%s_%s' % (page_size, page_orientation)
 
             # create the style
             styles_folder = os.path.join(current_pdf_folder, 'styles')
-            os.mkdir(styles_folder)
+            images_folder = os.path.join(current_pdf_folder, 'images')
+            create_folders([styles_folder, images_folder])
 
             copy(base_style_file, styles_folder)
             style_name = os.path.join('pdf', 'styles', '%s.style' % page_orientation)
 
             copytree(licence_folder, os.path.join(current_pdf_folder, 'licence'))
             copy_render_template(style_name, style_final_name)
-
-
-
-
-
-
-
-if __name__ == '__main__':
-    main(True)