Abnaxos / markdown-doclet

A Doclet that allows the use of Markdown in JavaDoc comments.
GNU General Public License v3.0
319 stars 40 forks source link

Gist inline taglet {@gist <gist-id>} #58

Open loddar opened 8 years ago

loddar commented 8 years ago

It would be nice to include a gist inline tag in (javadoc).

Instead of including

/**
 *  Usage:
 *  <script src="https://gist.github.com/loddar/4ae8e534d7647d765b96.js"></script>
 */

(This is working with your doclet, but you need access to Github)

It would be nicer to have something like this which will be loaded from Github and included in generated javadoc.

/**
 *  Usage:
 *  {@gist 4ae8e534d7647d765b96} 
 */

While applying javadoc your doclet should read the Gist from this URI: https://api.github.com/gists/4ae8e534d7647d765b96 :

The result of this REST call will something like this:

{
  // omitted for brevity
   "files": {
    "MyAjUnit0Test.java": {
      "filename": "MyAjUnit0Test.java",
      "type": "text/plain",
      "language": "Java",
      "raw_url": "https://gist.githubusercontent.com/loddar/4ae8e534d7647d765b96/raw/912f0f845e215e1fd3d4ed16ae9aef39b3ce21ad/MyAjUnit0Test.java",
      "size": 390,
      "truncated": false,
      "content": "package com.company.project.aspects;\n\nimport org.failearly.ajunit.AjUnit4Test;\n\n/**\n * ajUnit - Initial Step 0 (create an ajUnit test).\n *\n * Create an JUnit4 Test by creating a test class extending AjUnit4Test.\n *\n * First error message:\n *\n *      ajUnit - Setup Error: Missing setup.\n *      - Please override setup(AjUnitSetup).\n *\n */\npublic class MyAjUnit0Test extends AjUnit4Test {\n}"
    }
  },

// ... rest omitted 

For each file (in this example: MyAjUnit0Test.java) there will be

The result of this inline tag should be:

Usage:
package com.company.project.aspects;

import org.failearly.ajunit.AjUnit4Test;

/**
 * ajUnit - Initial Step 0 (create an ajUnit test).
 *
 * Create an JUnit4 Test by creating a test class extending AjUnit4Test.
 *
 * First error message:
 *
 *      ajUnit - Setup Error: Missing setup.
 *      - Please override setup(AjUnitSetup).
 *
 */
public class MyAjUnit0Test extends AjUnit4Test {
}

May be you can use this: JavaDocSourceEmbed

It's nice but first it removes /** */ comments, and second it needs a preprocessing step, which IMHO is not necessary.

By the way, this should also solve your issue with java annotations.

loddar commented 8 years ago

I've implemented it and bit more. Please merge pull request #64 .

Thx Marko