-
Notifications
You must be signed in to change notification settings - Fork 1
Script Structure json
Kevin Cyu edited this page Nov 22, 2017
·
7 revisions
- docoGen structure is formed by
JSON, and has its special file extension called.docogen - Lately before version
0.1.0, we supportmarkdownformat to generate LaTeX, too! - Simply can separate to 2 parts:
Main StructureandOptional Structure - And we will discuss each part in the following chapter.
- Complete demonstration goes here.
// The entire docoGen look like this:
{
title: ... ,
options: ...,
author: [ ... ],
article: [ ... ],
reference: [ ... ]
}- If you have multiple docogen files, only one file need to include this structure.
- Elements of Main structure
-
title: the big title of generated paper. -
options: some optional configuration of generating work.-
type: the type of LaTeX paper.
-
{ ... /* only used in LaTeX */ options: { type: "article" , ... } }
-
author: the author/collaborator of this paper.
{ ... author: [ { name: "author 1", email: "...", phone: "...", website: "..." }, ... ] }
-
abstract: some words/sentences of this paper.
{ ... /* using string array */ abstract: [ "sentence 1" ,"sentence 2" , ... ] }
article[optional]reference[optional]
-
- Those elements can be placed at any docogen file under your project.
- When using module
docogento generate document page/pdf, the docogen system will collect and merge all the docogen files, and usingpriorityin yourarticleto sort those merged article. - Elements of Optional structure
-
article: different kinds of content. -
reference: using\\cite{...(reference_name)}in the content and then can use reference! And you can put your reference in any docogen file.
-
- In this section, we will show you the functionality of each field in docogen.
- And it will continuously being modified, updated.
- Title of this article.
- Because we support user using multiple docogen files at once, so we create priority to represent the order of article.
- The priority order can range from negative number to positive number, any number you pick, the docoGen will sort them by priority. (from negative to positive)
- Each
articleelement will store the main data/info object incontentfield. - Have
namefield to specify the title of this content. - And put the data object into
datafield, usingtypefield to decide which storage format ofdatafield would be. - Next, we will discuss
typeofdatain each content.
-
none: only enlarge thenamefield, and then append thedata[...].info(text) ( indata(array) ) under this title.
// content with "none"
{
name: "content title",
type: "none",
data: [
{ info: "your word here" }
]
}-
text: Treat as unordered list in LaTeX, and eachdata[...].infoequal to an item in this part of content.
// content with "text" (almost same as "none" type)
{
name: "content title",
type: "text",
data: [
{ info: "your word here" }
]
}-
list: here comes the format of list- Each
namerepresent as one item of list, and in the same array will in same layer of list structure. - If one list item have the subitems of it, just using the same structure in
subitems. Otherwise, don't need to addsubitemsfield. - e.g.
{ name: "List 1", subitems: [] },{ name: "List 2" } - Each
- using our table style.
- the necessary attributes:
- column name
- colum size(by the length of data)
- tablen title
- each column value(array)
{
name: "content title",
type: "table",
data: [
{
title: "Col 1 title",
value: [ "Col-1-value1", "Col-1-value2", "Col-1-value3" ]
},
{ ... }
]
}
- support
info,inline,displayandequation4 categories.-
info: normal words -
inline: inline mode of mathematic representation. -
display: display mode of mathematic representation. -
equation: enclose by {equation} tag.
-
- you can also merge those field together (any combination with 4 type) within one block, and it will be in the order of
info->inline->display->equation.
{
name: "content title",
type: "formula",
data: [
{ info: "normal sentence(doesn't contain any mathmetic equation)" },
{ inline: "math equation(with "( )"), e.g. \(x^2 + y^2 = z^2\) },
{ display: "math equation(with "[ ]"), e.g. \[ x^n + y^n = z^n \])" },
{ equation: "math equation(which will be enclose by \begin{equation} tag)" },
// Merged format ->
{
info: ...,
display: ...
}
]
}
- support 2 type of format, if you want to include a large example, you can use
srcfield; And if you just want to show a small instance, you can userawfield. (See the example down below) - after
0.1.3, relative code file path is available! -
Reminder: default value of
flagisrel(relative)!
{
name: "content title",
type: "code",
data: [
{
// Type 1
lang: "your language (e.g. C, C++, matlab, ... etc)",
caption: "your caption about the following instance",
src: "the absolute path to your code"
},
{
// Type 2
lang: "your language (e.g. C, C++, matlab, ... etc)",
caption: "your caption about the following instance",
raw: "put your code content directly"
},
{
// Type 3 (relative usage)
lang: "your language (e.g. C, C++, matlab, ... etc)",
flag: "rel"
caption: "your caption about the following instance",
src: "the relative path to your code"
},
{ ... }
]
}
- This
figure(array) field let you put your image/figure to support your thesis/argument. - Absolutive/Relative Support. (On windows, pdfLaTeX need absolutive path; So in docoGen engine, we will do that for you)
- flag:
rel/abs - Need to set the flag (default value is
rel, if this field left blank)- If flag is
abs, we will directly use thepath(without path resolving) - If flag is
rel, we will base on the script location and do the path resolving.
- If flag is
- The format have:
{
name: "title image/figure",
type: "figure",
data: [
{
path: "absolute path of your image",
flag: "abs/rel",
align: "alignment method of your image",
size: "size of your image",
caption: "caption of image/figure"
}, { ... }
]
}
- Web extension support
{
name: "Restful api support",
type: "web-restful-api",
data: [
{
method: "GET/POST",
usage: "usage of this url/function",
url: "api url goes here(e.g. http://...)",
description: "detail of this url/function",
field: [ { name: "parameter field name", type: "parameter data type"}, ... ],
error: [ "error msg 1", "error msg 2", ... ],
success: [ "success msg 1", "success msg 2", ... ],
}, { ... }
]
}
- Same functionality as the figure inside content.
{
...
figure: [
{
path: "absolute path of your image",
flag: "abs/rel",
align: "alignment method of your image",
size: "size of your image",
caption: "caption of image/figure"
}, { ... }
]
}
- If your article still want to discuss more deeper, then just add the same structure introduced above in this field, and the docogen will put it into subsection and go on.
- subarticle of subarticle is available too!