Skip to content

Commit

Permalink
Documentation: Added scripts and Control Panel help as Amethyst sources
Browse files Browse the repository at this point in the history
- conhelp.py: Generate a conhelp file containing commands and variables
- makehelp.sh: Generate cphelp/conhelp for engine and games

Todo: Convert the latter to Python for platform independence.
  • Loading branch information
skyjake committed Mar 31, 2013
1 parent a41d71e commit 6947fb9
Show file tree
Hide file tree
Showing 4 changed files with 407 additions and 0 deletions.
37 changes: 37 additions & 0 deletions doomsday/build/scripts/conhelp.py
@@ -0,0 +1,37 @@
"""Generates a console help file out of Amethyst sources.
1 - output filename
2, ... - subdirs to include"""

import os
import sys
import string
import subprocess

def amethyst(input):
"""Runs amethyst with the given input and returns the output."""
p = subprocess.Popen(['amethyst', '-dHELP'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(output, errs) = p.communicate(input)
return output

outName = sys.argv[1]
components = sys.argv[2:]
modes = ['command', 'variable']

outFile = file(outName, 'w')
print >> outFile, "# Doomsday Help"
print >> outFile, "# Generated by conhelp.py out of", string.join(components, ', ')

for mode in modes:
for com in components:
print >> outFile, "#\n# CONSOLE", mode.upper() + 'S: %s\n#' % com
path = os.path.join(com, mode)
for fn in os.listdir(path):
if not fn.endswith('.ame'): continue
name = fn[:-4]
print >> outFile, "[%s]" % name

templ = '@require{amestd} @begin\n' + \
file(os.path.join(path, fn)).read()

print >> outFile, amethyst(templ)
17 changes: 17 additions & 0 deletions doomsday/build/scripts/makehelp.sh
@@ -0,0 +1,17 @@
#!/bin/sh

cd ../../doc
CONHELP=../build/scripts/conhelp.py

echo "Engine help"
python $CONHELP ../client/data/cphelp.txt engine
amethyst -dHELP engine/controlpanel.ame >> ../client/data/cphelp.txt

echo "libdoom help"
python $CONHELP ../plugins/doom/data/conhelp.txt libcommon libdoom

echo "libheretic help"
python $CONHELP ../plugins/heretic/data/conhelp.txt libcommon libheretic

echo "libhexen help"
python $CONHELP ../plugins/hexen/data/conhelp.txt libcommon libhexen
1 change: 1 addition & 0 deletions doomsday/build/scripts/wikidocs.py
Expand Up @@ -160,6 +160,7 @@ def appendCollectionToTitle(self, col):
dew.submitPage('Console variable reference', indexPage['variable'], comment)

print 'Submitting deambiguation pages...'

for amb in ambigs:
print '-', amb.title
dew.submitPage(amb.title, amb.content, comment)
Expand Down

0 comments on commit 6947fb9

Please sign in to comment.