File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ Allowed child Data Type Description
24
24
=======
25
25
Section
26
26
=======
27
- A model of a section of the <a href="#document">Document</a>. Will contain one <a href="#paragraph">Paragraph</a> or more.
27
+ A model of a section of the `Document <#document >`_ . Will contain one `Paragraph <#paragraph >`_ or more
28
+
28
29
29
30
**Allowed parameters **
30
31
@@ -49,8 +50,8 @@ A model of a paragraph.
49
50
50
51
**Allowed parameters **
51
52
52
- =============== =========== =================================================
53
+ =============== =========== ===================================================
53
54
Allowed field Data Type Description
54
- =============== =========== =================================================
55
- **contents ** str *Paragraph contents, which make up the Sections . *
56
- =============== =========== =================================================
55
+ =============== =========== ===================================================
56
+ **contents ** str *Paragraph contents, which make up the _Section_s . *
57
+ =============== =========== ===================================================
Original file line number Diff line number Diff line change @@ -609,28 +609,28 @@ def insert_links(text, format=MARKDOWN_FORMAT):
609
609
if ref [0 ] == "~" :
610
610
ref = ref [1 :]
611
611
post = text2 [ind2 + 1 :]
612
- text2 = f'{ pre } <a href="#{ ref .lower ()} ">{ ref } </a>{ post } '
612
+ if format == MARKDOWN_FORMAT :
613
+ text2 = f'{ pre } <a href="#{ ref .lower ()} ">{ ref } </a>{ post } '
614
+ elif format == RST_FORMAT :
615
+ text2 = f"{ pre } `{ ref } <#{ ref .lower ()} >`_ { post } "
616
+
613
617
# print(" > Converted to: %s" % text2)
614
618
text = text2
615
619
616
620
if "_" not in text :
617
621
return text
618
622
if '"' in text :
619
623
return text # Assume it's a quoted string containing an underscore...
624
+ if format == RST_FORMAT :
625
+ return text # No need to remove underscore for RST format
626
+
620
627
split = text .split ("_" )
621
628
text2 = ""
622
629
for i in range (int (len (split ) / 2.0 )):
623
630
pre = split [i * 2 ]
624
631
type = split [i * 2 + 1 ]
625
- if format == MARKDOWN_FORMAT :
626
- text2 += f'{ pre } <a href="#{ type .lower ()} ">{ type } </a>'
627
- elif format == RST_FORMAT :
628
- # text2 += ('%s'+rst_url_format) % (pre, type, '#'+type.lower # problem with handling links ending with s e.g. _Graph_s
632
+ text2 += f'{ pre } <a href="#{ type .lower ()} ">{ type } </a>'
629
633
630
- text2 += ("%s%s" ) % (
631
- pre ,
632
- type ,
633
- ) # temp hack... problem with handling links ending with s e.g. _Graph_s
634
634
if int (len (split ) / 2.0 ) != len (split ) / 2.0 :
635
635
text2 += split [- 1 ]
636
636
return text2
You can’t perform that action at this time.
0 commit comments