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

Add Drivers Manual code tabs #8

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
248 changes: 248 additions & 0 deletions preview-src/drivers-tabs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
= Tabbed sections in Drivers Manual

Up to Neo4j 4.1 the Drivers Manual includes tabs to allow users to choose with driver language sections to display.
From 4.2 on, the Drivers Manual is split into a separate manual per language.

== Example drivers manual content

.Acquire the driver
[.tabbed-example]
====

[.include-with-dotnet]
======

The .NET driver is distributed via the NuGet Gallery.
To find the latest version of the driver, visit https://www.nuget.org/packages/Neo4j.Driver/.

*Dependencies*

* .NETStandard (^2.0)
* System.Net.NameResolution (^4.3.0)
* System.Net.Security (^4.3.2)
* System.Net.Sockets (^4.3.0)
* System.Runtime.InteropServices.RuntimeInformation (^4.3.0)
* System.Runtime.Serialization.Primitives (^4.3.0)
* System.Threading.Thread (^4.3.0)
* System.ValueTuple (^4.5.0)

The .NET Reactive API is under package `Neo4j.Driver.Reactive`.
It is built upon https://github.com/dotnet/reactive[`System.Reactive`].
There is no extra dependency required use .NET reactive API.

.Installation via Install-package
========
To install the latest version of the driver using NuGet in Visual Studio:

[source, csharp, subs="attributes, specialcharacters"]
----
PM> Install-Package Neo4j.Driver
----

It is also an option to install a certain version of the driver.

[source, csharp, subs="attributes, specialcharacters"]
----
PM> Install-Package Neo4j.Driver -Version $DOTNET_DRIVER_VERSION
----

The .Net driver uses asynchronous methods by default.
If you want to use blocking calls, the `Neo4j.Driver.Simple` NuGet package contains a set of extensions.
This can be found at https://www.nuget.org/packages/Neo4j.Driver.Simple/.
The initial examples make use of these extensions.

In the following example we are installing driver version {dotnet-driver-version}.

[source, csharp, subs="attributes, specialcharacters"]
----
PM> Install-Package Neo4j.Driver -Version {dotnet-driver-version}
----
========

The release notes for this driver are available https://github.com/neo4j/neo4j-dotnet-driver/releases[here].

======

[.include-with-go]
======

To find out the latest version of the driver, visit https://github.com/neo4j/neo4j-go-driver/releases

========

To install the latest version of the driver using `go get`:

[source, shell, subs="attributes, specialcharacters"]
----
go get github.com/neo4j/neo4j-go-driver/v4@<latest tag>
----
Note that this requires that Go modules are enabled.

========

======

[.include-with-java]
======

To use the Java driver, it is recommended employing a dependency manager, such as Maven or Gradle.
To find the latest version of the driver, visit the https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.neo4j.driver%22%20AND%20a%3A%22neo4j-java-driver%22[Maven Central Repository].

*Dependencies*

* org.reactivestreams:reactive-streams
* org.apache.logging.log4j:log4j (optional)

The driver is dependent on the https://www.reactive-streams.org/[Reactive Streams API], thus maintaining JDK 8 compatibility.
To make optimal use of the reactive APIs, we suggest an additional framework like Project Reactor or RxJava2.
Both implement the Reactive Streams API and provide an exhaustive set of operators.


.Installation via Maven
========

When using Maven, add the following block to the _pom.xml_ file.
The driver version can either be declared as a property (as in the first example) or as an explicit version number (as in the second).

[source, xml, subs="attributes, specialcharacters"]
----
<dependencies>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>$JAVA_DRIVER_VERSION</version>
</dependency>
</dependencies>
----

In the following example, driver version {java-driver-version} is added.

[source, xml, subs="attributes, specialcharacters"]
----
<dependencies>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>{java-driver-version}</version>
</dependency>
</dependencies>
----
========

.Installation via Gradle
========

For Gradle, a compile line will be required. Again, this can use a property or an explicit version number.

[source, groovy, subs="attributes, specialcharacters"]
----
compile 'org.neo4j.driver:neo4j-java-driver:$JAVA_DRIVER_VERSION'
----

In the following example, a driver version {java-driver-version} is added.

[source, groovy, subs="attributes, specialcharacters"]
----
compile 'org.neo4j.driver:neo4j-java-driver:{java-driver-version}'
----
========

The release notes for this driver are available https://github.com/neo4j/neo4j-java-driver/wiki[here].

======

[.include-with-javascript]
======

To use the JavaScript driver, it is recommended employing `npm`.
To find the latest version of the driver, use:

[source, shell, subs="attributes, specialcharacters"]
----
npm show neo4j-driver@* version
----

*Dependencies*

* Babel/Runtime (^7.5.5)
* RxJS (^6.5.2)
* text-encoding-utf-8 (^1.0.2)
* URI-js (^4.2.2)


The JavaScript Reactive API is built and exposed via RxJs.
A dependency of RxJs is automatically installed with the driver.

.Installation via npm
========

To install the latest version of the driver:

[source, shell, subs="attributes, specialcharacters"]
----
npm install neo4j-driver
----

It is also an option to install a certain version of the driver.

[source, shell, subs="attributes, specialcharacters"]
----
npm install neo4j-driver@$JAVASCRIPT-DRIVER-VERSION
----

In the following example, driver version {javascript-driver-version} is installed.

[source, shell, subs="attributes, specialcharacters"]
----
npm install neo4j-driver@{javascript-driver-version}
----
========

The release notes for this driver are available https://github.com/neo4j/neo4j-javascript-driver/wiki[here].

======

[.include-with-python]
======

To find the latest stable version of the Python Driver, visit https://pypi.org/project/neo4j/

To find a list of all available releases, visit https://pypi.org/simple/neo4j/

To install the latest stable version of the Python Driver:
[source, shell, subs="attributes, specialcharacters"]
----
pip install neo4j
----

It is also an option to install a certain version of the driver.

.Installation with Python
========
The following is the syntax for installing a certain version of the Python Driver:
[source, shell, subs="attributes, specialcharacters"]
----
pip install neo4j==$PYTHON_DRIVER_VERSION
----

In the following example we are installing Python Driver version {python-driver-version}.
[source, shell, subs="attributes, specialcharacters"]
----
pip install neo4j=={python-driver-version}
----
========

.Installation with Python, get Python Driver prerelease
========
In the following example we get the latest prerelease version:
[source, shell, subs="attributes, specialcharacters"]
----
pip install neo4 --pre
----
========

The release notes for the Python Driver are available https://github.com/neo4j/neo4j-python-driver/wiki[here]

======

====
3 changes: 3 additions & 0 deletions preview-src/ui-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ page:
- content: Private Page
url: private-page.html
urlType: internal
- content: Drivers tabs
url: drivers-tabs.html
urlType: internal

asciidoc:
attributes:
Expand Down
22 changes: 21 additions & 1 deletion src/js/06-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ document.addEventListener('DOMContentLoaded', function () {
document.body.removeChild(textarea)
}

function capitalizeFirstLetter (string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}

var casedLang = function (lang) {
ggrossetie marked this conversation as resolved.
Show resolved Hide resolved
var cased
switch (lang) {
case 'csharp':
case 'dotnet':
cased = 'C#'
break
case 'javascript':
cased = 'JavaScript'
break
default:
cased = capitalizeFirstLetter(lang)
}
return cased
}

var addCodeHeader = function (pre) {
var dotContent = pre.parentElement
var listingBlock = dotContent.parentElement
Expand All @@ -92,7 +112,7 @@ document.addEventListener('DOMContentLoaded', function () {
languageDiv.className = 'code-language'

if (language) {
languageDiv.innerHTML = language
languageDiv.innerHTML = casedLang(language)
}
var children = [languageDiv]

Expand Down
Loading