ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Robert F. Beeger" <5beeger@informatik.uni-hamburg.de>
Cc: ntg-context@ntg.nl
Subject: Re[2]: Verbatim modules
Date: Wed, 27 Feb 2002 08:52:53 +0100	[thread overview]
Message-ID: <423417406.20020227085253@informatik.uni-hamburg.de> (raw)
In-Reply-To: <5.1.0.14.1.20020225163148.02c0c2c8@server-1>


[-- Attachment #1.1: Type: text/plain, Size: 3085 bytes --]

Hello, Hans!

Monday, February 25, 2002, 4:32:40 PM, Hans Hagen wrote
>>Now "/*" and "*/" gets typeset in red, the "*" after "/*" and the text
>>in the comment gets typeset in black and the two remaining "*" get
>>grayed out. Here I would like to have "/*", "*/" and the other stars
>>to be typeset in one color´, be it red or what ever, and the text to
>>be grayed out. I know this is not that easy to accomplish and is more a
>>feature request for the future. But since I am into this now, I
>>thought it would not do any harm, if mentioned it.

HH> if you give me precise specs and example files, i can have a look at it

Well, let's try this: In Java there are three sorts of comments.
The first one is the one-line-comment and is introduced with "//" as
in

// This is an assignment
a = 78

The second one can be used to make a multi-line comment. It is started
with a "/*" and finished with a "*/" as in

/*
 This is a multi-line comment.
 Really!
 */

Those first two sorts of comments are also available in JavaScript, C
and C++.

The third one is a speciality of Java. It is used to produce
JavaDoc-Comments. A tool, called JavaDoc, recognizes these comments
and generates an API-documentation from those comments.
JavaDoc-comments are used just before the definition of
- a class to describe what the class is for and show some simple
examples of how to use it.
- a method to describe what the method is for, to describe what the
meaning of the arguments is and to show simple examples of the usage
of the method.
- a field to (guess what) describe the field is for.
A JavaDoc-comment is started by a "/**". Each line in a JavaDoc-comment
begins with a "*". A JavaDoc-comment is finished by a "*/". An example

/**
 * This method adds to integers.
 *
 * @param a first number
 * @param b second number
 */
public int sum(int a, int b);

Although a JavaDoc-comment may contain some @-keywords and
although some IDEs highlight them differently, it would be to much for
a ConTeXt-document to also have them highlighted differently. That
would be to much eye-candy. Just highlighting the whole contents of a
JavaDoc-comment would be sufficient.
JavaDoc-comments use HTML for the formatting. The JavaDoc-tool
generates the API-documentation in HTML, so the formatting
instructions in a JavaDoc-comment are used directly in the resulting
documentation. But this also should not have any consequence for the
highlighting in ConTeXt.

There are two kinds of highlighting a Java-comment that would look
good and make it clear that it's a comment
- Highlight all of the comment including the markers "//", "/*",
"/**", "*" and "*/" in the same color.
- Highlight the markers and the contents differently. This would bring
a difficulty into it. It would be necessary to differentiate between
the "*" at the start of a JavaDoc-comment-line and a "*" that appears
somewhere in the body of the comment as in
/**
 * 2 * 2 = 4
 */
I would be glad with the first variant, but ConTeXt seems to use the
second one.

As a sample I have included a Java-class.

Does this help?

-- 
Greets
 Robert

[-- Attachment #1.2: LoginServlet.java --]
[-- Type: application/octet-stream, Size: 1214 bytes --]

package de.jwamalpha.handling.web.rbdipl;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;

/**
 * The simple login servlet
 *
 * @history
 * @modification 25-jan-2002, v1.00, Robert F. Beeger
 *  Development.
 * @history-end
 */
public class LoginServlet extends HttpServlet
{
  //
  // public interface
  //
  /**
   * Process the get-request.
   *
   * @param request the request
   * @param response the response.
   */
  protected void doGet (HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException
  {
    response.setContentType("text/html");
    PrintWriter writer = response.getWriter();
    writer.println("<html>");
    writer.println("  <head>");
    writer.println("    <title>Login</title>");
    writer.println("  </head>");
    writer.println("  <body>");
    writer.println("    Hallo, Benutzer " + request.getParameter("username") + "!");
    writer.println("  </body>");
    writer.println("</html>");
    writer.flush();
  }
}

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 1992 bytes --]

  parent reply	other threads:[~2002-02-27  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-21 12:07 Robert F. Beeger
2002-02-25 15:32 ` Hans Hagen
2002-02-25 21:35   ` Re[2]: " Giuseppe Bilotta
2002-02-26 11:01     ` Hans Hagen
2002-02-27  7:52   ` Robert F. Beeger [this message]
2002-02-27 23:09     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=423417406.20020227085253@informatik.uni-hamburg.de \
    --to=5beeger@informatik.uni-hamburg.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).