-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User manual including toolchain for auto-generation #370
Merged
Merged
Changes from all commits
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
3b6ea90
initial checkin of api doc + manual test
peuter 7e01922
add more examples
peuter 82e45fe
add more examples
peuter 02f412c
- start spinx build system
peuter c2adc69
- fix api-doc generation
peuter 0a6e7e1
ignore screenshots
peuter 94da3ba
cleanup
peuter 2d7b900
change path
peuter 03709fa
backup commit
peuter e02b48f
fix screenshot example generation
peuter e53ea23
add missing examples
peuter 55c8987
replace XXX with widgets name
peuter 820db30
start implementation of automatic XSD information retrieval
peuter 942cf55
fix code highlighting
peuter 8f180e5
syntax fix
peuter 31d48d5
remove empty chapter
peuter 56d4ca0
refactoring
peuter dd4ccc5
add translation
peuter 6f2be79
fix editor screenshots
peuter 2846dda
allow cropping of screenshots
peuter 90728ce
more todos to readme
peuter d2edde5
hide-source fix
peuter 3a5f113
- add some basic structure
peuter f5d48b0
screenshot updates
peuter be772d2
changes for deployment script
peuter 7c0bf44
add encypted deploy key
peuter bebec4e
add deployment script
peuter 7d230bd
some changes
peuter 27ed8ac
make sure that the deploy_key does not get commited
peuter b1e89b1
use the right path
peuter b356c18
setup doc build environment
peuter 1dd3fd4
use python3
peuter 58725c4
try to make plantuml installable
peuter e389539
add missing dep
peuter 20af830
add encoding to python source files
peuter de0b7ac
use firefox for screenshots on travis
peuter b10b686
some changes to allow browserName to be changed
peuter 59be562
install easyimage package
peuter 7ad4f0e
fir parameter
peuter 4866b95
use the correct install tool
peuter ae0dbf4
cleanup
peuter 6f56b45
add some debugging code
peuter dceab77
split into single tasks
peuter 091300d
use the right task
peuter 5978426
remove generation from deploy script, let travis do the single tasks
peuter 90a5ff9
some update to test the build/deployment
peuter 68a948d
some update to test the build/deployment
peuter bbfb898
reactive deployment
peuter 384d063
and back to the deploy again
peuter 76c15a2
another try
peuter eb71e06
structural change
peuter 1d167cf
show some dirs
peuter 0ae0184
another try
peuter 53a8224
allow removal of files when commiting generated docs
peuter 5e14f6c
try to fix api doc links to screenshots
peuter 9bef49c
we're getting closer
peuter e5168ed
we're getting closer
peuter cc6dcdd
add xml lang hint to examples
peuter 97af007
add the lang hint after caption
peuter d208165
delete api doc from repo as it is hosted in the gh-pages branch
peuter 97ef2f1
hide toctree
peuter fe94a09
print invalid config
peuter e9d6502
check version
peuter 9de9eb7
change language
peuter 67a7024
use python3
peuter 2c35275
delete screenshots
peuter aeeed85
delete markdown test files
peuter 1835f4b
install pip3
peuter 00ab5a4
use another distribution
peuter 4713d81
another try to install pip3
peuter c4c7116
another try to install pip3
peuter bc847bb
gmrpf
peuter f6c70e7
check
peuter 5bd8bde
check
peuter f5d9299
remove python2 code does not work
peuter 1003590
revert changes
peuter 10b1169
show version
peuter c8ef779
another try
peuter 99e57fe
upgrade
peuter d741d25
upgrade
peuter 675d3a5
remove auto-generated files
peuter 65bb959
remove line
peuter 4e9a254
disable plantuml for now
peuter 7967e34
disable plantuml for now
peuter 3be5348
refactor widget example structure to allow simple c&p from real configs
peuter 63e837b
try to install plantuml manually
peuter 5f7aa27
fullfill dependency
peuter ff698c5
remove xsltproc from build
peuter 5671b89
remove finished TODOs
peuter 587fc5b
allow api-doc to create only jsdoc screenshots
peuter d73ea94
try to use chrome for screenshots
peuter 4bfa8d0
try to use chrome for screenshots
peuter d07ca85
make it executable
peuter 736566f
a little bit more tweaking
peuter f728b2e
some cleanup + re-added the auto-generated widget pages again
peuter 2458943
change paths
peuter 751e992
add wip hint
peuter 451b0f4
change deployment branch
peuter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Setup documentation build system | ||
-------------------------------- | ||
|
||
Source docs | ||
----------- | ||
Install required packages | ||
``` | ||
npm install jsdoc libxmljs-mt libxml-xsd easyimage | ||
``` | ||
|
||
generate doc with | ||
``` | ||
grunt apt-doc | ||
``` | ||
|
||
User Manual | ||
----------- | ||
Install libxml2, libxslt development files and plantuml (e.g. `apt-get install libxml2-dev libxslt-dev plantuml`) | ||
Install required python3 packages specified in .doc/docutils/requirements.txt | ||
Note: pip install sh must be installed as root `sudo pip install sh` | ||
(and python3 if it is not installed on your system) | ||
|
||
generate doc with: | ||
``` | ||
sphinx-build -b html doc/manual/de/rst/ doc/manual/de/html | ||
``` | ||
|
||
Translation | ||
----------- | ||
``` | ||
# update po files | ||
pygettext -d cv -p locale/ .doc/docutils/directives/*.py | ||
# translate with poedit + save | ||
``` | ||
|
||
TODOs | ||
----- | ||
|
||
TODO: possibility to map attribute names to links | ||
TODO: improve element description retrieval from XSD, possibility to extend | ||
TODO: transfer content from wiki | ||
TODO: establish structure for manual (done for widgets) | ||
TODO: cleanup, doc | ||
|
||
Optional | ||
-------- | ||
|
||
* auto-generate english widget descriptions from jsdoc |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
if [ "$CV_BROWSER" = "" ]; then | ||
exit 0 | ||
fi | ||
|
||
if [ $CV_BROWSER = Firefox ]; then | ||
wget -O /tmp/firefox.tar.bz2 "https://download.mozilla.org/?product=firefox-${CV_VERSION}&lang=en-US&os=linux64" | ||
tar xf /tmp/firefox.tar.bz2 | ||
else | ||
wget -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-${CV_VERSION}_current_amd64.deb | ||
dpkg --extract /tmp/chrome.deb chrome-x | ||
if [ $CV_VERSION = stable ]; then | ||
mv chrome-x/opt/google/chrome chrome | ||
mv chrome/google-chrome chrome/google-chrome-stable | ||
else | ||
mv chrome-x/opt/google/chrome-$CV_VERSION chrome | ||
rm chrome/google-chrome | ||
fi | ||
ln -s google-chrome-$CV_VERSION chrome/google-chrome | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
set -e # Exit with nonzero exit code if anything fails | ||
|
||
SOURCE_BRANCH="develop" | ||
TARGET_BRANCH="gh-pages" | ||
|
||
function createDocs { | ||
sphinx-build -b html doc/manual/de out/de/manual | ||
grunt jsdoc:html --targetDir=out/api | ||
grunt screenshots --browserName=chrome | ||
sphinx-build -b html doc/manual/de out/de/manual | ||
} | ||
|
||
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then | ||
echo "Skipping deploy;" | ||
exit 0 | ||
fi | ||
|
||
if [ "$SOURCE_BRANCH" != "master" ]; then | ||
echo "ATTENTION! Deploying docs from non master branch. Please change this!!!" | ||
fi | ||
|
||
|
||
# Save some useful information | ||
REPO=`git config remote.origin.url` | ||
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} | ||
SHA=`git rev-parse --verify HEAD` | ||
|
||
# Clone the existing gh-pages for this repo into out/ | ||
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply) | ||
git clone $REPO out | ||
cd out | ||
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH | ||
cd .. | ||
|
||
# Clean out existing contents | ||
rm -rf out/**/* || exit 0 | ||
|
||
# Run our creation script | ||
createDocs | ||
|
||
# Now let's go have some fun with the cloned repo | ||
cd out | ||
git config user.name "Travis CI" | ||
git config user.email "$COMMIT_AUTHOR_EMAIL" | ||
|
||
# If there are no changes to the compiled out (e.g. this is a README update) then just bail. | ||
if [ -z `git diff --exit-code` ]; then | ||
echo "No changes to the output on this push; exiting." | ||
exit 0 | ||
fi | ||
|
||
# Commit the "changes", i.e. the new version. | ||
# The delta will show diffs between new and old versions. | ||
git add --all . | ||
git commit -m "Deploy to GitHub Pages: ${SHA}" | ||
|
||
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc | ||
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" | ||
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" | ||
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} | ||
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} | ||
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../.doc/deploy_key.enc -out deploy_key -d | ||
chmod 600 deploy_key | ||
eval `ssh-agent -s` | ||
ssh-add deploy_key | ||
|
||
# Now that we're all set up, we can push. | ||
git push $SSH_REPO $TARGET_BRANCH |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# copyright (c) 2010-2016, Christian Mayer and the CometVisu contributers. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the Free | ||
# Software Foundation; either version 3 of the License, or (at your option) | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# copyright (c) 2010-2016, Christian Mayer and the CometVisu contributers. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the Free | ||
# Software Foundation; either version 3 of the License, or (at your option) | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
||
from docutils import statemachine | ||
from docutils.parsers.rst import Directive | ||
from os import path | ||
from helper.schema import * | ||
import gettext | ||
gettext.install('messages', localedir='locale') | ||
|
||
type_mapping = { | ||
'boolean': "true %s false" % _('or'), | ||
'string': _('string'), | ||
'decimal': _('decimal') | ||
} | ||
|
||
schema = Schema(path.join("src", "visu_config.xsd")) | ||
|
||
|
||
class BaseDirective(Directive): | ||
locale = 'en' | ||
|
||
def init_locale(self): | ||
#locale = self.state_machine.document.settings.language_code | ||
# this is a hack, but as language_code settings returns 'en' its the only known way to get the locale | ||
self.locale = self.state_machine.document.settings._source.split(path.sep +"manual" + path.sep, 1)[1].split(path.sep)[0] | ||
t = gettext.translation('messages', localedir='locale', languages=[self.locale]) | ||
t.install() | ||
|
||
|
||
class BaseXsdDirective(BaseDirective): | ||
|
||
def get_cell_data(self, content): | ||
return 0, 0, 0, statemachine.StringList( content.splitlines()) | ||
|
||
def normalize_values(self, values): | ||
if len(values) <= 1: | ||
return (" %s " % _("or")).join(values) | ||
else: | ||
return " ".join([", ".join(values[0:-1]), _("or"), values[-1]]) | ||
|
||
def normalize_type(self, type): | ||
if type[0:4] == "xsd:": | ||
type = type[4:] | ||
return type_mapping[type] if type in type_mapping else type | ||
|
||
def generate_table(self, element_name): | ||
table_body = [] | ||
for attr in schema.get_widget_attributes(element_name): | ||
if 'name' in attr.attrib: | ||
name = attr.get('name') | ||
atype, values = schema.get_attribute_type(attr) | ||
description = schema.get_node_documentation(attr, self.locale) | ||
if description is not None: | ||
description = description.text | ||
else: | ||
description = '' | ||
elif 'ref' in attr.attrib: | ||
name = attr.get('ref') | ||
type_def = schema.get_attribute(name) | ||
atype, values = schema.get_attribute_type(type_def) | ||
description = schema.get_node_documentation(type_def, self.locale) | ||
if description is not None: | ||
description = description.text | ||
else: | ||
description = '' | ||
|
||
if attr.get('use', 'optional') == "required": | ||
name += "*" | ||
|
||
atype = self.normalize_type(atype) if len(values) == 0 else self.normalize_values(values) | ||
row = [self.get_cell_data(name), self.get_cell_data(atype), self.get_cell_data(description)] | ||
table_body.append(row) | ||
|
||
if len(table_body) == 0: | ||
return None | ||
|
||
table_head = [[self.get_cell_data(_('Name')), self.get_cell_data(_('Type')), self.get_cell_data(_('Description'))]] | ||
table = ([20, 20, 60], table_head, table_body) | ||
|
||
table_node = self.state.build_table(table, self.content_offset) | ||
table_node['classes'] += self.options.get('class', []) | ||
|
||
return table_node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# copyright (c) 2010-2016, Christian Mayer and the CometVisu contributers. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the Free | ||
# Software Foundation; either version 3 of the License, or (at your option) | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
|
||
from docutils import nodes | ||
from docutils.parsers.rst import directives | ||
from common import BaseXsdDirective, schema | ||
import gettext | ||
gettext.install('cv', localedir='locale') | ||
|
||
|
||
class ElementsInformationDirective(BaseXsdDirective): | ||
""" | ||
reStructuredText directive for information about allowed child elements. Extracts information for the given element from | ||
the visu_config.xsd file and adds it to the document. | ||
|
||
..elements_information:: <element-name> | ||
|
||
@author Tobias Bräutigam | ||
@since 0.10.0 | ||
""" | ||
required_arguments = 1 | ||
optional_arguments = 0 | ||
final_argument_whitespace = True | ||
option_spec = {} | ||
has_content = False | ||
|
||
def make_title(self, element): | ||
if element.get("name", None) is not None: | ||
name = element.get("name") | ||
if element.get("minOccurs") is not None and int(element.get("minOccurs")) > 0: | ||
name += "*" | ||
text_nodes, messages = self.state.inline_text(name, | ||
self.lineno) | ||
title = nodes.title(name, '', *text_nodes) | ||
else: | ||
title = None | ||
messages = [] | ||
return title, messages | ||
|
||
def run(self): | ||
self.init_locale() | ||
|
||
element_name = self.arguments[0] | ||
res_nodes = [] | ||
|
||
for element in schema.get_widget_elements(element_name): | ||
title, messages = self.make_title(element) | ||
|
||
table_node = self.generate_table(element.get("name")) | ||
if table_node is not None: | ||
if title is not None: | ||
table_node.insert(0, title) | ||
|
||
res_nodes.append(table_node) | ||
|
||
return res_nodes | ||
|
||
directives.register_directive("elements_information", ElementsInformationDirective) |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need that file like that - or should we first check whether a browser is already installed (most likely allways the case...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no chrome installed in the travis images,so we have to install it.