Fixed an issue with character encoding
This commit is contained in:
parent
89c86247bb
commit
8be4d39879
23
examples/sample2.md
Normal file
23
examples/sample2.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# test file
|
||||||
|
|
||||||
|
## Lorem ipsum
|
||||||
|
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris massa eros, feugiat eu dapibus nec, fermentum vel ex. Nulla malesuada luctus pretium. Phasellus ac felis ut nisi lacinia malesuada nec vel odio. Donec tincidunt tincidunt lorem vel tempus. Nullam sed efficitur ligula, a porttitor nibh. Praesent justo dui, venenatis ac mi non, laoreet consequat libero. Aenean ut molestie mauris. Proin mattis volutpat ligula eget tincidunt. Fusce ex eros, condimentum consectetur efficitur vitae, euismod at justo.
|
||||||
|
|
||||||
|
**Usage**
|
||||||
|
|
||||||
|
<div class="usage">
|
||||||
|
<div class="left">
|
||||||
|
<p><span class="box">item1</span></p>
|
||||||
|
<p><span class="box">item2</span></p>
|
||||||
|
<p><span class="box">item3</span></p>
|
||||||
|
<p><span class="box">item4</span></p>
|
||||||
|
</div>
|
||||||
|
<p class="right">+ final</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## Callout
|
||||||
|
|
||||||
|
> [!info] Example
|
||||||
|
> Callout example
|
||||||
|
> Careful with BS4 encoding some characters
|
@ -29,7 +29,9 @@ def write_file(filename, text):
|
|||||||
### Replace ###
|
### Replace ###
|
||||||
|
|
||||||
def convert_pattern(text):
|
def convert_pattern(text):
|
||||||
text = re.sub(re_usage, '', text, flags=re.MULTILINE)
|
text, success = re.subn(re_usage, '', text, flags=re.MULTILINE)
|
||||||
|
if (success == 0):
|
||||||
|
return text
|
||||||
|
|
||||||
soup = BeautifulSoup(text, features="html.parser")
|
soup = BeautifulSoup(text, features="html.parser")
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ def convert_pattern(text):
|
|||||||
calloutTitle = BeautifulSoup(callout_title_html, features="html.parser")
|
calloutTitle = BeautifulSoup(callout_title_html, features="html.parser")
|
||||||
tag.insert_before(calloutTitle)
|
tag.insert_before(calloutTitle)
|
||||||
|
|
||||||
return str(soup)
|
return (soup.decode(False, formatter=None))
|
||||||
|
|
||||||
|
|
||||||
### Execution ###
|
### Execution ###
|
||||||
|
Loading…
Reference in New Issue
Block a user