improve source code comment plugin functionality
This commit is contained in:
@@ -285,6 +285,17 @@ class PythonCodeComment():
|
||||
return code_block
|
||||
else:
|
||||
return code
|
||||
|
||||
def get_markdown_block_in_html(self, html):
|
||||
from bs4 import BeautifulSoup
|
||||
soup = BeautifulSoup(html, 'lxml')
|
||||
found_list = soup.find_all("div", class_="markdown-body")
|
||||
if found_list:
|
||||
res = found_list[0]
|
||||
return res.prettify()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def sync_and_patch(self, original, revised):
|
||||
"""Ensure the number of pre-string empty lines in revised matches those in original."""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<style>ADVANCED_CSS</style>
|
||||
<meta charset="UTF-8">
|
||||
<title>源文件对比</title>
|
||||
<style>
|
||||
@@ -14,12 +15,13 @@
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
width: 80%;
|
||||
width: 95%;
|
||||
height: -webkit-fill-available;
|
||||
}
|
||||
.code-container {
|
||||
flex: 1;
|
||||
margin: 3px;
|
||||
padding: 3px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
overflow: auto;
|
||||
@@ -33,14 +35,10 @@
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="code-container">
|
||||
<pre>
|
||||
REPLACE_CODE_FILE_LEFT
|
||||
</pre>
|
||||
</div>
|
||||
<div class="code-container">
|
||||
<pre>
|
||||
REPLACE_CODE_FILE_RIGHT
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user