ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Verbatim modules
@ 2002-02-21 12:07 Robert F. Beeger
  2002-02-25 15:32 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Robert F. Beeger @ 2002-02-21 12:07 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1806 bytes --]

Hello!

I searched for a possibility to include listings with syntax
highlighting in my current text.

First I thought it would be nice to embed HTML in ConTeXt since my
Java-IDE can export Java-Files with syntax highlighting to HTML.

Then I found the verbatim modules of ConTeXt and think they are a much
better idea. It is more lightweight than having the HTML-export with
all those font settings and so on.

Those verbatim modules do nearly everything I need. Thanks to Pragma
ADE for this. But now I have some questions.

There are is a JS and a JV verbatim environment defined in ConTeXt.
What is the difference between those two. Is it only to make the
intention clear : If you have some Java-code, use JV to make clear
that it is Java and not JavaScript. If it is JavaScript use JS. Or is
there more to it.

I have one problem with the Java/JavaScript verbatim module. I would
like the comments to be grayed out like it is done by the XML module.

If I have

\startJV
// bla
public void bla();
\stopJV

the "//" gets typeset in red and the "bla" after the "//" gets typeset in
black, which is the normal color for non-keywords.
How do I make it that the "bla" after the "//"is grayed out.

An other problem occurres when I use a JavaDoc-Comment

\startJV
  /**
   * bla
   * @param blub Blub bla blub.
   */
\stopJV

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.

Greets
   Robert

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Verbatim modules
  2002-02-21 12:07 Verbatim modules Robert F. Beeger
@ 2002-02-25 15:32 ` Hans Hagen
  2002-02-25 21:35   ` Re[2]: " Giuseppe Bilotta
  2002-02-27  7:52   ` Robert F. Beeger
  0 siblings, 2 replies; 6+ messages in thread
From: Hans Hagen @ 2002-02-25 15:32 UTC (permalink / raw)
  Cc: ntg-context

At 01:07 PM 2/21/2002 +0100, Robert F. Beeger wrote:

>There are is a JS and a JV verbatim environment defined in ConTeXt.
>What is the difference between those two. Is it only to make the
>intention clear : If you have some Java-code, use JV to make clear
>that it is Java and not JavaScript. If it is JavaScript use JS. Or is
>there more to it.

no, as you deduced, theye're just synonyms

>I have one problem with the Java/JavaScript verbatim module. I would
>like the comments to be grayed out like it is done by the XML module.
>
>If I have
>
>\startJV
>// bla
>public void bla();
>\stopJV
>
>the "//" gets typeset in red and the "bla" after the "//" gets typeset in
>black, which is the normal color for non-keywords.
>How do I make it that the "bla" after the "//"is grayed out.
>
>An other problem occurres when I use a JavaDoc-Comment
>
>\startJV
>   /**
>    * bla
>    * @param blub Blub bla blub.
>    */
>\stopJV
>
>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.

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

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[2]: Verbatim modules
  2002-02-25 15:32 ` Hans Hagen
@ 2002-02-25 21:35   ` Giuseppe Bilotta
  2002-02-26 11:01     ` Hans Hagen
  2002-02-27  7:52   ` Robert F. Beeger
  1 sibling, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2002-02-25 21:35 UTC (permalink / raw)
  Cc: ntg-context

Monday, February 25, 2002 Hans Hagen wrote:

HH> At 01:07 PM 2/21/2002 +0100, Robert F. Beeger wrote:

>>There are is a JS and a JV verbatim environment defined in ConTeXt.
>>What is the difference between those two. Is it only to make the
>>intention clear : If you have some Java-code, use JV to make clear
>>that it is Java and not JavaScript. If it is JavaScript use JS. Or is
>>there more to it.

HH> no, as you deduced, theye're just synonyms

And they shouldn't be! I believe JV should be kept for Java
("real" Java).

--
Giuseppe "Oblomov" Bilotta


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[2]: Verbatim modules
  2002-02-25 21:35   ` Re[2]: " Giuseppe Bilotta
@ 2002-02-26 11:01     ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2002-02-26 11:01 UTC (permalink / raw)
  Cc: ntg-context

At 10:35 PM 2/25/2002 +0100, Giuseppe Bilotta wrote:

>Monday, February 25, 2002 Hans Hagen wrote:
>
>HH> At 01:07 PM 2/21/2002 +0100, Robert F. Beeger wrote:
>
> >>There are is a JS and a JV verbatim environment defined in ConTeXt.
> >>What is the difference between those two. Is it only to make the
> >>intention clear : If you have some Java-code, use JV to make clear
> >>that it is Java and not JavaScript. If it is JavaScript use JS. Or is
> >>there more to it.
>
>HH> no, as you deduced, theye're just synonyms
>
>And they shouldn't be! I believe JV should be kept for Java
>("real" Java).

i know, but the highlighting is the same (and also quite similar to the 
perl one)

of course you can have two similar copies and fool yourself -)

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[2]: Verbatim modules
  2002-02-25 15:32 ` Hans Hagen
  2002-02-25 21:35   ` Re[2]: " Giuseppe Bilotta
@ 2002-02-27  7:52   ` Robert F. Beeger
  2002-02-27 23:09     ` Hans Hagen
  1 sibling, 1 reply; 6+ messages in thread
From: Robert F. Beeger @ 2002-02-27  7:52 UTC (permalink / raw)
  Cc: ntg-context


[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[2]: Verbatim modules
  2002-02-27  7:52   ` Robert F. Beeger
@ 2002-02-27 23:09     ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2002-02-27 23:09 UTC (permalink / raw)
  Cc: ntg-context

Hi,

I'll send you the patched files in a separate mail. (javadoc handling with 
@tag colorization); please check the lists at the end of verb-jv since i am 
(and wanna be) happily unaware of them

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-02-27 23:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-21 12:07 Verbatim modules 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
2002-02-27 23:09     ` Hans Hagen

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).