mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
remove javadoc prototype, link to external docs
This commit is contained in:
parent
619924a904
commit
e5aa923dd3
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Squid-Java API Reference
|
||||
---
|
||||
|
||||
Coming soon. For now, please see the squid-java source code on GitHub.
|
||||
|
||||
<repo name="squid-java"></repo>
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Squid-py API Reference
|
||||
---
|
||||
|
||||
ReadTheDocs hosts the [squid-py API Reference Docs](https://squid-py.readthedocs.io/en/latest/).
|
@ -26,11 +26,11 @@
|
||||
- name: squid-py
|
||||
links:
|
||||
- name: API reference
|
||||
url: /references/squid-py/
|
||||
url: https://squid-py.readthedocs.io/en/latest/
|
||||
- name: squid-java
|
||||
links:
|
||||
- name: API reference
|
||||
url: /references/squid-java/
|
||||
url: https://www.javadoc.io/doc/com.oceanprotocol/squid/
|
||||
- name: Plecos
|
||||
|
||||
- group: OceanDB
|
||||
|
@ -21,9 +21,9 @@
|
||||
- group: squid-py
|
||||
items:
|
||||
- title: API Reference
|
||||
link: /references/squid-py/
|
||||
link: https://squid-py.readthedocs.io/en/latest/
|
||||
|
||||
- group: squid-java
|
||||
items:
|
||||
- title: API Reference
|
||||
link: /references/squid-java/
|
||||
link: https://www.javadoc.io/doc/com.oceanprotocol/squid/
|
||||
|
@ -99,39 +99,6 @@ exports.createPages = ({ graphql, actions }) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
squidJava: github {
|
||||
repository(
|
||||
owner: "oceanprotocol"
|
||||
name: "squid-java"
|
||||
) {
|
||||
name
|
||||
pom: object(expression: "develop:pom.xml") {
|
||||
id
|
||||
... on GitHub_Blob {
|
||||
text
|
||||
}
|
||||
}
|
||||
releases(first: 1) {
|
||||
edges {
|
||||
node {
|
||||
name
|
||||
spec: releaseAssets(
|
||||
first: 100
|
||||
name: "api.json"
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
name
|
||||
downloadUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
).then(async result => {
|
||||
@ -282,42 +249,6 @@ exports.createPages = ({ graphql, actions }) => {
|
||||
})
|
||||
})
|
||||
|
||||
//
|
||||
// Create pages from Javadoc json files
|
||||
//
|
||||
const javadocSpecs = ['./data/squid-java.json']
|
||||
const javadocTemplate = path.resolve(
|
||||
'./src/templates/Javadoc/index.jsx'
|
||||
)
|
||||
|
||||
javadocSpecs.forEach(spec => {
|
||||
const javadoc = require(spec) // eslint-disable-line
|
||||
|
||||
const { name, pom } = result.data.squidJava.repository
|
||||
const slug = `/references/${name}/`
|
||||
const metaSquidJava = parser.xml2js(pom.text, {
|
||||
compact: true
|
||||
})
|
||||
const { project } = metaSquidJava
|
||||
|
||||
createPage({
|
||||
path: slug,
|
||||
component: javadocTemplate,
|
||||
context: {
|
||||
slug,
|
||||
javadoc,
|
||||
title: name,
|
||||
description: `${project.name._text}. ${
|
||||
project.description._text
|
||||
}.`,
|
||||
version: project.version._text,
|
||||
namespace: `${project.groupId._text}.${
|
||||
project.artifactId._text
|
||||
}`
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//
|
||||
// create redirects
|
||||
//
|
||||
|
@ -1,80 +0,0 @@
|
||||
import React from 'react'
|
||||
import slugify from 'slugify'
|
||||
import { cleanPaths } from './utils'
|
||||
import stylesDoc from '../Doc.module.scss'
|
||||
import styles from './Entities.module.scss'
|
||||
|
||||
const filterPropertyItems = (item, name) => {
|
||||
let title
|
||||
switch (name) {
|
||||
case '@param':
|
||||
title = 'Parameters'
|
||||
break
|
||||
case '@return':
|
||||
title = 'Returns'
|
||||
break
|
||||
case '@throws':
|
||||
title = 'Throws'
|
||||
break
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{item.filter(item => item.name === name).length > 0 && (
|
||||
<h4 className={styles.subHeading}>{title}</h4>
|
||||
)}
|
||||
{item
|
||||
.filter(item => item.name === name)
|
||||
.map((item, index) => {
|
||||
if (item.name === '@param') {
|
||||
const splitText = item.text.split(' ')
|
||||
return (
|
||||
<div key={index} className={styles.parameter}>
|
||||
<code className={styles.param}>
|
||||
{splitText[0]}
|
||||
</code>
|
||||
<p>{item.text.replace(splitText[0], '')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return <div key={index}>{item.text}</div>
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const Entities = ({ javadoc }) => {
|
||||
return Object.entries(javadoc).map(([key, value]) => (
|
||||
<div
|
||||
key={key}
|
||||
id={slugify(cleanPaths(key), {
|
||||
remove: /[*+~.()'"/!:@]/g
|
||||
})}
|
||||
>
|
||||
<h2 className={stylesDoc.pathName}>
|
||||
<code>{cleanPaths(key)}</code>
|
||||
</h2>
|
||||
|
||||
<p>{value[0][0].text}</p>
|
||||
|
||||
{value.map((item, index) => {
|
||||
if (index === 0) return
|
||||
|
||||
return (
|
||||
<div key={index} className={styles.property}>
|
||||
<h3 className={styles.propertyName}>Function Name</h3>
|
||||
|
||||
<p>{item[0].text}</p>
|
||||
|
||||
{filterPropertyItems(item, '@param')}
|
||||
{filterPropertyItems(item, '@return')}
|
||||
{filterPropertyItems(item, '@throws')}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
|
||||
export default Entities
|
@ -1,48 +0,0 @@
|
||||
@import 'variables';
|
||||
|
||||
.property {
|
||||
padding: $spacer / 2;
|
||||
border: 1px solid $brand-grey-lighter;
|
||||
margin-bottom: $spacer;
|
||||
border-radius: $border-radius;
|
||||
|
||||
> p {
|
||||
margin-bottom: $spacer;
|
||||
}
|
||||
}
|
||||
|
||||
.subHeading {
|
||||
font-size: $font-size-base;
|
||||
border-bottom: 1px solid $brand-grey-lighter;
|
||||
padding-bottom: $spacer / 4;
|
||||
margin-bottom: $spacer / $line-height;
|
||||
color: $brand-grey;
|
||||
}
|
||||
|
||||
.propertyName {
|
||||
font-size: $font-size-large;
|
||||
font-family: $font-family-monospace;
|
||||
margin-bottom: $spacer / 2;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.parameter {
|
||||
margin-top: $spacer / 4;
|
||||
margin-bottom: $spacer / 2;
|
||||
}
|
||||
|
||||
.parameterType {
|
||||
font-size: $font-size-small;
|
||||
color: $brand-grey;
|
||||
background: rgba($brand-blue, .2);
|
||||
display: inline-block;
|
||||
padding: 0 $spacer / 5;
|
||||
border-radius: $border-radius;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.param {
|
||||
display: inline-block;
|
||||
margin-right: $spacer / 4;
|
||||
font-weight: 600;
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import slugify from 'slugify'
|
||||
import Scrollspy from 'react-scrollspy'
|
||||
import Scroll from '../../components/Scroll'
|
||||
import { cleanPaths } from './utils'
|
||||
import stylesSidebar from '../../components/Sidebar.module.scss'
|
||||
|
||||
export default class Toc extends PureComponent {
|
||||
static propTypes = {
|
||||
data: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
state = {
|
||||
subIds: []
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.getSubIds()
|
||||
}
|
||||
|
||||
getSubIds = () =>
|
||||
Object.keys(this.props.data).map(path => {
|
||||
const cleanedPath = cleanPaths(path)
|
||||
const slug = slugify(cleanedPath, {
|
||||
remove: /[*+~.()'"/!:@]/g
|
||||
})
|
||||
|
||||
this.setState(prevState => ({
|
||||
subIds: [...prevState.subIds, slug]
|
||||
}))
|
||||
})
|
||||
|
||||
items = Object.keys(this.props.data).map(path => {
|
||||
const cleanedPath = cleanPaths(path)
|
||||
const slug = slugify(cleanedPath, {
|
||||
remove: /[*+~.()'"/!:@]/g
|
||||
})
|
||||
let entity = cleanedPath.split('/')
|
||||
entity = entity.pop()
|
||||
|
||||
return (
|
||||
<li key={path}>
|
||||
<Scroll type="id" element={`${slug}`} offset={-20}>
|
||||
<code>{entity}</code>
|
||||
</Scroll>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Scrollspy
|
||||
items={this.state.subIds}
|
||||
currentClassName={stylesSidebar.scrollspyActive}
|
||||
offset={-30}
|
||||
>
|
||||
{this.items}
|
||||
</Scrollspy>
|
||||
)
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { graphql } from 'gatsby'
|
||||
import Helmet from 'react-helmet'
|
||||
import Layout from '../../components/Layout'
|
||||
import Content from '../../components/Content'
|
||||
import HeaderSection from '../../components/HeaderSection'
|
||||
import Sidebar from '../../components/Sidebar'
|
||||
import DocHeader from '../../components/DocHeader'
|
||||
import SEO from '../../components/Seo'
|
||||
import stylesDoc from '../Doc.module.scss'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
import Entities from './Entities'
|
||||
import Toc from './Toc'
|
||||
|
||||
export default class JavadocTemplate extends Component {
|
||||
static propTypes = {
|
||||
data: PropTypes.object.isRequired,
|
||||
location: PropTypes.object.isRequired,
|
||||
pageContext: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
// output section title as defined in sections.yml
|
||||
sectionTitle = this.props.data.allSectionsYaml.edges.map(({ node }) => {
|
||||
// compare section against section title from sections.yml
|
||||
if (node.title.toLowerCase().includes('references')) {
|
||||
return node.title
|
||||
}
|
||||
})
|
||||
|
||||
render() {
|
||||
const { location, pageContext } = this.props
|
||||
const { javadoc, title, description, version, namespace } = pageContext
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
<body className={'references'} />
|
||||
</Helmet>
|
||||
|
||||
<SEO
|
||||
title={title}
|
||||
description={description}
|
||||
slug={pageContext.slug}
|
||||
article
|
||||
/>
|
||||
|
||||
<Layout location={location}>
|
||||
<HeaderSection title={this.sectionTitle} />
|
||||
|
||||
<Content>
|
||||
<main className={stylesDoc.wrapper}>
|
||||
<aside className={stylesDoc.sidebar}>
|
||||
<Sidebar
|
||||
location={location}
|
||||
sidebar={'references'}
|
||||
collapsed
|
||||
toc
|
||||
tocComponent={<Toc data={javadoc} />}
|
||||
/>
|
||||
</aside>
|
||||
<article className={stylesDoc.main}>
|
||||
<DocHeader
|
||||
title={title}
|
||||
description={description}
|
||||
prepend={
|
||||
<>
|
||||
<span className={stylesDoc.version}>
|
||||
{version}
|
||||
</span>
|
||||
<p className={styles.namespace}>
|
||||
{namespace}
|
||||
</p>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<Entities javadoc={javadoc} />
|
||||
</article>
|
||||
</main>
|
||||
</Content>
|
||||
</Layout>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export const JavadocQuery = graphql`
|
||||
query {
|
||||
allSectionsYaml {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
description
|
||||
link
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
@ -1,8 +0,0 @@
|
||||
@import 'variables';
|
||||
|
||||
.namespace {
|
||||
font-size: $font-size-base;
|
||||
font-family: $font-family-monospace;
|
||||
color: $brand-grey-light;
|
||||
margin-top: $spacer / $line-height;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
export const cleanPaths = path =>
|
||||
path.replace('src/main/java/com/oceanprotocol/squid/', '')
|
Loading…
Reference in New Issue
Block a user