Skip to content

Commit

Permalink
Initial beta version commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyslu committed Nov 4, 2017
1 parent 58de430 commit 326c12f
Show file tree
Hide file tree
Showing 27 changed files with 12,649 additions and 1,539 deletions.
9 changes: 5 additions & 4 deletions lib/docoGenUI_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path');
const fs = require('fs');
const os = require('os');
const updateJson = require('update-json-file');
const writeJson = require('write-json');
const writeJson = require('write-json');

/* Import React modules */
const React = require('react');
Expand All @@ -21,7 +21,7 @@ const engine = {};

engine.generate_header = function(title, vers) {
let json_path = '../lib/template/data/header.json';

updateJson(json_path, function(json_obj) {
json_obj.data[0].title = title;
json_obj.data[0].vers = vers;
Expand Down Expand Up @@ -49,7 +49,7 @@ engine.generate_abstract = function(abstract) {

updateJson(json_path, function(json_obj) {
json_obj.data[0].content = [];

Object.keys(abstract).forEach(function(key) {
json_obj.data[0].content.push(abstract[key]);
});
Expand All @@ -73,7 +73,8 @@ engine.generate_reference = function(reference) {
}

engine.generate_routes = function(routes) {
let route_arr = [], route_item = {};
let route_arr = [],
route_item = {};

for (var i = 0; i < routes.length; ++i) {
route_arr.push({
Expand Down
40 changes: 18 additions & 22 deletions lib/template/components/General/Code/Code.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* Import modules */
import React from 'react';
import Highlight from 'react-highlight';

const fs = require('fs');
import Highlight from 'react-syntax-highlighter';
import { vs2015 } from 'react-syntax-highlighter/dist/styles';

/* Import Semantic-UI React components */
import { Divider, Form, Icon, Message } from 'semantic-ui-react';
Expand All @@ -18,17 +17,12 @@ class Code extends React.Component {
constructor(props) {
super(props);
this.onChange = this.onChange.bind(this);
this.handleFiles = this.handleFiles.bind(this);
}

onChange(state) {
this.setState(state);
}

handleFiles(files) {
console.log(files);
}

render() {
let dataArr = this.props.image;

Expand All @@ -53,11 +47,14 @@ class Code extends React.Component {
width: 'inherit'
}}>
<Highlight
className={this.props.lang}
style={{
margin: '0 !important'
}}>
{ this.props.raw }
language={this.props.lang}
lineNumberContainerStyle={{
float: 'left',
paddingRight: '15px'
}}
showLineNumbers={true}
style={vs2015}>
{this.props.raw}
</Highlight>
</Form>
<Message
Expand All @@ -76,8 +73,6 @@ class Code extends React.Component {
</div>
);
} else if (this.props.src != undefined) {
var src_data = fs.readFileSync('/Users/yungshenglu/Project/docoGen-html-ui/test/example.py', 'utf-8');

return (
<div>
<Message
Expand All @@ -98,13 +93,14 @@ class Code extends React.Component {
width: 'inherit'
}}>
<Highlight
className={this.props.lang}
style={{
margin: '0 !important'
}}>
{
src_data
}
language={this.props.lang}
lineNumberContainerStyle={{
float: 'left',
paddingRight: '15px'
}}
showLineNumbers={true}
style={vs2015}>
{this.props.src}
</Highlight>
</Form>
<Message
Expand Down
16 changes: 12 additions & 4 deletions lib/template/components/General/Text/Article.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Paragraph from './Paragraph.jsx';
import Tables from '../Table/Tables.jsx';
import Title from './Title.jsx';

const titleAs = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];

/**
* @class Article
* @extends {React.Component}
Expand All @@ -37,7 +39,7 @@ class Article extends React.Component {
return (
<div>
<Title
as='h1'
as={titleAs[this.props.titleAs]}
text={this.props.title} />
{
dataArr.map(function(item, i) {
Expand All @@ -56,6 +58,9 @@ class Article extends React.Component {

return (
<div>
<Title
as={titleAs[this.props.titleAs]}
text={this.props.title} />
{
dataArr.map(function(item, i) {
return (
Expand All @@ -72,6 +77,9 @@ class Article extends React.Component {
style={{
padding: '0 0 1.5em'
}}>
<Title
as={titleAs[this.props.titleAs]}
text={this.props.title} />
<Lists
content={this.props.content}
listParam={{
Expand All @@ -85,7 +93,7 @@ class Article extends React.Component {
return (
<div>
<Title
as='h1'
as={titleAs[this.props.titleAs]}
text={this.props.title} />
<Tables
caption={"Table Caption"}
Expand All @@ -100,7 +108,7 @@ class Article extends React.Component {
return (
<div>
<Title
as='h1'
as={titleAs[this.props.titleAs]}
text={this.props.title} />
{
dataArr.map(function(item, i) {
Expand All @@ -123,7 +131,7 @@ class Article extends React.Component {
return (
<div>
<Title
as='h1'
as={titleAs[this.props.titleAs]}
text={this.props.title} />
{
dataArr.map(function(item, i) {
Expand Down
Loading

0 comments on commit 326c12f

Please sign in to comment.