Ticket #6495: trac_6495-script-jhp.sh

File trac_6495-script-jhp.sh, 2.7 KB (added by jhpalmieri, 7 years ago)
Line 
1#!/usr/bin/env bash
2
3set -e
4
5hg() {
6    sage --hg --verbose "$@"
7}
8
9
10if [[ `pwd` != */doc/en/reference ]]; then
11    echo "Must be run in devel/sage/doc/en/reference/"
12    exit 1
13fi
14
15for f in algebras arithgroup calculus categories cmd coding coercion constants cryptography databases finance finite_rings function_fields functions games geometry graphs groups hecke history_and_license homology interfaces lfunctions libs logic matrices misc modabvar modfrm modmisc modsym modules monoids notebook number_fields numerical padics parallel plane_curves plot3d plotting polynomial_rings power_series probability quadratic_forms quat_algebras rings rings_numerical rings_standard sat schemes semirings stats structure tensor
16do
17    hg rename $f.rst $f/index.rst
18    # delete lines of the form ".. _ch:blah"
19    sed -e 's|^\.\. _ch:.*$||' -i '' $f/index.rst
20    # remove resulting blank lines from top of file
21    sed -e '/./,$!d' -i '' $f/index.rst
22    cat >$f/conf.py <<EOF
23# -*- coding: utf-8 -*-
24# This file is execfile()d with the current directory set to its
25# containing dir.
26#
27# The contents of this file are pickled, so don't put values in the
28# namespace that aren't pickleable (module imports are okay, they're
29# removed automatically).
30#
31# All configuration values have a default; values that are commented
32# out serve to show the default.
33
34# See the parent directory's conf_sub module for details.
35import sys
36sys.path.append('..')
37from conf_sub import *
38EOF
39    cat >> $f/index.rst <<EOF
40
41.. include:: ../footer.txt
42EOF
43
44    hg add $f/conf.py
45done
46
47cp cmd/conf.py combinat/conf.py
48hg add combinat/conf.py
49# in combinat/index.rst: change "../sage/combinat/blah" to "sage/combinat/blah"
50sed -e "s|\.\./||" -i '' combinat/index.rst
51
52cat >> combinat/index.rst <<EOF
53
54.. include:: ../footer.txt
55EOF
56
57for f in environ.rst options.rst startup.rst
58do
59    hg rename $f cmd/
60done
61
62for f in polynomial_rings_infinite.rst polynomial_rings_laurent.rst polynomial_rings_multivar.rst polynomial_rings_toy_implementations.rst polynomial_rings_univar.rst
63do
64    hg rename $f polynomial_rings/
65done
66
67hg rename other/sagetex.rst misc/sagetex.rst
68
69hg rename media/modular/arithgroup/pairing.png arithgroup/media/pairing.png
70
71for d in combinat graphs homology; do
72    mkdir -p $d/media
73    for f in `ls media/$d`; do
74        hg rename media/$d/$f $d/media/$f
75    done
76done
77
78hg commit -l /dev/stdin -u "J. H. Palmieri <palmieri@math.washington.edu>" <<EOF
79Trac #6495: Break reference manual into manageable pieces.
80
81doc/en/reference: move MODULE.rst to MODULE/index.rst, create MODULE/conf.py.
82Add ".. include:: ../footer.txt" to the end of each file MODULE/index.rst.
83Move media files from media/ to MODULE/media/
84Remove chapter cross-references (".. _ch:...") from MODULE/index.rst
85EOF