Git Product home page Git Product logo

xdoc's Introduction

Xdoc

What is Xdoc

Xdoc is a simple documentation language for software projects. It focuses on, but is not limited to, Eclipse plugin projects, generating a fully functional Eclipse help plugin. We support code chunks and also code references to java classes in the class path. Error markers in the editor show the developers if any links to classes are broken.

Why Xdoc

In various projects the documentation is a rather tedious task. Choosing a language like LaTeX, it is possible to generate neat PDF documents. But as Latex is a rather complicated language, you have to learn it before you can actually write your documentation. In addition LaTeX is optimized for printed documents and does not feature HTML output. Of course there exists tooling for generating HTML documents, the structure of those was simply not what we where looking for.

Another possibility would be to use a language like textile. HTML can be generated easily. It is also possible to generate PDF or docbook XML files. It gives the writer of the documentation much freedom in formatting, like changing font color for paragraphs, changing the text alignment or even controlling the output HTML indirectly by setting spans’ attributes like id or class. These freedoms can be nice, but for a concise documentation languages they are not needed. They can even have a negative influence as an inconsistent style in a documentation can distract the reader.

Concepts

So we started to develop a language with several concepts in mind. First: No freedom. The language is easy and simple. You can not adjust the design of the output in an Xdoc file. We think design should be made using CSS and also provide two ready to use CSS files, one to adjust the look of code blocks, the other to adjust the rest (e.g. headlines, tables, lists, …). PDF files are generated via LaTeX. This way you don’t need to layout the documents yourself as LaTeX is a highly optimized typesetting language. Currently we use Koma Script as documentclass, providing a modern layout for the documents. HTML files are generated directly. We also generate a toc.xml and a plugin.xml. This way the project can be exported directly as an Eclipse help plugin.

A description of the basic concepts follows.

Structure and Formatting

Xdoc files can contain different top level elements, allowing to split up documents over different files. Top level elements can be:
document[title] defining a document with the given title that can be compiled
chapter:id[title] a chapter that can be referenced by chapter-ref[id]
section:id[title] a section that can be referenced by section-ref[id]
section2:id[title] a section2 that can be referenced by section2-ref[id]

Of course you are not forced to use this concepts and can write all your chapters and sections in one file. The maximum depth for sections is section4:id[title].

If you want to start a new paragraph use two newlines.

I said, we don’t allow for formatting. But Xdoc features the emphasis concept. Using em[some text] you can denote parts that have to be emphasized. This does not mean, that it will be nessecarily set in italics.

Code

Typically in the documentation of a software project you drop a line of code here and there. To support this we have the code[language][some code] concept. Like in textile the style is guessed from the input. If you write it it in one line it will be typeset as inline (i.e. span in HTML). If you have newlines in your code it will be typeset as a block. The language of a code element can be defined at the beginning of the document as a list of keywords. Keywords occurring in a code block will be highlit in the output.

We also allow for code references to Java. These are real links and break when a referenced class name is changed. This behaviour enforces a consistent documentation and is of course supported by the tooling.

Lists and Tables

Of course we have lists and tables. Lists can be ordered (ol[<items>]) or unordered (ul[<items>]). Both contain some items which can be enumerated with <code>item[some item text].

A table is defined by table[<rows>] and contains rows (tr[<cells>] which in turn contain the table data entries (td[some text]). Each row must contain the same number of data entries.

Links

Like in HTML we support for hyperlinks (link[<url>][some text], the text can also be obmitted if you want the link to be directly readable) and references (ref:id[some text]</text>, where text can be omitted again to autoinsert some alias for the referenced element, e.g., section §2). References can be seen as internal links and can target any kind of element that has an id. Those are all section types, images and anchors (<code>a[id]. Anchors are special elements that do not contribute to the visible output but only serve as reference targets.

For the PDF output to be meaningful when it is printed we add a list of links at the end of the document.

TODOs

As another concept we also added TODOs. These are ignored in Eclipse help output but inserted as orange boxes in the PDF. Also a list of TODOs is inserted at the end of the document. You can switch the typesetting of TODOs on and off.

Xdoc and Xtext

Xdoc is based on Xtext 2.0 git master branch (git://git.eclipse.org/gitroot/tmf/org.eclipse.xtext.git). As Xtext 2.0 is currently under development Xdoc can be subject to API changes. If you want to import Xdoc to your Eclipse workspace I recommend you follow the workspace setup guide at the Xtext homepage .

Funding

This project is funded by the Federal Ministry of Education and Research, Germany.

xdoc's People

Contributors

ckulla avatar ckullabosch avatar dhuebner avatar holgerschill avatar lorenzobettini avatar rvonmassow avatar ujhelyiz avatar

Stargazers

 avatar

Watchers

 avatar  avatar

xdoc's Issues

Add possibility to add an image to the title page of printable documentation.

The title page of documentation generated from xDoc via Latex looks very "puristic". A nice option would be to be able to add some image, e.g. a logo, a screenshot or some other picture (maybe a photo of the author :-) ). This is very flexible and allows some individualization.

In latex, this could be converted to:

\usepackage{titlepic} <== as part of the usepackage list

...

\titlepic{\includegraphics{images/niceTitleImage.png}} <== after the \author... line

Execute pdfLatex only if it is installed

I would like to be able to ignore a missing installation of pdfLatex. Otherwise the entire build of a project will fail due to a missing pdfLatex installation. I work with Linux and Windows. On Linux pdfLatex is installed, on windows it is not. I still want the windows build to succeed.

Improve layout of figures for latex output.

For latex output, the width of images (i.e. figures) is computed by the helper class PDFImageUtil. In my environment, this always ends up with a width of 0.7 fraction of textwidth. How can this be influenced? I guess it would be useful to provide an optional DSL extension to xDoc to specify a width proposal for a figure (e.g., as a fraction of the textwidth).

Remove xpand based generators

Right now the project structure is somewhat confusing, as there is a generator project, but the generator sare actually in the main project. My understanding is that the generator project provides old versions of the generators (written in xpand). Are those sill required? I would like to remove them to have a cleaner project structure.

Add support of a glossary

The model and xtext grammar already have elements for a glossary, but imho it is not fully implemented. Needs some investigation.

Improve layout of tables for latex output.

With the xDoc=>html conversion, table are layouted by the html engine, which looks quite nice. For xDoc=>latex, a table is layouted by the xDoc=>latex converter with equally sized columns, which often looks ugly (esp. if some columns contain much less data than others). This should be improved.

How? Maybe there should be a heuristics "narrow column detector", which detects small columns and give them a width which is 50% of a "normal" column. Or the xdoc DSL could be extended to give some hints by the user. Don't know which option is better.

Cleanup the tests

The tests are currently in a bad condition. This should be fixed so new features can be tested easily.

Build with travis

The project should have a continuous build with travis (easy to setup).

Make the generators more flexible

The generators should use composite objects for certain tasks (configured by guice). One can then for example provide a company style title page, header and footer.

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.