Ticket #6495: trac_6495-script-jhp-link.sh

File trac_6495-script-jhp-link.sh, 2.2 KB (added by jhpalmieri, 7 years ago)

script used to generate "part 1" patch

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    ln -s ../conf_sub.py $f/conf.py
23    cat >> $f/index.rst <<EOF
24
25.. include:: ../footer.txt
26EOF
27
28    hg add $f/conf.py
29done
30
31ln -s ../conf_sub.py combinat/conf.py
32hg add combinat/conf.py
33# in combinat/index.rst: change "../sage/combinat/blah" to "sage/combinat/blah"
34sed -e "s|\.\./||" -i '' combinat/index.rst
35
36cat >> combinat/index.rst <<EOF
37
38.. include:: ../footer.txt
39EOF
40
41for f in environ.rst options.rst startup.rst
42do
43    hg rename $f cmd/
44done
45
46for f in polynomial_rings_infinite.rst polynomial_rings_laurent.rst polynomial_rings_multivar.rst polynomial_rings_toy_implementations.rst polynomial_rings_univar.rst
47do
48    hg rename $f polynomial_rings/
49done
50
51hg rename other/sagetex.rst misc/sagetex.rst
52
53hg rename media/modular/arithgroup/pairing.png arithgroup/media/pairing.png
54
55for d in combinat graphs homology; do
56    mkdir -p $d/media
57    for f in `ls media/$d`; do
58        hg rename media/$d/$f $d/media/$f
59    done
60done
61
62hg commit -l /dev/stdin -u "J. H. Palmieri <palmieri@math.washington.edu>" <<EOF
63Trac #6495: Break reference manual into manageable pieces.
64
65doc/en/reference: move MODULE.rst to MODULE/index.rst, create MODULE/conf.py.
66Add ".. include:: ../footer.txt" to the end of each file MODULE/index.rst.
67Move media files from media/ to MODULE/media/
68Remove chapter cross-references (".. _ch:...") from MODULE/index.rst
69EOF