aboutsummaryrefslogtreecommitdiff
path: root/pyblog
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-05-26 00:47:00 +0200
committerneodarz <neodarz@neodarz.net>2019-05-26 00:47:00 +0200
commit28289ae4f3ac197489feda201843407e1f7f2537 (patch)
treec3c14ed2b456df50336afb1ac71c965dfa26945b /pyblog
parent666bdbd21f92482be07c45cfdb57786e6d99748f (diff)
downloadmy_new_personal_website-28289ae4f3ac197489feda201843407e1f7f2537.tar.xz
my_new_personal_website-28289ae4f3ac197489feda201843407e1f7f2537.zip
Move _pre_tag_insert_line_numbers function to external file
Diffstat (limited to 'pyblog')
-rwxr-xr-xpyblog17
1 files changed, 0 insertions, 17 deletions
diff --git a/pyblog b/pyblog
index 7bdf88ae..ad89e71e 100755
--- a/pyblog
+++ b/pyblog
@@ -766,23 +766,6 @@ def generate_index_and_feed():
generate_sitemap(feed)
-def _pre_tag_insert_line_numbers(soup, pre_tag):
- """Insert line numbers to a pre tag."""
- num_lines = len(pre_tag.text.split("\n"))
- for line_number in range(1, num_lines + 1):
- # line number divs will look like:
- # <span class="line-number" data-line="1" style="top: 0em"><!----></span>
- # <span class="line-number" data-line="2" style="top: 1.35em"><!----></span>
- ln_tag = soup.new_tag("span")
- ln_tag["class"] = "line-number"
- ln_tag["data-line"] = line_number
- ln_tag["style"] = "top: %.2fem" % ((line_number - 1) * 1.35)
- # add a comment to the content of the span to suppress tidy5
- # empty <span> tag warning
- ln_tag.append(soup.new_string("", bs4.Comment))
- pre_tag.code.append(ln_tag)
-
-
def process_footnote_backlinks(soup):
"""Add class attribute "footnotes-backlink" to each footnote backlink."""
for footnotes in soup.find_all("div", attrs={"class": "footnotes"}):