hideki nara avatar hideki nara committed cb96fc4

swith to use title or not ( for doc to be included in another doc )

Comments (0)

Files changed (2)

src/schema2rst/management/commands/schemadoc.py

             default='',
             help=u'Django Databases index name'),
 
+        make_option('--with_title',
+            action='store',
+            dest='with_title',
+            default=True,
+            help=u'True(default) if using title'),
+
         make_option('--encoding',
             action='store',
             dest='encoding',
             else  u"Database Scheme:%s" % options['db']
 
         pattern = [ r'^%s'%p for p in options['apps'].split(',') if len(p)>0 ]
+        config['with_title'] = str(options['with_title']) == 'True'
         schema2rst.main(config,pattern)
 
     def handle_help(self  ,*args, **options):

src/schema2rst/schema2rst.py

     url = 'mysql://%s:%s@%s/%s' % \
         (config['user'], config['passwd'], config['host'], config['db'])
 
-    title = config['title'] if config.has_key('title') \
-          else u'Schema: %s' % config['db']
-
     engine = sqlalchemy.create_engine(url)
 
     insp = inspectors.create_inspector(engine)
 
     sphinx = SphinxDocGenerator()
-    sphinx.header(title)
+
+    if config.get('with_title',True):
+        title = config['title'] if config.has_key('title') \
+          else u'Schema: %s' % config['db']
+        sphinx.header(title)
 
     for table in insp.get_tables():
          
             #:table name filters
             if sum([re.search(p,table['name']) != None for p in patterns ])==0:
                 continue
+        
 
-        # FIXME: support fullname (table comment)
-        if table['fullname']:
-            sphinx.header("%s (%s)" % (table['fullname'], table['name']), '-')
-        else:
-            sphinx.header(table['name'], '-')
+        if config.get('with_title',True):
+            # FIXME: support fullname (table comment)
+            if table['fullname']:
+                sphinx.header("%s (%s)" % (table['fullname'], table['name']), '-')
+            else:
+                sphinx.header(table['name'], '-')
 
         headers = ['Fullname', 'Name', 'Type', 'NOT NULL',
                    'PKey', 'Default', 'Comment']
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 ProjectModifiedEvent.java.
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.