Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
loddar opened this issue Jun 2, 2016 · 1 comment
Open

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

loddar opened this issue Jun 2, 2016 · 1 comment

Comments

@loddar
Copy link
Contributor

loddar commented Jun 2, 2016

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

  • a property: language
  • and a property: content.

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
Copy link
Contributor Author

loddar commented Jul 12, 2016

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

Thx Marko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant