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