rda-python-miscs 2.0.4__tar.gz → 2.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/PKG-INFO +1 -1
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/pyproject.toml +1 -1
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/pg_rst.py +65 -77
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rst_templates/index.rst.temp +3 -15
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rst_templates/section.rst.temp +2 -6
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/PKG-INFO +1 -1
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/LICENSE +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/MANIFEST.in +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/README.md +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/setup.cfg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/__init__.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/bash_qsub.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/bashqsub.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/bashqsub.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/gdex_ls.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/gdexls.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/gdexls.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/gdexls_standalone.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/pg_docs.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/pg_wget.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/pgwget.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_cp.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_kill.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_mod.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_own.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_ps.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_sub.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rda_zip.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdacp.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdacp.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdakill.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdakill.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdals.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdals.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdamod.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdamod.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdaown.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdaown.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdaps.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdaps.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdasub.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdasub.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdazip.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rdazip.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rst_templates/toc.rst.temp +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/tcsh_qsub.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/tcshqsub.py +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/tcshqsub.usg +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/SOURCES.txt +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/dependency_links.txt +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/entry_points.txt +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/requires.txt +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/top_level.txt +0 -0
- {rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/tests/test_miscs.py +0 -0
|
@@ -22,7 +22,6 @@ from os import path as op
|
|
|
22
22
|
from rda_python_common.pg_file import PgFile
|
|
23
23
|
from rda_python_common.pg_util import PgUtil
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
class PgRST(PgFile, PgUtil):
|
|
27
26
|
"""Convert text-based program usage documents (.usg files) into
|
|
28
27
|
reStructuredText (.rst) files using RST template files.
|
|
@@ -48,7 +47,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
48
47
|
Q0 = "'"
|
|
49
48
|
Q1 = "**" # RST bold open (was "<i><b>")
|
|
50
49
|
Q2 = "**" # RST bold close (was "</i></b>")
|
|
51
|
-
|
|
50
|
+
TLEVEL = 3 # max section level to be rendered (1, 2, or 3)
|
|
52
51
|
EMLIST = {
|
|
53
52
|
'dsarch' : 1,
|
|
54
53
|
'msarch' : 1,
|
|
@@ -60,7 +59,6 @@ class PgRST(PgFile, PgUtil):
|
|
|
60
59
|
'rcm' : 1,
|
|
61
60
|
'dcm' : 1,
|
|
62
61
|
}
|
|
63
|
-
|
|
64
62
|
SEARCH = "(Action|Info|Mode|Multi-Value|Single-Value)"
|
|
65
63
|
|
|
66
64
|
def __init__(self):
|
|
@@ -116,7 +114,6 @@ class PgRST(PgFile, PgUtil):
|
|
|
116
114
|
'DOCTIT' : "", # document name in upper case letters
|
|
117
115
|
'DOCLNK' : None,
|
|
118
116
|
}
|
|
119
|
-
|
|
120
117
|
self.LINKS = ['dsarch', 'dsupdt', 'dsrqst', 'dscheck']
|
|
121
118
|
|
|
122
119
|
#
|
|
@@ -129,7 +126,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
129
126
|
|
|
130
127
|
This is the main entry point. It populates ``self.sections``,
|
|
131
128
|
``self.options``, and ``self.examples`` by calling ``parse_docs``, then
|
|
132
|
-
writes ``index.rst
|
|
129
|
+
writes ``index.rst`` and one ``section<id>.rst`` per
|
|
133
130
|
section into ``DOCDIR``.
|
|
134
131
|
|
|
135
132
|
Args:
|
|
@@ -150,13 +147,11 @@ class PgRST(PgFile, PgUtil):
|
|
|
150
147
|
self.change_local_directory(self.DOCS['DOCDIR'], self.LGWNEX)
|
|
151
148
|
self.pglog("Write rst document '{}' under {}".format(docname, self.DOCS['DOCDIR']), self.LOGWRN)
|
|
152
149
|
|
|
153
|
-
if op.exists("index.rst"): # write index file once
|
|
150
|
+
if op.exists(op.join(self.DOCS['DOCDIR'], "index.rst")): # write index file once
|
|
154
151
|
self.pglog("index.rst exists already, delete first if needs to be regenerated", self.LOGWRN)
|
|
155
152
|
else:
|
|
156
153
|
self.write_index(self.sections[0])
|
|
157
154
|
|
|
158
|
-
self.write_toc()
|
|
159
|
-
|
|
160
155
|
for section in self.sections:
|
|
161
156
|
self.write_section(section)
|
|
162
157
|
|
|
@@ -166,12 +161,8 @@ class PgRST(PgFile, PgUtil):
|
|
|
166
161
|
def parse_docs(self, docname):
|
|
167
162
|
"""Read *docname*.usg and populate ``sections``, ``options``, and ``examples``.
|
|
168
163
|
|
|
169
|
-
Lines beginning with ``#`` are treated as comments and skipped.
|
|
170
|
-
trailing comments are also stripped.
|
|
171
|
-
(e.g. ``<FILENAME>``) are temporarily escaped to ``<FILENAME>``
|
|
172
|
-
so they are not misidentified as option markers (``<:>``, ``<=>``,
|
|
173
|
-
``<!>``) later in processing. They are unescaped back to ``<FILENAME>``
|
|
174
|
-
in :meth:`replace_option_link` before appearing in RST output.
|
|
164
|
+
Lines beginning with ``#`` are treated as comments and skipped. In-line
|
|
165
|
+
trailing comments are also stripped.
|
|
175
166
|
|
|
176
167
|
Args:
|
|
177
168
|
docname (str): Short document name used to locate ``<ORIGIN>/<docname>.usg``.
|
|
@@ -192,14 +183,6 @@ class PgRST(PgFile, PgUtil):
|
|
|
192
183
|
else:
|
|
193
184
|
line = line.rstrip() # remove trailing white spaces
|
|
194
185
|
|
|
195
|
-
# Temporarily escape <UPPERCASE> tokens so they are not confused
|
|
196
|
-
# with special markers like <:>, <=>, <!> used in option parsing.
|
|
197
|
-
while True:
|
|
198
|
-
ms = re.search(r'(<([A-Z/\-\.]+)>)', line)
|
|
199
|
-
if ms:
|
|
200
|
-
line = line.replace(ms.group(1), "<{}>".format(ms.group(2)))
|
|
201
|
-
else:
|
|
202
|
-
break
|
|
203
186
|
ms = re.match(r'^([\d\.]+)\s+(.+)$', line)
|
|
204
187
|
if ms: # start new section
|
|
205
188
|
section = self.record_section(section, option, example, ms.group(1), ms.group(2))
|
|
@@ -300,10 +283,16 @@ class PgRST(PgFile, PgUtil):
|
|
|
300
283
|
dict | None: A new example dict when *ndesc* is given, else ``None``.
|
|
301
284
|
"""
|
|
302
285
|
if example:
|
|
303
|
-
|
|
286
|
+
lines = example['desc'].split('\n')
|
|
287
|
+
first_line = lines[0]
|
|
288
|
+
rest = '\n'.join(lines[1:]) if len(lines) > 1 else ''
|
|
289
|
+
ms = re.match(r'^(.*)\.\s*(.*)$', first_line)
|
|
304
290
|
if ms:
|
|
305
291
|
example['title'] = ms.group(1)
|
|
306
|
-
example['desc'] = ms.group(2)
|
|
292
|
+
example['desc'] = (ms.group(2) + '\n' + rest) if rest else ms.group(2)
|
|
293
|
+
else:
|
|
294
|
+
example['title'] = first_line
|
|
295
|
+
example['desc'] = rest
|
|
307
296
|
option['exmidxs'].append(len(self.examples)) # record example index in option
|
|
308
297
|
self.examples.append(example) # record example globally
|
|
309
298
|
|
|
@@ -396,7 +385,8 @@ class PgRST(PgFile, PgUtil):
|
|
|
396
385
|
Returns:
|
|
397
386
|
dict: New example dict with keys ``opt``, ``title``, and ``desc``.
|
|
398
387
|
"""
|
|
399
|
-
|
|
388
|
+
desc = (desc[0].upper() + desc[1:]) if desc else desc
|
|
389
|
+
return {'opt' : opt, 'title' : "", 'desc' : desc + "\n"}
|
|
400
390
|
|
|
401
391
|
#
|
|
402
392
|
# write the entry file: index.rst
|
|
@@ -404,29 +394,17 @@ class PgRST(PgFile, PgUtil):
|
|
|
404
394
|
def write_index(self, section):
|
|
405
395
|
"""Write ``index.rst`` from the ``index.rst.temp`` template.
|
|
406
396
|
|
|
407
|
-
Passes ``TITLE`` (document title)
|
|
408
|
-
as substitution variables.
|
|
397
|
+
Passes ``TITLE`` (document title), ``SECID`` (first section id),
|
|
398
|
+
and the generated ``TOC`` RST content as substitution variables.
|
|
409
399
|
|
|
410
400
|
Args:
|
|
411
401
|
section (dict): The first section dict, used to supply ``SECID``.
|
|
412
402
|
"""
|
|
413
|
-
hash = {'TITLE' : self.DOCS['DOCTIT'], 'SECID' : section['secid']
|
|
403
|
+
hash = {'TITLE' : self.DOCS['DOCTIT'], 'SECID' : section['secid'],
|
|
404
|
+
'TOC' : self.create_toc()}
|
|
414
405
|
|
|
415
406
|
self.template_to_rst("index", hash)
|
|
416
407
|
|
|
417
|
-
#
|
|
418
|
-
# write the table of contents: toc.rst
|
|
419
|
-
#
|
|
420
|
-
def write_toc(self):
|
|
421
|
-
"""Write ``toc.rst`` from the ``toc.rst.temp`` template.
|
|
422
|
-
|
|
423
|
-
Passes ``TITLE`` and the generated ``TOC`` RST content as substitution
|
|
424
|
-
variables.
|
|
425
|
-
"""
|
|
426
|
-
hash = {'TITLE' : self.DOCS['DOCTIT'], 'TOC' : self.create_toc()}
|
|
427
|
-
|
|
428
|
-
self.template_to_rst("toc", hash)
|
|
429
|
-
|
|
430
408
|
#
|
|
431
409
|
# write a section rst file
|
|
432
410
|
#
|
|
@@ -495,8 +473,8 @@ class PgRST(PgFile, PgUtil):
|
|
|
495
473
|
#
|
|
496
474
|
# create rst content for table of contents
|
|
497
475
|
#
|
|
498
|
-
def create_toc(self):
|
|
499
|
-
"""Build and return the RST table-of-contents string.
|
|
476
|
+
def create_toc(self, csection=None):
|
|
477
|
+
"""Build and return the RST table-of-contents string of a given section.
|
|
500
478
|
|
|
501
479
|
Produces a nested bullet list of section links (indented by section
|
|
502
480
|
level) followed by a flat Appendix A list of all example links.
|
|
@@ -504,29 +482,38 @@ class PgRST(PgFile, PgUtil):
|
|
|
504
482
|
Returns:
|
|
505
483
|
str: RST-formatted TOC content ready for ``__TOC__`` substitution.
|
|
506
484
|
"""
|
|
485
|
+
|
|
507
486
|
content = ""
|
|
487
|
+
clevel = csection['level'] if csection else 0
|
|
488
|
+
csecid = csection['secid'] if csection else ""
|
|
489
|
+
depth = self.TLEVEL - clevel
|
|
508
490
|
|
|
509
491
|
# nested bullet list for all sections
|
|
510
492
|
for section in self.sections:
|
|
511
493
|
secid = section['secid']
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
494
|
+
level = section['level']
|
|
495
|
+
if csecid:
|
|
496
|
+
if not secid.startswith(csecid + "."): continue
|
|
497
|
+
elif level > (clevel+1):
|
|
498
|
+
continue
|
|
499
|
+
content += " section{}\n".format(secid)
|
|
500
|
+
|
|
501
|
+
if not content: return ""
|
|
502
|
+
|
|
503
|
+
content = f".. toctree::\n :maxdepth: {depth}\n :caption: Table of Contents\n{content}\n"
|
|
504
|
+
# appendix A: list of examples for the parent section and its subsections
|
|
505
|
+
appendix = ""
|
|
521
506
|
idx = 1 # used as example index
|
|
522
|
-
for
|
|
523
|
-
opt =
|
|
507
|
+
for exm in self.examples:
|
|
508
|
+
opt = exm['opt']
|
|
524
509
|
option = self.options[opt]
|
|
525
510
|
secid = option['secid']
|
|
526
|
-
|
|
527
|
-
|
|
511
|
+
if not csecid or secid == csecid or secid.startswith(csecid + "."):
|
|
512
|
+
appendix += "- `A.{}. {} Option -{} (-{}) <{}_e{}>`_\n".format(
|
|
513
|
+
idx, option['type'], opt, option['name'], secid, idx)
|
|
528
514
|
idx += 1
|
|
529
|
-
|
|
515
|
+
if appendix:
|
|
516
|
+
content += "**Appendix A: List of Examples**\n\n" + appendix + "\n"
|
|
530
517
|
|
|
531
518
|
return content
|
|
532
519
|
|
|
@@ -551,6 +538,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
551
538
|
for opt in section['opts']:
|
|
552
539
|
content += self.create_option(opt, secid)
|
|
553
540
|
|
|
541
|
+
content += self.create_toc(section) # add a local TOC for the section and its subsections
|
|
554
542
|
return content
|
|
555
543
|
|
|
556
544
|
#
|
|
@@ -626,7 +614,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
626
614
|
def create_example(self, exmidx, secid):
|
|
627
615
|
"""Build the RST content for a single example.
|
|
628
616
|
|
|
629
|
-
Emits a ``..
|
|
617
|
+
Emits a ``.. _secid_e<N>:`` anchor, a bold ``EXAMPLE N. <title>`` heading,
|
|
630
618
|
and the example's body description.
|
|
631
619
|
|
|
632
620
|
Args:
|
|
@@ -638,7 +626,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
638
626
|
"""
|
|
639
627
|
example = self.examples[exmidx]
|
|
640
628
|
exm = exmidx + 1
|
|
641
|
-
content = "\n.. _e{}:\n\n".format(exm)
|
|
629
|
+
content = "\n.. _{}_e{}:\n\n".format(secid, exm)
|
|
642
630
|
content += "**EXAMPLE {}. {}**\n\n".format(exm, example['title'])
|
|
643
631
|
content += self.create_description(example['desc'], secid, 2)
|
|
644
632
|
|
|
@@ -651,8 +639,9 @@ class PgRST(PgFile, PgUtil):
|
|
|
651
639
|
"""Scan *line* for option references, section-category keywords, URLs, and
|
|
652
640
|
quoted program names, and replace each with an RST hyperlink.
|
|
653
641
|
|
|
654
|
-
|
|
655
|
-
`` `text <
|
|
642
|
+
All links use RST named anchor references (`` `name`_ `` or
|
|
643
|
+
`` `text <name_>`_ ``) targeting anchors of the form ``.. _name:``.
|
|
644
|
+
Cross-file option links target ``.. _section{secid}:`` anchors.
|
|
656
645
|
|
|
657
646
|
Args:
|
|
658
647
|
line (str): Source text line to process.
|
|
@@ -687,14 +676,15 @@ class PgRST(PgFile, PgUtil):
|
|
|
687
676
|
pre = optary[0]
|
|
688
677
|
after = optary[2]
|
|
689
678
|
secid = self.options[opt]['secid']
|
|
679
|
+
anchor = None # RST anchor name for same-file or cross-file links (.. _NAME:)
|
|
690
680
|
if secid == csecid:
|
|
691
|
-
|
|
681
|
+
anchor = opt
|
|
692
682
|
elif self.options[opt]['type'] == "Action":
|
|
693
|
-
|
|
683
|
+
anchor = "section{}".format(secid)
|
|
694
684
|
elif ptype == 2 and opt == "FN":
|
|
695
|
-
|
|
685
|
+
anchor = "field"
|
|
696
686
|
else:
|
|
697
|
-
|
|
687
|
+
anchor = "section{}".format(secid)
|
|
698
688
|
|
|
699
689
|
ms = re.search(r'-\(({}\|\w+)\)'.format(opt), line)
|
|
700
690
|
if ms:
|
|
@@ -703,7 +693,10 @@ class PgRST(PgFile, PgUtil):
|
|
|
703
693
|
after = ')'
|
|
704
694
|
|
|
705
695
|
replace = pre + opt + after
|
|
706
|
-
|
|
696
|
+
if opt == anchor:
|
|
697
|
+
link = "{}`{}`_{}".format(pre, opt, after)
|
|
698
|
+
else:
|
|
699
|
+
link = "{}`{} <{}_>`_{}".format(pre, opt, anchor, after)
|
|
707
700
|
line = line.replace(replace, link)
|
|
708
701
|
|
|
709
702
|
opts = re.findall(r'(^|\W){}( Options*\W|\W|$)'.format(self.SEARCH), line)
|
|
@@ -720,9 +713,9 @@ class PgRST(PgFile, PgUtil):
|
|
|
720
713
|
opt += ms.group(1)
|
|
721
714
|
after = after.replace(ms.group(1), '')
|
|
722
715
|
if ptype == 2 and re.search(r'Mode Options*', opt) and dtype == 3:
|
|
723
|
-
link = "{}`{}
|
|
716
|
+
link = "{}`{} <mode_>`_{}".format(pre, opt, after)
|
|
724
717
|
else:
|
|
725
|
-
link = "{}`{} <section{}
|
|
718
|
+
link = "{}`{} <section{}>`_{}".format(pre, opt, secid, after)
|
|
726
719
|
line = line.replace(replace, link)
|
|
727
720
|
|
|
728
721
|
ms = re.search(r'(https*://\S+)(\.|\,)', line)
|
|
@@ -743,10 +736,6 @@ class PgRST(PgFile, PgUtil):
|
|
|
743
736
|
link = self.Q1 + opt + self.Q2
|
|
744
737
|
line = line.replace(replace, link)
|
|
745
738
|
|
|
746
|
-
# Unescape <UPPERCASE> tokens that were temporarily escaped during
|
|
747
|
-
# parsing to avoid confusion with option markers (<:>, <=>, <!>).
|
|
748
|
-
line = line.replace('<', '<').replace('>', '>')
|
|
749
|
-
|
|
750
739
|
return line
|
|
751
740
|
|
|
752
741
|
#
|
|
@@ -888,7 +877,6 @@ class PgRST(PgFile, PgUtil):
|
|
|
888
877
|
|
|
889
878
|
Detects three sub-formats:
|
|
890
879
|
|
|
891
|
-
* Lines starting with ``- `` → RST numbered list (``#.``).
|
|
892
880
|
* Lines ending with ``=>`` → RST line block (``|``).
|
|
893
881
|
* Lines split on `` - `` (key-value pairs) → ``.. list-table::`` directive.
|
|
894
882
|
* All other lines split on 2+ spaces → RST simple table.
|
|
@@ -909,7 +897,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
909
897
|
line = lines[i]
|
|
910
898
|
ms = re.match(r'^\s+-\s+(.*)', line)
|
|
911
899
|
if ms:
|
|
912
|
-
content += "
|
|
900
|
+
content += "* " + self.replace_option_link(ms.group(1), secid, 1) + "\n"
|
|
913
901
|
else:
|
|
914
902
|
content += " " + self.replace_option_link(line, secid, 1) + "\n"
|
|
915
903
|
content += "\n"
|
|
@@ -1040,7 +1028,7 @@ class PgRST(PgFile, PgUtil):
|
|
|
1040
1028
|
if ms:
|
|
1041
1029
|
content += "| {}{}{} {}\n".format(self.Q1, self.DOCS['DOCNAM'], self.Q2, ms.group(1))
|
|
1042
1030
|
else:
|
|
1043
|
-
content += "|
|
|
1031
|
+
content += "|{}\n".format(line)
|
|
1044
1032
|
content += "\n"
|
|
1045
1033
|
|
|
1046
1034
|
return content
|
|
@@ -1086,11 +1074,11 @@ class PgRST(PgFile, PgUtil):
|
|
|
1086
1074
|
title (str): Section title text to look up.
|
|
1087
1075
|
|
|
1088
1076
|
Returns:
|
|
1089
|
-
str: RST `` `title <sectionN
|
|
1077
|
+
str: RST `` `title <sectionN>`_ `` link, or *title* if not found.
|
|
1090
1078
|
"""
|
|
1091
1079
|
for section in self.sections:
|
|
1092
1080
|
if title == section['title']:
|
|
1093
|
-
return "`{} <section{}
|
|
1081
|
+
return "`{} <section{}>`_".format(title, section['secid'])
|
|
1094
1082
|
|
|
1095
1083
|
return title
|
|
1096
1084
|
|
{rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rst_templates/index.rst.temp
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
################################################################################
|
|
2
2
|
#
|
|
3
|
-
# Title :
|
|
3
|
+
# Title : index_rst.temp
|
|
4
4
|
# Author : Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date : 03/17/2026
|
|
6
6
|
# Purpose : template file for help document index.rst (reStructuredText)
|
|
7
|
-
#
|
|
8
|
-
# Work File : $DSSHOME/lib/templates/index.temp
|
|
7
|
+
# Github : https://github.com/NCAR/rda-python-mics.git
|
|
9
8
|
#
|
|
10
9
|
################################################################################
|
|
11
10
|
|
|
@@ -15,15 +14,4 @@
|
|
|
15
14
|
A GUIDE TO __TITLE__
|
|
16
15
|
============================
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
:depth: 2
|
|
20
|
-
:local:
|
|
21
|
-
|
|
22
|
-
See the :doc:`toc` for the full table of contents.
|
|
23
|
-
|
|
24
|
-
.. toctree::
|
|
25
|
-
:maxdepth: 2
|
|
26
|
-
:caption: Contents
|
|
27
|
-
|
|
28
|
-
toc
|
|
29
|
-
section__SECID__
|
|
17
|
+
__TOC__
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
################################################################################
|
|
2
2
|
#
|
|
3
|
-
# Title :
|
|
3
|
+
# Title : section_rst.temp
|
|
4
4
|
# Author : Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date : 03/17/2026
|
|
6
6
|
# Purpose : template file for help document section.rst (reStructuredText)
|
|
7
|
-
#
|
|
8
|
-
# Work File : $DSSHOME/lib/templates/section.temp
|
|
7
|
+
# Github : https://github.com/NCAR/rda-python-mics.git
|
|
9
8
|
#
|
|
10
9
|
################################################################################
|
|
11
10
|
|
|
@@ -16,8 +15,5 @@ __SECID__ - __TITLE__
|
|
|
16
15
|
|
|
17
16
|
__SECTION__
|
|
18
17
|
|
|
19
|
-
.. raw:: html
|
|
20
|
-
|
|
21
|
-
<br>
|
|
22
18
|
|
|
23
19
|
:ref:`Back to Top <index>`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs/rst_templates/toc.rst.temp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/requires.txt
RENAMED
|
File without changes
|
{rda_python_miscs-2.0.4 → rda_python_miscs-2.0.6}/src/rda_python_miscs.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|