% Artifact
The main purpose of this document is to provide a comprehensive demo project for Marko Gem. The other technical purpose is to have Marko Sandbox for testing and development.
The problem of of managing large structured texts (articles, books, specific structured documents) affects the authors of such texts the impact of which is the text management process itself became a pain as the text groves and the structure evolves a successful solution would be a software that provides
- a simple markup that is easy to write and read by humans and machines
- the ability to manage the text as a bunch of structured separate files
- the ability to publish the text and share it audience
- the ability to collaborate between the authors working together on the text
- the ability to automate some content processing tasks
For authors of large structured texts Who need simple reliable text management process The Marko Markup Compiler is a free text management scripting software That utilizes the docs-as-code approach Unlike other competitive approaches like using word processors, Wiki system, or dedicated content publishing systems Our product does not require any special environment and can be adopted in any text environment.
The Marko provides you with:
- the simple markup based on Markdown, extended by tree hierarchy helpers
- the text repository is just a free directory structure inside the file system
- the text tree hierarchy of nodes that present your text pieces
- the ability to automate content processing tasks by providing a scripting layer
Having large structured texts as just a bunch of plain text files, one can
- use any convenient text editor
- work together with other authors in the Git repository
- use any available text processing tools
The developed system will provide the following components:
- the simple markup format with abilities to build a tree hierarchy
- the markup parser that will turn markup sources into programmable objects
- the markup tree assembler that will build a single tree hierarchy
- the markup tree compiler that will turn the markup tree into deliverables
- the Marko Promo project that will help the users adopt the approach
CLI
: Command-line interface
ERB
: Ruby Templating system
The remaining sections of this document requirements to the system. The document structured the manner of software requirements specification, where one can find descriptions of Users, Use Cases, Functional Requirements, and Interface Requirements.
The users of the system are different people who play for authoring various sorts of technical documentation. It might be a technical writer, business/systems analyst, developer, etc.
Id ur
Id uc
Id uc.create
The scenario is used when the user wants to create a new Marko artifact project
Main Flow
- The user requests the system to create a new project passing the directory name for the project.
- The system checks the directory does not exist; directory des not exist.
- The system creates the directory and furnish it with basic Marko structure.
- The system reports to the user about created directories and files.
- The scenario is finished
Extensions
[2a]{.underline} The directory exists: The system reports to the user that the directory exits. The scenario if finished.
Id uc.manage
[Outside the system]{.underline} scenario of managing the artifact sources, templates, automated tasks.
Main Flow
[Outside the system]{.underline}
- The user creates, modifies, removes markup files inside
src
directory of Marko project (created by Create a new project scenario.) - The user creates, modifies, removes templates for the artifact compilation.
- The user creates, modifies, removes automation tasks.
Id uc.compile
The scenario is used when the user wants to compile the artifact from the artifact sources
Prerequisites
- The user inside Marko project (see Create a new project)
Main Flow
- The user requests the system to compile the project sources into the artifact passing compilation template.
- The system read the artifact sources and assembles it into the artifact tree; no errors detected.
- The system compiles the artifact tree into single artifact using provided template.
- The system reports compiled artifact filename to the user.
- The scenario is finished.
Extensions
[2a]{.underline} The system detected markup errors inside sources: The system reports the errors found to the user; the scenario is finished.
[2b]{.underline} The system detected tree structure errors during the assembling stage: The system reports the errors found to the user; the scenario is finished.
Id uc.automate
Basically, Marko assembles artifacts from markup sources, but there are cases when user wants to add some information from other sources like UI/UML/ER design tools, some prepared data files in whatever it could be form. Sometimes the user wants to modify or remove some content inside the markup sources.
Such tasks could be automated by intervening into the artifact tree between assemblage and compilation stages.
Main Flow
- The user design one or more automation scripts
- The user injects the automation scripts into compilation process
Id fr
Id fr.treenode
The system shall provide Node
entity with the following properties that provide the following attributes:
Property Type Mult. Default Description
id String 1 "" Node identifier parent Node 1 null Parent node title String 1 "" Node title meta Hash 1 {} Node metadata body String 1 "" Node body items TreeNode 0..N [] Child nodes
Id fr.treenode.tree
To assemble the project artifact from nodes placed among several source files, the system shall provide the following optional tree metadata attributes:
Attribute Type Mult. Description
id String 0..1 Unique node id parent String 0..1 Parent id order_index String 0..N Children IDs
Id fr.treenode.orig
During source file parsing, the system must store the following node origin information:
Attribute Type Mult. Description
origin String 1 file name lineno String 1 file line
Id fr.markup
The main and only entity in the system is TreeNode. The system shall provide the following abilities for the entity:
Id fr.markup.node
The system shall support the following node markup.
# <title>
{{\<meta\>}}
\<body\>
Where:
- Each node starts from Markdown header mark
#
. - The header mark can be followed by node title.
- The next line might contain metadata block:
- that starts from
{{
and finishes with}}
; - that can be one or multiline string.
- that starts from
- The next lines tile the end of file or next header mark
#
are considered as node body.
Id fr.markup.01
The system shall provide function to getting all sources files from project repository.
Id fr.markup.02
The system shall provide the function to parse source file.
During the parsing process the system must record source information within the node parsed, such as origin file name and the number of line inside the origin where the node begins. This information must be stored inside metadata as Source Metadata.
Input
Parameter | Type | Mult. | Description |
---|---|---|---|
filename | String | 1 | filename |
Output
Parameter | Type | Mult. | Description |
---|---|---|---|
node | TreeNode | 0..N | node parsed |
Id fr.markup.03
The system shall provide the function to assemble the artifact tree. The artifact tree is assembled based on Tree Metadata.
Input
Parameter | Type | Mult. | Description |
---|---|---|---|
node | TreeNode | 0..N | node collection |
Output
Parameter | Type | Mult. | Description |
---|---|---|---|
node | TreeNode | 1 | root node |
Id fr.markup.04
The system shall provide each node with unique node Id. Some nodes can already have id from source files, especially those that referenced as parent or child and placed in separate files. For those nodes that still have empty id, the system must generate auto id 0..99.
For example, when the system has assembled the tree
# Artifact
## Introduction
### Purpose
### Scope
# User Requirements #ur
# Functional Requirements #fr
and then generated id, the generated ids should be as follows:
# Artifact Title #00
## Introduction #01.01
### Purpose #01.01.01
### Scope #01.01.02
# User Requirements #ur
# Functional Requirements #fr
Input
Parameter | Type | Mult. | Description |
---|---|---|---|
root | TreeNode | 1 | root node |
Id fr.markup.05
The system shall provide the function to check assembled tree for errors related to assembling tree based on Tree Metadata. The system must check the following errors:
duplicate id
, finds two or more nodes that share the same id;unknown parent
, finds nodes that haveparent
metadata, but parent not found in the tree;unknown index
, finds nodes withorder_index
metadata where one or more children in the index not found;unknown links
, finds nodes containing links but the links are not found.
Id fr.create
The system shall provide the function to create a new project.
[Input]{.underline}
Parameter Type Mult. Description
directory string 1 project directory
[Output]{.underline}
Parameter Type Mult. Description
filename string 1..N created directory or filename
[Flow]{.underline}
- Fail "directory exits" if the
directory
already exist - Create
directory
- Create project structure
- Create basic templates
- Return list of created directories and files
Id fr.assemble
The system shall provide the function to assemble the artifact.
[Input]{.underline}
- NO PARAMETERS
[Output]{.underline}
Parameter | Type | Mult. | Description |
---|---|---|---|
tree | TreeNode | 1 | assembled tree |
Flow
- Get list of the project sources
- Parse sources collecting parsing errors.
- Fail with the list of parsing errors when any.
- Assemble the artifact tree based on id, parent, and order_index metadata collecting tree errors.
- Fail with the list of tree errors if any.
- Generate auto IDs for nodes without ID.
- Return artifact tree
Id fr.compile
The system shall provide the function to create deliverable artifact.
[Input]{.underline}
Parameter | Type | Mult. | Description |
---|---|---|---|
tree | TreeNode | 0..1 | assembled tree |
template | String | 1 | rendering template |
filename | String | 1 | output artifact filename |
[Output]{.underline}
Parameter Type Mult. Description
filename String 1 output artifact filename
[Flow]{.underline}
- Assemble the artifact tree by invoking Assemble artifact unless
tree
parameter provided - Load template body from
template
- Backup
filename
to<filename>~
when esists - Render
template
for each node oftree
- Save rendered template into
filename
- Return
filename
Id ui
Id ui.cli
The system shall provide the command-line interface. The interface must provide the following commands:
Id ui.cli.01
The system shall provide the new PROJECT
command. When the user requests the new PROJECT
command, the system must call Create project.
Id ui.cli.02
The system shall provide the compile [-t TEMPALTE] [-o FILENAME]
command. When the user requests the compile
command, the system must call Compile artifact.
Id ui.gem
The system shall provide Ruby Gem with the following functions
Id ui.gem.01
Id ui.gem.02
The user will utilize his preferred text editor so no other UI requirement
The user will utilize Git so no other version management or access management requirements
The user will publish deliverables by using Pandoc so there are no publishing requirements