Mattijs Hoitink avatar Mattijs Hoitink committed 54c6392


With both BUILD_LOC and SOURCE_LOC exposed d can be imported into other
projects and configured to perform it's magic. SOURCE_LOC defaults to '.'
as to not break default behaviour.

Comments (0)

Files changed (1)

 up = lambda p: j(*os.path.split(p)[:-1])
 dirname = lambda p: os.path.basename(os.path.abspath(p))
 BUILD_LOC = './build'
 INDEX_PRE = '''\
 <!DOCTYPE html>
         target = path
-    return j(BUILD_LOC, target.rsplit('.', 1)[0])
+    return j(BUILD_LOC, target.rsplit(SOURCE_LOC, 1)[0])
 def _get_project_title():
     if os.path.isfile('title'):
         with open('title') as f:
-        current = dirname('.').lower()
+        current = dirname(SOURCE_LOC).lower()
         if current not in ['doc', 'docs', 'documentation']:
             return current
-            return dirname('..').lower()
+            return dirname(j(SOURCE_LOC, '..')).lower()
 def _find_chapters():
-    for filename in os.listdir('.'):
+    for filename in os.listdir(SOURCE_LOC):
         name, ext = os.path.splitext(filename)
         if ext in ['.markdown', '.md', '.mdown']:
             if name not in ['footer', 'index']:
 def _get_fallback_title(path):
-    title = path.split('.', 1)[0]
+    title = path.split(SOURCE_LOC, 1)[0]
     if '-' in title and all([c in '0123456789' for c in title.split('-', 1)[0]]):
         title = title.split('-', 1)[1]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.