]> Shamusworld >> Repos - ardour-manual/blob - build.py
Added metadata to the PDF
[ardour-manual] / build.py
1 #!/usr/bin/python3
2 #
3 # Script to take the master document and ancillary files and create the
4 # finished manual/website.
5 #
6 # by James Hammons
7 # (C) 2017 Underground Software
8 #
9 # Contributors: Ed Ward
10 #
11
12 # Remnants (could go into the master document as the first header)
13
14 import os
15 import re
16 import shutil
17 import argparse
18 import datetime
19
20 # Global vars
21 global_bootstrap_path = '/bootstrap-3.3.7'
22 global_page_title = 'The Ardour Manual'
23 global_site_dir = './website/'
24 global_githuburl = 'https://github.com/Ardour/manual/edit/master/include/'
25 global_screen_template = 'page-template.html'
26 global_onepage_template = 'onepage-template.html'
27 global_pdf_template = 'pdf-template.html'
28 global_master_doc = 'master-doc.txt'
29 from datetime import datetime
30 global_today_iso = datetime.today().strftime('%Y-%m-%dT%H%M%S')
31 global_today = datetime.today().strftime('%Y-%m-%d')
32
33 # This matches all *non* letter/number, ' ', '.', '-', and '_' chars
34 cleanString = re.compile(r'[^a-zA-Z0-9 \._-]+')
35 # This matches new 'unbreakable' links, up to the closing quote or anchor
36 findLinks = re.compile(r'"@@[^#"]*[#"]')
37
38 #
39 # Create an all lowercase filename without special characters and with spaces
40 # replaced with dashes.
41 #
42 def MakeFilename(s):
43         global cleanString
44         # Clean up the file name, removing all non letter/number or " .-_" chars.
45         # Also, convert to lower case and replace all spaces with dashes.
46         fn = cleanString.sub('', s).lower().replace(' ', '-')
47         # Double dashes can creep in from the above replacement, so we check for
48         # that here.
49         fn = fn.replace('--', '-')
50
51         return fn
52
53
54 #
55 # Parse headers into a dictionary
56 #
57 def ParseHeader(fileObj):
58         header = {}
59
60         while (True):
61                 hdrLine = fileObj.readline().rstrip('\r\n')
62
63                 # Break out of the loop if we hit the end of header marker
64                 if hdrLine.startswith('---'):
65                         break
66
67                 # Check to see that we have a well-formed header construct
68                 match = re.findall(': ', hdrLine)
69
70                 if match:
71                         # Parse out foo: bar pairs & put into header dictionary
72                         a = re.split(': ', hdrLine, 1)
73                         header[a[0]] = a[1]
74
75         return header
76
77
78 #
79 # Turn a "part" name into an int
80 #
81 def PartToLevel(s):
82         level = -1
83         lvl = {'part': 0, 'chapter': 1, 'subchapter': 2}
84         if s in lvl:
85                 return lvl[s]
86         else:
87                 return -1
88
89
90 #
91 # Converts a integer to a Roman numeral
92 #
93 def num2roman(num):
94         num_map = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')]
95         roman = ''
96
97         while num > 0:
98                 for i, r in num_map:
99                         while num >= i:
100                                 roman += r
101                                 num -= i
102
103         return roman
104
105 #
106 # Capture the master document's structure (and content, if any) in a list
107 #
108 def GetFileStructure():
109         fs = []
110         fnames = [None]*6
111         content = ''
112         grab = False
113         mf = open(global_master_doc)
114
115         for ln in mf:
116                 if ln.startswith('---'):
117                         # First, stuff any content that we may have read into the current
118                         # header's dictionary
119                         if grab:
120                                 fs[-1]['content'] = content
121                                 grab = False
122                                 content = ''
123
124                         # Then, get the new header and do things to it
125                         hdr = ParseHeader(mf)
126                         level = PartToLevel(hdr['part'])
127                         hdr['level'] = level
128                         fnames[level] = MakeFilename(hdr['title'])
129
130                         # Ickyness--user specified URIs
131                         if 'uri' in hdr:
132                                 hdr['filename'] = hdr['uri']
133                         else:
134                                 fullName = ''
135
136                                 for i in range(level + 1):
137                                         fullName = fullName + fnames[i] + '/'
138
139                                 # Strip trailing '/' on filename
140                                 hdr['filename'] = fullName[:-1]
141
142                         fs.append(hdr)
143
144                         if ('include' not in hdr) and (level > 0):
145                                 grab = True
146                 else:
147                         if grab:
148                                 content = content + ln
149
150         # Catch the last file, since it would be missed above
151         if grab:
152                 fs[-1]['content'] = content
153
154         mf.close()
155         return fs
156
157
158 #
159 # Determine if a particular node has child nodes
160 #
161 def HaveChildren(fs, pos):
162         # If we're at the end of the list, there can be no children
163         if pos == len(fs) - 1:
164                 return False
165
166         # If the next node is at a lower level than the current node, we have
167         # children.
168         if fs[pos]['level'] < fs[pos + 1]['level']:
169                 return True
170
171         # Otherwise, no children at this node.
172         return False
173
174
175 #
176 # Get the children at this level, and return them in a list
177 #
178 def GetChildren(fs, pos):
179         children = []
180         pos = pos + 1
181         childLevel =  fs[pos]['level']
182
183         while fs[pos]['level'] >= childLevel:
184                 if fs[pos]['level'] == childLevel:
185                         children.append(pos)
186
187                 pos = pos + 1
188
189                 # Sanity check
190                 if pos == len(fs):
191                         break
192
193         return children
194
195
196 #
197 # Get the parent at this level
198 #
199 def GetParent(fs, pos):
200         thisLevel =  fs[pos]['level']
201         pos = pos - 1
202
203         while pos >= 0 and fs[pos]['level'] >= thisLevel:
204                 pos = pos - 1
205
206         return pos
207
208
209 #
210 # Change the hierarchy of titles : h1->hn, h2->hn+1, etc... n being delta-1
211 #
212 def reheader(txt, delta):
213         for i in range(6, 0, -1):
214                 txt = txt.replace('<h' + str(i),'<h' + str(i+delta))
215                 txt = txt.replace('</h' + str(i),'</h' + str(i+delta))
216         return txt
217
218
219 #
220 # Creates the BreadCrumbs
221 #
222 def GetBreadCrumbs(fs, pos):
223         breadcrumbs = '<li class="active">'+ fs[pos]['title'] + '</li>'
224
225         while pos >= 0:
226                 pos = GetParent(fs, pos)
227
228                 if pos >= 0:
229                         breadcrumbs='<li><a href="/' + fs[pos]['filename'] + '/">'+ fs[pos]['title'] + '</a></li>'+ breadcrumbs
230
231         breadcrumbs = '<ul class="breadcrumb"><li><a href="/toc/index.html">Home</a></li>' + breadcrumbs + '</ul>'
232         return breadcrumbs
233
234
235 #
236 # Make an array of children attached to each node in the file structure
237 # (It's a quasi-tree structure, and can be traversed as such.)
238 #
239 def FindChildren(fs):
240         childArray = []
241
242         for i in range(len(fs)):
243                 if HaveChildren(fs, i):
244                         childArray.append(GetChildren(fs, i))
245                 else:
246                         childArray.append([])
247
248         return childArray
249
250
251 #
252 # Make an array of the top level nodes in the file structure
253 #
254 def FindTopLevelNodes(fs):
255         level0 = []
256
257         for i in range(len(fs)):
258                 if fs[i]['level'] == 0:
259                         level0.append(i)
260
261         return level0
262
263
264 #
265 # Find all header links and create a dictionary out of them
266 #
267 def FindInternalLinks(fs):
268         linkDict = {}
269
270         for hdr in fs:
271                 if 'link' in hdr:
272                         linkDict['"@@' + hdr['link'] + '"'] = '"/' + hdr['filename'] + '/"'
273                         linkDict['"@@' + hdr['link'] + '#'] = '"/' + hdr['filename'] + '/index.html#'
274
275         return linkDict
276
277 #
278 # Same as above, but create anchors (for the one-page version)
279 #
280 def FindInternalAnchors(fs):
281         linkDict = {}
282
283         for hdr in fs:
284                 if 'link' in hdr:
285                         linkDict['"@@' + hdr['link'] + '"'] = '"#' + hdr['link'] + '"'
286                         linkDict['"@@' + hdr['link'] + '#'] = '"#' + hdr['link'] + '"'
287
288         return linkDict
289
290
291 #
292 # Internal links are of the form '@@link-name', which are references to the
293 # 'link:' field in the part header. We have to find all occurrences and replace
294 # them with the appropriate link.
295 #
296 def FixInternalLinks(links, content, title):
297         global findLinks
298         match = findLinks.findall(content)
299         missing = []
300
301         if len(match) > 0:
302                 for s in match:
303                         if s in links:
304                                 content = content.replace(s, links[s])
305                         else:
306                                 missing.append(s)
307
308         # Report missing link targets to the user (if any)
309         if len(missing) > 0:
310                 print('\nMissing link target' + ('s' if len(missing) > 1 else '') + ' in "' + title + '":')
311
312                 for s in missing:
313                         print('  ' + s)
314
315                 print()
316
317         return content
318
319
320 #
321 # Recursively build a list of links based on the location of the page we're
322 # looking at currently
323 #
324 def BuildList(lst, fs, pagePos, cList):
325         content = '<ul>\n'
326
327         for i in range(len(lst)):
328                 curPos = lst[i]
329                 nextPos = lst[i + 1] if i + 1 < len(lst) else len(fs)
330
331                 active = ' class=active' if curPos == pagePos else ''
332                 menuTitle = fs[curPos]['menu_title'] if 'menu_title' in fs[curPos] else fs[curPos]['title']
333                 content = content + '\t<li' + active + '><a href="/' + fs[curPos]['filename'] + '/">' + menuTitle + '</a></li>\n'
334
335                 # If the current page is our page, and it has children, enumerate them
336                 if curPos == pagePos:
337                         if len(cList[curPos]) > 0:
338                                 content = content + BuildList(cList[curPos], fs, -1, cList)
339
340                 # Otherwise, if our page lies between the current one and the next,
341                 # build a list of links from those nodes one level down.
342                 elif (pagePos > curPos) and (pagePos < nextPos):
343                         content = content + BuildList(cList[curPos], fs, pagePos, cList)
344
345         content = content + '</ul>\n'
346
347         return content
348
349
350 #
351 # Builds the sidebar for the one-page version
352 #
353 def BuildOnePageSidebar(fs):
354
355         content = '\n\n<ul class="toc" style="white-space:nowrap;">\n'
356         lvl = 0
357         levelNums = [0]*3
358
359         for i in range(len(fs)):
360                 # Handle Part/Chapter/subchapter numbering
361                 level = fs[i]['level']
362                 if level < 2:
363                         levelNums[2] = 0
364                 levelNums[level] = levelNums[level] + 1;
365                 j = level
366                 txtlevel = ''
367                 while j > 0:  #level 0 is the part number which is not shown
368                         txtlevel = str(levelNums[j]) + '.' + txtlevel
369                         j = j-1
370                 if len(txtlevel) > 0:
371                         txtlevel = txtlevel[:-1] + ' - '
372
373                 if 'link' in fs[i]:
374                         anchor = fs[i]['link']
375                 else:
376                         anchor = fs[i]['filename']
377
378                 while lvl < level:
379                         content = content + '<ul style="white-space:nowrap;">\n'
380                         lvl = lvl + 1
381                 while lvl > level:
382                         content = content + '</ul>\n'
383                         lvl = lvl - 1
384
385                 content = content + '<li><a href="#' + anchor + '">' + txtlevel + fs[i]['title'] + '</a></li>\n'
386
387         content = content + '</ul>\n'
388
389         return content
390
391
392 #
393 # Create link sidebar given a position in the list.
394 #
395 def CreateLinkSidebar(fs, pos, childList):
396
397         # Build the list recursively from the top level nodes
398         content = BuildList(FindTopLevelNodes(fs), fs, pos, childList)
399         # Shove the TOC link and one file link at the top...
400         active = ' class=active' if pos<0 else ''
401         content = content.replace('<ul>','<ul><li' + active + '><a href="/toc/">Table of Contents</a></li>',1)
402
403         return content
404
405 # Preliminaries
406
407 # We have command line arguments now, so deal with them
408 parser = argparse.ArgumentParser(description='A build script for the Ardour Manual')
409 parser.add_argument('-v', '--verbose', action='store_true', help='Display the high-level structure of the manual')
410 parser.add_argument('-q', '--quiet', action='store_true', help='Suppress all output (overrides -v)')
411 parser.add_argument('-d', '--devmode', action='store_true', help='Add content to pages to help developers debug them')
412 parser.add_argument('-n', '--nopdf', action='store_true', help='Do not automatically generate PDF from content')
413 args = parser.parse_args()
414 verbose = args.verbose
415 quiet = args.quiet
416 devmode = args.devmode
417 nopdf = args.nopdf
418
419 if quiet:
420         verbose = False
421
422 level = 0
423 fileCount = 0
424 levelNums = [0]*3
425 lastFile = ''
426 page = ''
427 onepage = ''
428 pdfpage = ''
429 toc = ''
430 pageNumber = 0
431
432
433
434 if not quiet and devmode:
435         print('Devmode active: scribbling extra junk to the manual...')
436
437 if os.access(global_site_dir, os.F_OK):
438         if not quiet:
439                 print('Removing stale HTML data...')
440
441         shutil.rmtree(global_site_dir)
442
443 shutil.copytree('./source', global_site_dir)
444
445
446 # Read the template, and fix the stuff that's fixed for all pages
447 temp = open(global_screen_template)
448 template = temp.read()
449 temp.close()
450 template = template.replace('{{page.bootstrap_path}}', global_bootstrap_path)
451 template = template.replace('{{page.page_title}}', global_page_title)
452
453 # Same as above, but for the One-page version
454 temp = open(global_onepage_template)
455 onepage = temp.read()
456 temp.close()
457 onepage = onepage.replace('{{page.bootstrap_path}}', global_bootstrap_path)
458 onepage = onepage.replace('{{page.page_title}}', global_page_title)
459
460 if not nopdf:
461         # Same as above, but for the PDF version
462         temp = open(global_pdf_template)
463         pdfpage = temp.read()
464         temp.close()
465         pdfpage = pdfpage.replace('{{page.page_title}}', global_page_title)
466
467 # Parse out the master document's structure into a dictionary list
468 fileStruct = GetFileStructure()
469
470 # Build a quasi-tree structure listing children at level + 1 for each node
471 nodeChildren = FindChildren(fileStruct)
472
473 # Create a dictionary for translation of internal links to real links
474 links = FindInternalLinks(fileStruct)
475 oplinks = FindInternalAnchors(fileStruct)
476
477 if not quiet:
478         print('Found ' + str(len(links)) + ' internal link target', end='')
479         print('.') if len(links) == 1 else print('s.')
480
481 if not quiet:
482         master = open(global_master_doc)
483         firstLine = master.readline().rstrip('\r\n')
484         master.close()
485
486         if firstLine == '<!-- exploded -->':
487                 print('Parsing exploded file...')
488         elif firstLine == '<!-- imploded -->':
489                 print('Parsing imploded file...')
490         else:
491                 print('Parsing unknown type...')
492
493 # Here we go!
494
495 for header in fileStruct:
496         fileCount = fileCount + 1
497         content = ''
498         more = ''
499
500         lastLevel = level
501         level = header['level']
502
503         # Handle Part/Chapter/subchapter numbering
504         if level < 2:
505                 levelNums[2] = 0
506         levelNums[level] = levelNums[level] + 1;
507
508         # This is totally unnecessary, but nice; besides which, you can capture
509         # the output to a file to look at later if you like :-)
510         if verbose:
511                 for i in range(level):
512                         print('\t', end='')
513
514                 if (level == 0):
515                         print('\nPart ' + num2roman(levelNums[0]) + ': ', end='')
516                 elif (level == 1):
517                         print('\n\tChapter ' + str(levelNums[1]) + ': ', end='')
518
519                 print(header['title'])
520
521         # Handle TOC scriblings...
522         if level == 0:
523                 toc = toc + '<h2>Part ' + num2roman(levelNums[level]) + ': ' + header['title'] + '</h2>\n';
524         elif level == 1:
525                 toc = toc + '\t<p class="chapter">Ch. ' + str(levelNums[level]) + ':&nbsp;&nbsp;<a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
526         elif level == 2:
527                 toc = toc + '\t\t<p class="subchapter"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
528
529         # Handle one-page and PDF titles...
530         opl = ''
531         if 'link' in header:
532                 opl = ' id="' + header['link'] + '"'
533         else:
534                 opl = ' id="' + header['filename'] + '"'
535         oph = '<h' + str(level+1) + ' class="clear"' + opl +'>' + header['title'] + '</h' + str(level+1) + '>\n';
536
537
538         # Make the 'this thing contains...' stuff
539         if HaveChildren(fileStruct, pageNumber):
540                 pages = GetChildren(fileStruct, pageNumber)
541
542                 for pg in pages:
543                         more = more + '<li>' + '<a href="/' + fileStruct[pg]['filename'] + '/">' + fileStruct[pg]['title'] + '</a>' + '</li>\n'
544
545                 more = '<div id=subtopics>\n' + '<h2>This section contains the following topics:</h2>\n' + '<ul>\n' + more + '</ul>\n' + '</div>\n'
546
547         parent = GetParent(fileStruct, pageNumber)
548
549         # Make the 'Previous', 'Up' & 'Next' content
550         nLink = ''
551         pLink = ''
552         uLink = ''
553
554         if pageNumber > 0:
555                 pLink = '<li class="previous"><a title="' + fileStruct[pageNumber - 1]['title'] + '" href="/' + fileStruct[pageNumber - 1]['filename'] + '/" class="previous"> &larr; Previous </a></li>'
556
557         if pageNumber < len(fileStruct) - 1:
558                 nLink = '<li class="next"><a title="' + fileStruct[pageNumber + 1]['title'] + '" href="/' + fileStruct[pageNumber + 1]['filename'] + '/" class="next"> Next &rarr; </a></li>'
559
560         if level > 0:
561                 uLink = '<li><a title="' + fileStruct[parent]['title'] + '" href="/' + fileStruct[parent]['filename'] + '/" class="active"> &uarr; Up </a></li>'
562         else:
563                 uLink = '<li><a title="Ardour Table of Contents" href="/toc/index.html" class="active"> &uarr; Up </a></li>'
564
565         prevnext = '<ul class="pager">' + pLink + uLink + nLink + '</ul>'
566
567         # Make the BreadCrumbs
568         breadcrumbs = GetBreadCrumbs(fileStruct, pageNumber)
569
570         # Create the link sidebar
571         sidebar = CreateLinkSidebar(fileStruct, pageNumber, nodeChildren)
572
573         # Parts DO NOT have any content, they are ONLY an organizing construct!
574         # Chapters, subchapters, sections & subsections can all have content,
575         # but the basic fundamental organizing unit WRT content is still the
576         # chapter.
577         githubedit = ''
578
579         if level > 0:
580                 if 'include' in header:
581                         srcFile = open('include/' + header['include'])
582                         githubedit = '<span style="float:right;"><a title="Edit in GitHub" href="' + global_githuburl + header['include'] + '"><img src="/images/github.png" alt="Edit in GitHub"/></a></span>'
583                         content = srcFile.read()
584                         srcFile.close()
585
586                         # Get rid of any extant header in the include file
587                         # (once this is accepted, we can nuke this bit, as content files
588                         # will not have any headers or footers in them)
589                         content = re.sub('---.*\n(.*\n)*---.*\n', '', content)
590                         content = content.replace('{% children %}', '')
591
592                 else:
593                         if 'content' in header:
594                                 content = header['content']
595                         else:
596                                 content = '[something went wrong]'
597
598         # Add header information to the page if in dev mode
599         if devmode:
600                 devnote ='<aside style="background-color:indigo; color:white;">'
601
602                 if 'filename' in header:
603                         devnote = devnote + 'filename: ' + header['filename'] + '<br>'
604
605                 if 'include' in header:
606                         devnote = devnote + 'include: ' + header['include'] + '<br>'
607
608                 if 'link' in header:
609                         devnote = devnote + 'link: ' + header['link'] + '<br>'
610
611                 content = devnote + '</aside>' + content
612
613         # ----- One page and PDF version -----
614
615         # Fix up any internal links
616         opcontent = FixInternalLinks(oplinks, content, header['title'])
617         opcontent = reheader(opcontent, 2)
618
619         # Set up the actual page from the template
620         onepage = onepage.replace('{{ content }}', oph + '\n' + opcontent + '\n{{ content }}')
621         if not nopdf:
622                 pdfpage = pdfpage.replace('{{ content }}', oph + '\n' + opcontent + '\n{{ content }}')
623
624         # ----- Normal version -----
625
626         # Fix up any internal links
627         content = FixInternalLinks(links, content, header['title'])
628
629         # Set up the actual page from the template
630         if 'style' not in header:
631                 page = re.sub("{% if page.style %}.*\n.*\n{% endif %}.*\n", "", template)
632         else:
633                 page = template.replace('{{page.style}}', header['style'])
634                 page = page.replace('{% if page.style %}', '')
635                 page = page.replace('{% endif %}', '')
636
637         page = page.replace('{{ page.title }}', header['title'])
638         page = page.replace('{% tree %}', sidebar)
639         page = page.replace('{% prevnext %}', prevnext)
640         page = page.replace('{% githubedit %}', githubedit)
641         page = page.replace('{% breadcrumbs %}', breadcrumbs)
642         page = page.replace('{{ content }}', content + more)
643
644         # Create the directory for the index.html file to go into (we use makedirs,
645         # because we have to in order to accomodate the 'uri' keyword)
646         os.makedirs(global_site_dir + header['filename'], 0o775, exist_ok=True)
647
648         # Finally, write the file!
649         destFile = open(global_site_dir + header['filename'] + '/index.html', 'w')
650         destFile.write(page)
651         destFile.close()
652
653         # Save filename for next header...
654         lastFile = header['filename']
655         pageNumber = pageNumber + 1
656
657 # Finally, create the TOC
658 sidebar = CreateLinkSidebar(fileStruct, -1, nodeChildren)
659
660 page = re.sub("{% if page.style %}.*\n.*\n{% endif %}.*\n", "", template)
661 page = page.replace('{{ page.title }}', 'Ardour Table of Contents')
662 page = page.replace('{% tree %}', sidebar)
663 page = page.replace('{{ content }}', toc)
664 page = page.replace('{% prevnext %}', '')
665 page = page.replace('{% githubedit %}', '')
666 page = page.replace('{% breadcrumbs %}', '')
667
668 os.mkdir(global_site_dir + 'toc', 0o775)
669 tocFile = open(global_site_dir + 'toc/index.html', 'w')
670 tocFile.write(page)
671 tocFile.close()
672
673 # Create the one-page version of the documentation
674 onepageFile = open(global_site_dir + 'ardourmanual.html', 'w')
675 opsidebar = BuildOnePageSidebar(fileStruct) # create the link sidebar
676 onepage = onepage.replace('{% tree %}', opsidebar)
677 onepage = onepage.replace('{{ content }}', '') # cleans up the last spaceholder
678 onepageFile.write(onepage)
679 onepageFile.close()
680
681 if not nopdf:
682         if not quiet:
683                 print('Generating the PDF...')
684
685         # Create the PDF version of the documentation
686         pdfpage = pdfpage.replace('{% tree %}', opsidebar) # create the TOC
687         pdfpage = pdfpage.replace('{{ content }}', '') # cleans up the last spaceholder
688         pdfpage = pdfpage.replace('{{ today }}', global_today)
689         pdfpage = pdfpage.replace('{{ today_iso }}', global_today_iso)
690         pdfpage = pdfpage.replace('src="/images/', 'src="images/') # makes images links relative
691         pdfpage = pdfpage.replace('url(\'/images/', 'url(\'images/') # CSS images links relative
692         # Write it to disk (optional, can be removed)
693         pdfpageFile = open(global_site_dir + 'pdf.html', 'w')
694         pdfpageFile.write(pdfpage)
695         pdfpageFile.close()
696
697         # Generating the actual PDF with weasyprint (https://weasyprint.org/)
698         from weasyprint import HTML
699         from weasyprint.fonts import FontConfiguration
700         html_font_config = FontConfiguration()
701         doc = HTML(string = pdfpage, base_url = global_site_dir)
702         doc.write_pdf(global_site_dir + 'manual.pdf', font_config = html_font_config)
703
704 if not quiet:
705         print('Processed ' + str(fileCount) + ' files.')
706