Git Product home page Git Product logo

documentalist's Introduction

Documentalist Build Status

Documentalist is an extensible documentation generator that is meant to support multiple source languages, documentation syntaxes, and output formats.

The project includes both a library and executable component:

  • The library is the main focus of development, and will include most of the logic. The goal is to support embedded documentation generation capabilities in other programs.
  • The executable is intended to be a simple front-end that automatically hooks up stages for generating pretty documentation output from a chosen source language.

Stages

The architecture is split into three major stages:

  1. A SourceParser locates documentation comments and the declarations to which they're attached. Currently, there's only one SourceParser, built on LibClang.
  2. A CommentParser interprets declarations and comment texts according to a predefined syntax, and creates a language-independent AST. Currently, there's only one CommentParser, which interprets TomDoc style comments.
  3. A Writer generates pretty output, like the final result of Doxygen or Appledoc.

Each stage should depend only on the previous, such that the CommentParser has no knowledge of the source language, and the Writer has no knowledge of the documentation syntax or source language.

Building Concrete Implementations

To make a new implementation for a stage, simply create an instance of the respective typeclass.

If the implementation is meant to be part of Documentalist proper, make sure to follow the existing module structure, and add the new module(s) to the package description.

Getting Started

brew install --with-clang llvm
cabal install --only-dependencies
cabal configure
cabal build

If you want to run the tests:

cabal install --only-dependencies --enable-tests
cabal configure --enable-tests
cabal build
cabal test

documentalist's People

Contributors

jspahrsummers avatar mxswd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

documentalist's Issues

Make Clang functions pure

Many of them do not actually have observable side-effects, and so could become pure at the FFI level or with unsafePerformIO.

Variadic arguments

It's probably sufficient to just treat them as a parameter with the name and an unknown type.

Build problems

I'm having trouble building documentalist. I've installed llvm 3.3 through homebrew (keg-only).

Then I ran

cabal install --only-dependencies
cabal configure --extra-include-dirs=/usr/local/opt/lvvm/include --extra-lib-dirs=/usr/local/opt/llvm/lib
cabal build

but I got

Building documentalist-0.1...
Preprocessing library documentalist-0.1...
FFI.hsc:8:10: fatal error: 'clang-c/Index.h' file not found
#include <clang-c/Index.h>
         ^
1 error generated.
compiling dist/build/Text/Documentalist/SourceParser/Clang/FFI_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/Text/Documentalist/SourceParser/Clang/FFI_hsc_make.c -o dist/build/Text/Documentalist/SourceParser/Clang/FFI_hsc_make.o -m64 -fno-stack-protector -m64 -D__GLASGOW_HASKELL__=704 -Ddarwin_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Ddarwin_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -I/usr/lib/llvm-3.4/include -I/opt/boxen/homebrew/include -I/usr/local/include -I/usr/local/opt/lvvm/include -std=c99 -Werror -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/base-4.5.1.0/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/include/

it seems to me that it's not passing the include/lib dir to gcc but I'm not sure how to fix that.

Configure warning

When I run cabal configure, I get this output:

Resolving dependencies...
Configuring documentalist-0.1...

/var/folders/6f/5645chpx4n18jth4zwnm6mym0000gn/T/5587.c:1:12:
     warning: control reaches end of non-void function [-Wreturn-type]
int foo() {}
           ^
1 warning generated.

#imported headers should not be included in the Module

#imports are treated like copy-and-paste right now, which means all of the declarations get added to the Module which is supposed to represent one file.

Assumably Clang has some way to exclude imported declarations from the AST.

Travis needs a new repo for llvm-3.4

LLVM-3.4 is gone from deb http://llvm.org/apt/precise/ llvm-toolchain-precise main.
It now serves 3.5.

We should use the 3.4rc3 snapshot, or the release when it comes out. To get travis building again.

Pass flags to Clang

Right now, it assumes -ObjC and nothing else. Command line users should be able to pass through any arbitrary flags.

parseDocs's type

I think parseDocs though should change from:
parseDocs :: p -> Package (Maybe Comment) -> Either CommentParseException (Package (Maybe DocBlock))
to:
parseDocs :: p -> Package (Maybe Comment) -> Package (Maybe DocBlock)

Because a Package or Module or Declaration can't "fail". Only the Maybe Comment can be unparsable. Then it would be Nothing.

Swift doc generation

This would be really good for Swift. We could do something like Haddock.

I would love to have a Writer that can write to a database for each commit / tag and have a web server serve up the docs.

Filtering out everything that is not public helps people understand the APIs to libraries.

Hopefully, it is just a case of linking the right libraries together.

Allow any MonadIO for SourceParsers

Right now, a SourcePackage can only be parsed in IO. We should consider allowing any MonadIO for maximum flexibility in implementation.

Of course, this may make usage more difficult. I don't know whether it's worth it or not.

Runtime error

// Returns a signal which sends 0 and completes.
+ (RACSignal *)zero;

Fails to parse. fromJust exception.

Clang frontend parses too early

Right now, parsing of the actual source file (via libclang) occurs at the point that newSourceFile is run, which is too early. It shouldn't happen until parse is invoked.

Duplicate documentation found when forward-referencing a class

This header excerpt:

@class RACStream;

/// A block which accepts a value from a RACStream and returns a new instance
/// of the same stream class.
///
/// Setting `stop` to `YES` will cause the bind to terminate after the returned
/// value. Returning `nil` will result in immediate termination.
typedef RACStream * (^RACStreamBindBlock)(id value, BOOL *stop);

/// An abstract class representing any stream of values.
///
/// This class represents a monad, upon which many stream-based operations can
/// be built.
///
/// When subclassing RACStream, only the methods in the main @interface body need
/// to be overridden.
@interface RACStream : NSObject

results in two documented entries for RACStream:

DecNode (Just 
    # Summary: An abstract class representing any stream of values.
    # Description:
    This class represents a monad, upon which many stream-based operations can
    be built.

    When subclassing RACStream, only the methods in the main @interface body need
    to be overridden.
) `RACStream` (Class []) [],
DecLeaf (Just 
    # Summary: A block which accepts a value from a RACStream and returns a new instance
    of the same stream class.
    # Description:
    Setting `stop` to `YES` will cause the bind to terminate after the returned
    value. Returning `nil` will result in immediate termination.
) `RACStreamBindBlock` (TypeAlias `foobar`),
DecNode (Just 
    # Summary: An abstract class representing any stream of values.
    # Description:
    This class represents a monad, upon which many stream-based operations can
    be built.

    When subclassing RACStream, only the methods in the main @interface body need
    to be overridden.
) `RACStream` (Class []) […]

The second one is the only one with inner declarations, so that's what we should keep.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.