Commits

Anonymous committed 389b5b6

Hide paragraph sums when displaying HTML files

  • Participants
  • Parent commits 0390106

Comments (0)

Files changed (2)

File sphinx/builders/webapp/webapp.py

             pids = self.piddb.get_pids(filename)
             for pid in pids:
                 paragraph = self.piddb.get_paragraph(filename, pid)
-                new_p = '[%s]%s' % (pid, paragraph)
+                new_p = '[psum:%s]%s' % (pid, paragraph)
                 contents = contents.replace(paragraph, new_p)
                 # update the PidDb
                 self.piddb.add_record(filename, pid, new_p)

File sphinx/web/middleware/appserver.py

         raise ImportError('json module not found')
 
 import os
+import re
 import time
 import locale
 from os import path
         try:
             if file_path.endswith('.html'):
                 file_contents = open(file_path).read()
+                # remove the paragraph's sum before displaying the HTML file 
+                file_contents = re.sub("\[psum:[\w\d]{32}\]", '', file_contents)
             else:
                 file_contents = open(file_path, 'rb').read()
                 resp.body = file_contents.encode('utf8')