#1244 Use [].copy and path.exists instead of more cumbersome solutions

#1244 Slightly optimized create_highlighted_versions.py so that it won't walk the source path when it should be skipping the file

#1244 Updated README.md in plaintext source folder

#1244 Added extra option loading from `bat_options` file in directory and significantly reduced size of plaintext source

#1244 Updated create_highlighted_versions.py to ignore README.md files and use the --show-all option for manually-defined binary files

#1244 Updated plaintext file with command

bat -A --no-config --style=plain --color=always --theme='1337' --italic-text=always src/Plaintext/plaintext.txt > highlighted/Plaintext/plaintext.txt

#1244 Added example plaintext file
pull/1312/head
Logan Saso 4 years ago committed by David Peter
parent 24fe946c06
commit f3c760c25f

@ -16,6 +16,17 @@ BAT_OPTIONS = [
"--italic-text=always",
]
SKIP_FILENAMES = [
"LICENSE.md",
"README.md",
"bat_options",
]
def get_extra_options(source):
with open(path.join(source, "bat_options"), "r") as f:
return list(map(lambda x: x.rstrip(), f.readlines()))
def create_highlighted_versions(output_basepath):
root = os.path.dirname(os.path.abspath(__file__))
@ -31,16 +42,23 @@ def create_highlighted_versions(output_basepath):
env.pop("BAT_TABS", None)
env["COLORTERM"] = "truecolor" # make sure to output 24bit colors
bat_output = subprocess.check_output(
["bat"] + BAT_OPTIONS + [source], stderr=subprocess.PIPE, env=env,
)
source_dirname = path.basename(path.dirname(source))
source_dirpath = path.dirname(source)
source_dirname = path.basename(source_dirpath)
source_filename = path.basename(source)
if source_filename == "LICENSE.md":
if source_filename in SKIP_FILENAMES:
continue
options = BAT_OPTIONS.copy()
# If a directory is empty, `files` could possibly be 0-length
if path.exists(path.join(source_dirpath, "bat_options")):
options += get_extra_options(source_dirpath)
bat_output = subprocess.check_output(
["bat"] + options + [source],
stderr=subprocess.PIPE, env=env,
)
output_dir = path.join(output_basepath, source_dirname)
output_path = path.join(output_dir, source_filename)

@ -0,0 +1,178 @@
␀␊
\u{1}␊
\u{2}␊
\u{3}␊
\u{4}␊
\u{5}␊
\u{6}␊
␇␊
␈␊
├──┤␊
␊
␊
\u{b}␊
\u{c}␊
␊
\u{e}␊
\u{f}␊
\u{10}␊
\u{11}␊
\u{12}␊
\u{13}␊
\u{14}␊
\u{15}␊
\u{16}␊
\u{17}␊
\u{18}␊
\u{19}␊
\u{1a}␊
␛␊
\u{1c}␊
\u{1d}␊
\u{1e}␊
\u{1f}␊
·␊
!␊
"␊
#␊
$␊
%␊
&␊
'␊
(␊
)␊
*␊
+␊
,␊
-␊
.␊
/␊
0␊
1␊
2␊
3␊
4␊
5␊
6␊
7␊
8␊
9␊
:␊
;␊
<␊
=␊
>␊
?␊
@␊
A␊
B␊
C␊
D␊
E␊
F␊
G␊
H␊
I␊
J␊
K␊
L␊
M␊
N␊
O␊
P␊
Q␊
R␊
S␊
T␊
U␊
V␊
W␊
X␊
Y␊
Z␊
[␊
\␊
]␊
^␊
_␊
`␊
a␊
b␊
c␊
d␊
e␊
f␊
g␊
h␊
i␊
j␊
k␊
l␊
m␊
n␊
o␊
p␊
q␊
r␊
s␊
t␊
u␊
v␊
w␊
x␊
y␊
z␊
{␊
|␊
}␊
~␊
\u{7f}␊
\u{80}␊
\u{81}␊
\u{82}␊
\u{83}␊
\u{84}␊
\u{85}␊
\u{86}␊
\u{87}␊
\u{88}␊
\u{89}␊
\u{8a}␊
\u{8b}␊
\u{8c}␊
\u{8d}␊
\u{8e}␊
\u{8f}␊
\u{90}␊
\u{91}␊
\u{92}␊
\u{93}␊
\u{94}␊
\u{95}␊
\u{96}␊
\u{97}␊
\u{98}␊
\u{99}␊
\u{9a}␊
\u{9b}␊
\u{9c}␊
\u{9d}␊
\u{9e}␊
\u{9f}␊
\u{a0}␊
\u{a1}␊
\u{a2}␊
\u{a3}␊
\u{a4}␊
\u{a5}␊
\u{a6}␊
\u{a7}␊
\u{a8}␊
\u{a9}␊
\u{aa}␊
\u{ab}␊
\u{ac}␊
\u{ad}␊
\u{ae}␊
␊
Here's·a·line·with·multiple·characters.

@ -0,0 +1,10 @@
This text file was generated with the following script. Certain invalid characters were removed manually:
```python
with open("plaintext.txt", "w"):
for i in range(0x10FFFF):
try:
f.write(chr(i) + "\n")
except:
pass
```
Loading…
Cancel
Save