generate html + fixed "

This commit is contained in:
Renaud Pawlak 2015-11-28 10:25:25 +01:00
parent a1d79d3e7c
commit bfc09f36d6
3 changed files with 48 additions and 25 deletions

View File

@ -211,7 +211,7 @@ The core JavaScript API is defined in `jsweet.lang` (the full documentation can
- `jsweet.lang.Error`: this class implements `java.lang.RuntimeException` and can be thrown and caught with `try` ... `catch` statements.
Programmers should use this API most of the time. However, for objects that need to be used with Java literals (numbers, booleans, and strings), the use of the `java.lang` package classes is recommended. For instance, the jQuery API declares `$(java.lang.String)` instead of `$(jsweet.lang.String)`. This allows the programmer to write expressions using literals, such as `$(”a”)` (for selecting all links in a document).
Programmers should use this API most of the time. However, for objects that need to be used with Java literals (numbers, booleans, and strings), the use of the `java.lang` package classes is recommended. For instance, the jQuery API declares `$(java.lang.String)` instead of `$(jsweet.lang.String)`. This allows the programmer to write expressions using literals, such as `$("a")` (for selecting all links in a document).
As a consequence, programmers need to be able to switch to the JavaScript API when coming from a Java object. The `jsweet.util.Globals` class defines convenient static methods to cast back and forth core Java objects to their corresponding JSweet objects. For instance the `string(...)` method will allow the programmer to switch from the Java to the JSweet strings and conversely.
@ -548,7 +548,7 @@ For functional types, JSweet reuses the `java.Runnable` and `java.util.function`
### String types
For string types, the use of specific types and final instances of these types is the way to simulate string types in Java. For instance, if a `”span”` string type needs to be defined, a Java interface called `span` and a static final field called `span` in a `StringTypes` class will do the job.
For string types, the use of specific types and final instances of these types is the way to simulate string types in Java. For instance, if a `"span"` string type needs to be defined, a Java interface called `span` and a static final field called `span` in a `StringTypes` class will do the job.
// To be completed
@ -788,7 +788,7 @@ public final class Globals extends jsweet.lang.Object {
}
```
The above code shows an excerpt of the JSweet jQuery API. As we can notice, the $ function is annotated with `@Module(”jquery”)`. As a consequence, any call to this function will trigger the require of the `jquery` module.
The above code shows an excerpt of the JSweet jQuery API. As we can notice, the $ function is annotated with `@Module("jquery")`. As a consequence, any call to this function will trigger the require of the `jquery` module.
Note: the notion of manual require of a module may be available in future releases. However, automatic require is sufficient for most programmers and hides the complexity of having to require modules explicitly. It also brings the advantage of having the same code whether modules are used or not.

View File

@ -234,7 +234,7 @@ The core JavaScript API is defined in \texttt{jsweet.lang} (the full documentati
\item \texttt{jsweet.lang.Error}: this class implements \texttt{java.lang.RuntimeException} and can be thrown and caught with \texttt{try} ... \texttt{catch} statements.
\end{itemize}
Programmers should use this API most of the time. However, for objects that need to be used with Java literals (numbers, booleans, and strings), the use of the \texttt{java.lang} package classes is recommended. For instance, the jQuery API declares \texttt{\$(java.lang.String)} instead of \texttt{\$(jsweet.\-lang.\-String)}. This allows the programmer to write expressions using literals, such as \texttt{\$(''a'')} (for selecting all links in a document).
Programmers should use this API most of the time. However, for objects that need to be used with Java literals (numbers, booleans, and strings), the use of the \texttt{java.lang} package classes is recommended. For instance, the jQuery API declares \texttt{\$(java.lang.String)} instead of \texttt{\$(jsweet.\-lang.\-String)}. This allows the programmer to write expressions using literals, such as \texttt{\$($"$a$"$)} (for selecting all links in a document).
As a consequence, programmers need to be able to switch to the JavaScript API when coming from a Java object. The \texttt{jsweet.util.Globals} class defines convenient static methods to cast back and forth core Java objects to their corresponding JSweet objects. For instance the \texttt{string(...)} method will allow the programmer to switch from the Java to the JSweet strings and conversely.
@ -575,7 +575,7 @@ For functional types, JSweet reuses the \texttt{java.\-Runnable} and \texttt{jav
\section{String types}
For string types, the use of specific types and final instances of these types is the way to simulate string types in Java. For instance, if a \texttt{''span''} string type needs to be defined, a Java interface called \texttt{span} and a static final field called \texttt{span} in a \texttt{StringTypes} class will do the job.
For string types, the use of specific types and final instances of these types is the way to simulate string types in Java. For instance, if a \texttt{$"$span$"$} string type needs to be defined, a Java interface called \texttt{span} and a static final field called \texttt{span} in a \texttt{StringTypes} class will do the job.
// To be completed
@ -821,7 +821,7 @@ public final class Globals extends jsweet.lang.Object {
}
\end{lstlisting}
The above code shows an excerpt of the JSweet jQuery API. As we can notice, the \$ function is annotated with \texttt{@Module(''jquery'')}. As a consequence, any call to this function will trigger the require of the \texttt{jquery} module.
The above code shows an excerpt of the JSweet jQuery API. As we can notice, the \$ function is annotated with \texttt{@Module($"$jquery$"$)}. As a consequence, any call to this function will trigger the require of the \texttt{jquery} module.
Note: the notion of manual require of a module may be available in future releases. However, automatic require is sufficient for most programmers and hides the complexity of having to require modules explicitly. It also brings the advantage of having the same code whether modules are used or not.

61
pom.xml
View File

@ -120,30 +120,53 @@
<version>1.4.0</version>
<executions>
<execution>
<id>doc-markdown</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<executable>pandoc</executable>
<workingDirectory>doc</workingDirectory>
<arguments>
<argument>-r</argument>
<argument>latex</argument>
<argument>-w</argument>
<argument>markdown_github</argument>
<argument>--base-header-level=2</argument>
<argument>-s</argument>
<argument>--toc</argument>
<argument>--number-sections</argument>
<argument>-B</argument>
<argument>header.md</argument>
<argument>-o</argument>
<argument>jsweet-language-specifications.md</argument>
<argument>jsweet-language-specifications.tex</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>doc-html</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<executable>pandoc</executable>
<workingDirectory>doc</workingDirectory>
<arguments>
<argument>-r</argument>
<argument>latex</argument>
<argument>-w</argument>
<argument>html5</argument>
<argument>--base-header-level=3</argument>
<argument>-o</argument>
<argument>jsweet-language-specifications.html</argument>
<argument>jsweet-language-specifications.tex</argument>
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<executable>pandoc</executable>
<workingDirectory>doc</workingDirectory>
<arguments>
<argument>-r</argument>
<argument>latex</argument>
<argument>-w</argument>
<argument>markdown_github</argument>
<argument>--base-header-level=2</argument>
<argument>-s</argument>
<argument>--toc</argument>
<argument>--number-sections</argument>
<argument>-B</argument>
<argument>header.md</argument>
<argument>-o</argument>
<argument>jsweet-language-specifications.md</argument>
<argument>jsweet-language-specifications.tex</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>