From 826bed4f266df2bd3592467ce41ef1bf5100f49d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 8 Jun 2013 18:06:16 +0100 Subject: [PATCH] Fix links from manual to converted design documents (ref target must follow index declaration, not precede it). Fix conversion of citations when an element is missing. Converted design documents depend on the converter. Copied from Perforce Change: 182638 ServerID: perforce.ravenbrook.com --- mps/manual/source/design/old.rst | 4 ++++ mps/manual/source/extensions/mps/designs.py | 20 ++++++++++---------- mps/manual/source/pool/intro.rst | 8 ++++++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/mps/manual/source/design/old.rst b/mps/manual/source/design/old.rst index 29525beab6d..38d22aa270d 100644 --- a/mps/manual/source/design/old.rst +++ b/mps/manual/source/design/old.rst @@ -40,6 +40,8 @@ Old design poollo poolmfs poolmrg + poolmv + poolmvt poolmvff prot protan @@ -54,7 +56,9 @@ Old design shield splay sso1al + strategy telemetry + tests thread-manager thread-safety trace diff --git a/mps/manual/source/extensions/mps/designs.py b/mps/manual/source/extensions/mps/designs.py index 8787037076c..22f9e481c67 100644 --- a/mps/manual/source/extensions/mps/designs.py +++ b/mps/manual/source/extensions/mps/designs.py @@ -50,15 +50,15 @@ def secnum_sub(m): # .. [THVV_1995] "Structure Marking"; Tom Van Vleck; 1995; # . # to: -# .. [THVV_1995] Tom Van Vleck. 1995. "`Structure Marking `__". +# .. [THVV_1995] Tom Van Vleck. 1995. "`Structure Marking `__". citation = re.compile( r''' - \.\.\s+(?P\[.*?\])\s* - "(?P.*?)"\s* - ;\s*(?P<author>.*?)\s* - (?:;\s*(?P<organization>.*?)\s*)? + ^\.\.\s+(?P<ref>\[.*?\])\s* + "(?P<title>[^"]*?)"\s* + ;\s*(?P<author>[^;]*?)\s* + (?:;\s*(?P<organization>[^;]*?)\s*)? ;\s*(?P<date>[0-9-]+)\s* - (?:;\s*<\s*(?P<url>.*?)\s*>\s*)? + (?:;\s*<\s*(?P<url>[^>]*?)\s*>\s*)? \. ''', re.VERBOSE | re.MULTILINE | re.IGNORECASE | re.DOTALL @@ -96,7 +96,7 @@ def convert_file(name, source, dest): # to the whole document. m = index.search(s) if m: - s = index_sub(m) + s + s = index_sub(m) + '.. _design-{0}:\n\n'.format(name) + s s = mode.sub(r'', s) s = prefix.sub(r'.. mps:prefix:: \1', s) s = rst_tag.sub(r'', s) @@ -116,7 +116,6 @@ def convert_file(name, source, dest): except: pass with open(dest, 'w') as out: - out.write('.. _design-{0}:\n\n'.format(name)) out.write(s) # Mini-make @@ -126,7 +125,8 @@ def convert_updated(app): name = os.path.splitext(os.path.basename(design))[0] if name == 'index': continue converted = 'source/design/%s.rst' % name - if (not os.path.isfile(converted) or - os.path.getmtime(converted) < os.path.getmtime(design)): + if (not os.path.isfile(converted) + or os.path.getmtime(converted) < os.path.getmtime(design) + or os.path.getmtime(converted) < os.path.getmtime(__file__)): app.info('converting design %s' % name) convert_file(name, design, converted) diff --git a/mps/manual/source/pool/intro.rst b/mps/manual/source/pool/intro.rst index af209eca085..f94336a4194 100644 --- a/mps/manual/source/pool/intro.rst +++ b/mps/manual/source/pool/intro.rst @@ -23,11 +23,13 @@ of pools, choosing the most appropriate pool class for each. First, do you need the MPS to :term:`automatically <automatic memory management>` :term:`reclaim` :term:`unreachable` blocks? If so, you need an automatically managed (garbage collected) pool class and you -should consult :ref:`Choosing an automatic pool class` below. +should consult :ref:`pool-choose-automatic` below. Otherwise, you need a manually managed pool class and you should -consult :ref:`Choosing a manual pool class` below. +consult :ref:`pool-choose-manual` below. +.. _pool-choose-automatic: + Choosing an automatic pool class -------------------------------- @@ -60,6 +62,8 @@ no weak nothing suitable ====================== =========== =================== +.. _pool-choose-manual: + Choosing a manual pool class ----------------------------