Johannes Emerich  committed de4728e

Add configuration to use the requirejs parser

  • Participants
  • Parent commits ae04348
  • Branches default

Comments (0)

Files changed (3)

File coffeedomain/README.rst

   coffee_src_dir = os.path.abspath('../')
+Depending on the module system you use, you might want to change the coffeedoc
+parser from its default ``commonjs`` to ``requirejs``::
+  coffee_src_parser = 'requirejs'
 Finally, if your project is primarily CoffeeScript, you might want to
 define the primary domain as well::

File coffeedomain/sphinxcontrib/coffeedomain/

 def setup(app):
     app.add_config_value('coffee_src_dir', None, 'env')
+    app.add_config_value('coffee_src_parser', None, 'env')
     from .domain import CoffeeDomain
     from . import documenters as doc

File coffeedomain/sphinxcontrib/coffeedomain/

         filename= self.modname + '.coffee'
         modules = self.env.temp_data.setdefault('coffee:docgen', {})
         basedir = self.env.config.coffee_src_dir
+        parser  = self.env.config.coffee_src_parser or 'commonjs'
         if filename not in modules:
-            docgen = Popen(['coffeedoc', '--stdout', '--renderer', 'json',
-                            filename],
+            gencmd = ['coffeedoc', '--stdout', '--renderer', 'json', '--parser',
+                      parser, filename]
+            docgen = Popen(gencmd,
                            cwd=basedir, stdout=PIPE)
             module_data = json.load(docgen.stdout)[0]['module']
-            print "ran coffeedoc --stdout --renderer json %s" % filename
+            print "ran %s" % ' '.join(gencmd)
             modules[filename] = StubObject('module', module_data)
         return modules[filename]