Skip to content

Commit 7e2884d

Browse files
committed
More on rst
1 parent 77c321b commit 7e2884d

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

examples/document.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ A model for documents
4343

4444
## Section
4545

46-
A model of a section of the document
46+
A model of a section of the document. Will contain a <a href="#paragraph">Paragraph</a> or two
4747

4848
### Allowed parameters
4949
<table>
@@ -81,7 +81,7 @@ A model of a paragraph
8181
<tr>
8282
<td><b>contents</b></td>
8383
<td>str</td>
84-
<td><i>Paragraph contents</i></td>
84+
<td><i>Paragraph contents, which make up the <a href="#section">Section</a>s.</i></td>
8585
</tr>
8686

8787
</table>

examples/document.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, **kwargs):
2222

2323
class Section(BaseWithId):
2424

25-
_definition = "A model of a section of the document"
25+
_definition = "A model of a section of the document. Will contain a _Paragraph_ or two"
2626

2727
def __init__(self, **kwargs):
2828

@@ -37,7 +37,7 @@ class Paragraph(Base):
3737

3838
def __init__(self, **kwargs):
3939

40-
self.add_allowed_field("contents", "Paragraph contents", str)
40+
self.add_allowed_field("contents", "Paragraph contents, which make up the _Section_s.", str)
4141

4242
super(Paragraph, self).__init__(**kwargs)
4343

examples/document.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Allowed child Data Type Description
2727
=======
2828
Section
2929
=======
30-
A model of a section of the document
30+
A model of a section of the document. Will contain a Paragraph or two
3131

3232
Allowed parameters
3333
==================
@@ -56,9 +56,9 @@ A model of a paragraph
5656
Allowed parameters
5757
==================
5858

59-
=============== =========== ====================
59+
=============== =========== =================================================
6060
Allowed field Data Type Description
61-
=============== =========== ====================
62-
**contents** str *Paragraph contents*
63-
=============== =========== ====================
61+
=============== =========== =================================================
62+
**contents** str *Paragraph contents, which make up the Sections.*
63+
=============== =========== =================================================
6464

modelspec/BaseTypes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ def generate_documentation(self, format=MARKDOWN_FORMAT):
382382
rst_url_format = '`%s <%s>`_'
383383

384384
def insert_links(text, format=MARKDOWN_FORMAT):
385+
385386
if not "_" in text:
386387
return text
387388
if '"' in text:
@@ -394,7 +395,9 @@ def insert_links(text, format=MARKDOWN_FORMAT):
394395
if format==MARKDOWN_FORMAT:
395396
text2 += '%s<a href="#%s">%s</a>' % (pre, type.lower(), type)
396397
elif format==RST_FORMAT:
397-
text2 += ('%s'+rst_url_format) % (pre, type, '#'+type.lower())
398+
#text2 += ('%s'+rst_url_format) % (pre, type, '#'+type.lower # problem with handling links ending with s e.g. _Graph_s
399+
400+
text2 += ('%s%s') % (pre, type) # temp hack... problem with handling links ending with s e.g. _Graph_s
398401
if int(len(split) / 2.0) != len(split) / 2.0:
399402
text2 += split[-1]
400403
return text2

0 commit comments

Comments
 (0)