From e5aa923dd31890a82e6e551432c441ef3a103f92 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 29 Mar 2019 16:18:16 +0100 Subject: [PATCH] remove javadoc prototype, link to external docs --- content/references/squid-java.md | 7 -- content/references/squid-py.md | 5 - data/repositories.yml | 4 +- data/sidebars/references.yml | 4 +- gatsby-node.js | 69 -------------- src/templates/Javadoc/Entities.jsx | 80 ---------------- src/templates/Javadoc/Entities.module.scss | 48 ---------- src/templates/Javadoc/Toc.jsx | 62 ------------- src/templates/Javadoc/index.jsx | 101 --------------------- src/templates/Javadoc/index.module.scss | 8 -- src/templates/Javadoc/utils.js | 2 - 11 files changed, 4 insertions(+), 386 deletions(-) delete mode 100644 content/references/squid-java.md delete mode 100644 content/references/squid-py.md delete mode 100644 src/templates/Javadoc/Entities.jsx delete mode 100644 src/templates/Javadoc/Entities.module.scss delete mode 100644 src/templates/Javadoc/Toc.jsx delete mode 100644 src/templates/Javadoc/index.jsx delete mode 100644 src/templates/Javadoc/index.module.scss delete mode 100644 src/templates/Javadoc/utils.js diff --git a/content/references/squid-java.md b/content/references/squid-java.md deleted file mode 100644 index 53ccff64..00000000 --- a/content/references/squid-java.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Squid-Java API Reference ---- - -Coming soon. For now, please see the squid-java source code on GitHub. - - diff --git a/content/references/squid-py.md b/content/references/squid-py.md deleted file mode 100644 index ca6c773b..00000000 --- a/content/references/squid-py.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Squid-py API Reference ---- - -ReadTheDocs hosts the [squid-py API Reference Docs](https://squid-py.readthedocs.io/en/latest/). diff --git a/data/repositories.yml b/data/repositories.yml index 81255445..3df65e65 100644 --- a/data/repositories.yml +++ b/data/repositories.yml @@ -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 diff --git a/data/sidebars/references.yml b/data/sidebars/references.yml index eae63aa7..0b5eb7f3 100644 --- a/data/sidebars/references.yml +++ b/data/sidebars/references.yml @@ -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/ diff --git a/gatsby-node.js b/gatsby-node.js index c5c51cca..aeda0e8c 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -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 // diff --git a/src/templates/Javadoc/Entities.jsx b/src/templates/Javadoc/Entities.jsx deleted file mode 100644 index 62e235a8..00000000 --- a/src/templates/Javadoc/Entities.jsx +++ /dev/null @@ -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 && ( -

{title}

- )} - {item - .filter(item => item.name === name) - .map((item, index) => { - if (item.name === '@param') { - const splitText = item.text.split(' ') - return ( -
- - {splitText[0]} - -

{item.text.replace(splitText[0], '')}

-
- ) - } - - return
{item.text}
- })} - - ) -} - -const Entities = ({ javadoc }) => { - return Object.entries(javadoc).map(([key, value]) => ( -
-

- {cleanPaths(key)} -

- -

{value[0][0].text}

- - {value.map((item, index) => { - if (index === 0) return - - return ( -
-

Function Name

- -

{item[0].text}

- - {filterPropertyItems(item, '@param')} - {filterPropertyItems(item, '@return')} - {filterPropertyItems(item, '@throws')} -
- ) - })} -
- )) -} - -export default Entities diff --git a/src/templates/Javadoc/Entities.module.scss b/src/templates/Javadoc/Entities.module.scss deleted file mode 100644 index 946aeee8..00000000 --- a/src/templates/Javadoc/Entities.module.scss +++ /dev/null @@ -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; -} diff --git a/src/templates/Javadoc/Toc.jsx b/src/templates/Javadoc/Toc.jsx deleted file mode 100644 index 86c45e00..00000000 --- a/src/templates/Javadoc/Toc.jsx +++ /dev/null @@ -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 ( -
  • - - {entity} - -
  • - ) - }) - - render() { - return ( - - {this.items} - - ) - } -} diff --git a/src/templates/Javadoc/index.jsx b/src/templates/Javadoc/index.jsx deleted file mode 100644 index 7d57dd1f..00000000 --- a/src/templates/Javadoc/index.jsx +++ /dev/null @@ -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 ( - <> - - - - - - - - - - -
    - -
    - - - {version} - -

    - {namespace} -

    - - } - /> - - -
    -
    -
    -
    - - ) - } -} - -export const JavadocQuery = graphql` - query { - allSectionsYaml { - edges { - node { - title - description - link - } - } - } - } -` diff --git a/src/templates/Javadoc/index.module.scss b/src/templates/Javadoc/index.module.scss deleted file mode 100644 index 121cf527..00000000 --- a/src/templates/Javadoc/index.module.scss +++ /dev/null @@ -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; -} diff --git a/src/templates/Javadoc/utils.js b/src/templates/Javadoc/utils.js deleted file mode 100644 index 8ddc0264..00000000 --- a/src/templates/Javadoc/utils.js +++ /dev/null @@ -1,2 +0,0 @@ -export const cleanPaths = path => - path.replace('src/main/java/com/oceanprotocol/squid/', '')