File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,11 @@ for block in diff_blocks:
64
64
doc = match.group(1)
65
65
path = 'html/' + doc
66
66
file_path = os.path.join('$DOC_REPOSITORY ', doc)
67
- with open(file_path, 'r') as file:
68
- content = file.readlines()
67
+ try:
68
+ with open(file_path, 'r') as file:
69
+ content = file.readlines()
70
+ except FileNotFoundError:
71
+ content = []
69
72
count = 0
70
73
for line in block.splitlines():
71
74
if line.startswith('@@ -'):
@@ -77,8 +80,9 @@ for block in diff_blocks:
77
80
count += 1
78
81
content[i] = f'<span id="hunk{count}" style="visibility: hidden;"></span>' + content[i]
79
82
break
80
- with open(file_path, 'w') as file:
81
- file.writelines(content)
83
+ if content:
84
+ with open(file_path, 'w') as file:
85
+ file.writelines(content)
82
86
hunks = ' '.join(f'<a href="{path}#hunk{i+1}" class="hunk" target="_blank">#{i + 1}</a>' for i in range(count))
83
87
out_blocks.append(f'<p class="diff"><a href="{path}">{doc}</a> ' + hunks + ' </p>'
84
88
+ '\n<pre><code class="language-diff">'
You can’t perform that action at this time.
0 commit comments