From 4bea9fec9c3b6dd951e7e7027bda84c4493c204c Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:45:34 +0000 Subject: [PATCH 1/8] Start draft PR From 5933ea49c27a39db1ec797dd542730d2c4d85344 Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:46:01 +0000 Subject: [PATCH 2/8] Add default author configuration --- _config.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index be54b6e..d836082 100644 --- a/_config.yml +++ b/_config.yml @@ -2,6 +2,12 @@ baseurl: "/" # The subpath of your site. Use "" if you're hosting a blog at the url: "http://ellekasai.github.io" # the base hostname & protocol for your site title: "Co-Lab" +# Author configuration +author: + name: "Anonymous" + bio: "Default site author" + avatar: "/images/default-avatar.jpg" + # This is used by feed.xml. Uncomment if you want to use it. # description: "..." @@ -27,7 +33,8 @@ defaults: type: "posts" values: layout: "post" + author: "Anonymous" # Excerpt settings -excerpt_separator: -show_excerpts: true +excerpt_separator: " +show_excerpts: true \ No newline at end of file From 4b32215583c71ce8fa5017d5a9a093750f9683c9 Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:46:09 +0000 Subject: [PATCH 3/8] Update post layout to include author metadata --- _layouts/post.html | 60 ++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/_layouts/post.html b/_layouts/post.html index cabc486..56b721e 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,46 +1,22 @@ --- layout: default --- - -
-

{{ page.title }}

- {% include post-header.html %} -
-
- {{ content }} -
- -{% if site.data.theme.show_post_navs %} - {% if page.previous or page.next %} -
- {% if page.previous %} -
-

- Older - · - View Archive ({{ site.posts.size }}) -

-

{{ page.previous.title }}

- {% assign prev_excerpt = page.previous.content | replace: '_By Al Morris_', '' | replace: 'By Al Morris', '' | replace: '*By Al Morris*', '' | strip_html | truncatewords: 25 %} -

{{ prev_excerpt }}

-
- {% endif %} - {% if page.next %} -
-

- Newer - {% unless page.previous %} - · - View Archive ({{ site.posts.size }}) - {% endunless %} -

-

{{ page.next.title }}

- {% assign next_excerpt = page.next.content | replace: '_By Al Morris_', '' | replace: 'By Al Morris', '' | replace: '*By Al Morris*', '' | strip_html | truncatewords: 25 %} -

{{ next_excerpt }}

-
+
+
+

{{ page.title }}

+
- {% endif %} -{% endif %} +

+ + +
+ {{ content }} +
+ \ No newline at end of file From bf128f6570f8de15b78228423d762101a5b1ae51 Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:46:21 +0000 Subject: [PATCH 4/8] Create script to update post authors --- update_post_authors.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 update_post_authors.py diff --git a/update_post_authors.py b/update_post_authors.py new file mode 100644 index 0000000..f7b2792 --- /dev/null +++ b/update_post_authors.py @@ -0,0 +1,29 @@ +import os +import re + +def update_post_frontmatter(file_path): + with open(file_path, 'r') as f: + content = f.read() + + # Check if author is already present + if 'author:' not in content: + # Insert author just after the first line with '---' + lines = content.split('\n') + frontmatter_end_index = lines.index('---', 1) + lines.insert(frontmatter_end_index, 'author: Anonymous') + + updated_content = '\n'.join(lines) + + with open(file_path, 'w') as f: + f.write(updated_content) + print(f"Updated {file_path} with default author") + +def main(): + posts_dir = '_posts' + for filename in os.listdir(posts_dir): + if filename.endswith('.md'): + file_path = os.path.join(posts_dir, filename) + update_post_frontmatter(file_path) + +if __name__ == '__main__': + main() \ No newline at end of file From bad0c7b2aa2ba90b83743ef52c39b411483e507b Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:46:35 +0000 Subject: [PATCH 5/8] Add test for post author update script --- ..._post_authors.cpython-312-pytest-8.4.0.pyc | Bin 0 -> 1687 bytes test_update_post_authors.py | 39 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 __pycache__/update_post_authors.cpython-312-pytest-8.4.0.pyc create mode 100644 test_update_post_authors.py diff --git a/__pycache__/update_post_authors.cpython-312-pytest-8.4.0.pyc b/__pycache__/update_post_authors.cpython-312-pytest-8.4.0.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0bad1033424ebd104d785f74391cf8158385d15 GIT binary patch literal 1687 zcmZuxOH3O_7@paOcNcqk1RNd;sR=EKQLsZ%)Fwhrf|5og5>?ga08+Kuc$c!ydTq_F zOKjOKQd7yPQU%llMpXqlwH23~dT*}1I0agFiquHWB{v!lNSykQ?R5!ZM)UgToBuKM zfAg!Vwje0Q$jv#MN9Z56@C(@&+h_*YMlQuCIE+%ljEL(yftf&UN1Blg z?jD+v4IX;MY%zp8XAmMXhfHO?p%SAU&f%!|f~}_#xFKdk02+9Lc0UK{GV+>x1+c%~ z@aa4%;sQ=G+@a!ID01KpRR08c$$i0nhDo8oCB;LBU}^B{4NFD7z$c|65P~84+KK{T zl-Dr@!3g*mu*fHaM_~T9B)$@zvC+5VE?6GP=!rY} zr=}YxW+q+lwR7>hLJcIIR*%VzWpcFpp!|R@q#Fzh&|H?73us$WOIEpaQ|Vvps2=NF z9$Fgu_Do6I<5A1W9T~|TW$CH(#xbZ@;E&fHk8VWHSLFVx ztUe6g4^_g$m9v*N<;&0dPOe5*qHEVS`i4tw&()5_X!)Z}bztqoYDj%}{r>gE4>m(@ zf{oTw&t-K{F87v$mBDu^t?zEh7k0u(j_fI5zoPW-@AUwvq7Ll4%<*qJCQkFej31jA z9znDFIu}!njo9>(4NOUji2oa5m}xAx$_!1?1=ORrJXv_@_tc*&7}zM{*Grn*T+S^O{U7H1z@lt_Z-3C_hC5wI_A+d@N-^wsC2fO19;C zhDE3h3FWeErUJ`9!iZUW*eFjGmI4v?N!9oqq&RJPn>G-`WZeZuj)9N-NT8XeG2Z{aD`U zxlo$i4h^nNZiQn1N+>+M3wjWhHI1p)v}lmZx3iY*0h4IxawexWSG^kKx9NH@-DM=R z(oT$+b&4rX5tV#d3mj%}O(&#}+2Dv-3%M2pv&aI~w4V?efbDva@^~t3WNq_3au#Il zmvBd*+u Date: Thu, 12 Jun 2025 18:46:57 +0000 Subject: [PATCH 6/8] Improve front matter parsing logic --- ..._post_authors.cpython-312-pytest-8.4.0.pyc | Bin 0 -> 2354 bytes .../update_post_authors.cpython-312.pyc | Bin 0 -> 1574 bytes update_post_authors.py | 32 ++++++++++++------ 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 __pycache__/test_update_post_authors.cpython-312-pytest-8.4.0.pyc create mode 100644 __pycache__/update_post_authors.cpython-312.pyc diff --git a/__pycache__/test_update_post_authors.cpython-312-pytest-8.4.0.pyc b/__pycache__/test_update_post_authors.cpython-312-pytest-8.4.0.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f53c46d7230dd69d15614be402475f4ad9470691 GIT binary patch literal 2354 zcmaJ?O>7%Q6rR~1d+m5#l0eD)s_Bo?2sQLTC2Aq9w%IkYyIz}_ zHL0yc1W`l+mC^_aw;*Ua5flzR!VPidlF(GCra>UVrMIYwRH-NC?RxDrq>Su0Z|1$3 zc|YHK`^PK4OnV6-T^5uO9kv0Kw-4~lW0XJ7? zFsk4R);Q>IqQ7@u+lqcgNcMW!~h!@c))}*0o zyB7(XcDWB8n<|(Lk5*6h^z=k+qf#up$C41NsGDsS(;O@g;kh~u&3!2<{TdJgpR zUlfjb;$a?E%W*Z4MZ9~nIoo1Vv1B<+9wj-~(gY?^%g!>KrQlpL`Q&`MOi9`<4jXpb z&Rt5EDm<9Zp;Yg|H039HO2+VI<2{R}iN($FsD8jVdwog`F9$SLsxX;a?uAlyJD3Cp zuTM|PlZE-y^av*t=&z2{q;xI5thQd?Q%lXHZtq@HyJmOYkEzoGQv)kVe&M+_B&)5D zMHGK!N$pxtyPnVpKl*Lk>*CLHzYyL$<0CvTHRLwXz;j&BCO_L4&Fs02>~5}U;vlni zG=L8qMgabCftS})Sol!LgUuTTM_AoHQ|#cfe9Hy}zHHnnx@sWJ#{;f8o6?y0H8SOI z8i*X1xF@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)3 zSH7|zL$Z1p2L4KT;OMXqKow>1$YYLw(=~m8|7Ggb^aTIpf;fFidNLtSPe}<_Y8IAD zwS4^<2JjZ(;<21f1}{Yuj!*#wF?=0;d=*|8mdUL$k_&Jieh~AU7Lx1^Pn4Fqhzia3 zqR9EpOe{3*LIzwDATKn2mWFCq>gD;dlnK$sr9CP+w&$BRp)v%N$D)}EEdB^f%-Y3j zJPor*@bnstMW}0}EYb-8j~xm`8aWMrDx?hCB`OSK(7fx=Eu(5@-}1~}&*`;WtGCLz z-+Q!@T#a=95jp!ba<+VDH!`%>*S{gHOB>Pk=;qvGdAsjQX=X1vv^ldI9s5T@v5^C? zgQ%?Q%)G8^BI#!Wj#xGSYJ_Z=d8O+=Au_b}i#WdDj)Z6_{~LeiPeK0b{e2z@{WVkn0(1Lb@c;k- literal 0 HcmV?d00001 diff --git a/update_post_authors.py b/update_post_authors.py index f7b2792..7ce1d49 100644 --- a/update_post_authors.py +++ b/update_post_authors.py @@ -5,18 +5,28 @@ def update_post_frontmatter(file_path): with open(file_path, 'r') as f: content = f.read() - # Check if author is already present - if 'author:' not in content: - # Insert author just after the first line with '---' - lines = content.split('\n') - frontmatter_end_index = lines.index('---', 1) - lines.insert(frontmatter_end_index, 'author: Anonymous') - - updated_content = '\n'.join(lines) + # Regex to handle front matter parsing + front_matter_match = re.match(r'^---\n(.*?\n)---', content, re.DOTALL) + + if front_matter_match: + front_matter = front_matter_match.group(1) - with open(file_path, 'w') as f: - f.write(updated_content) - print(f"Updated {file_path} with default author") + # Check if author is already present + if 'author:' not in front_matter: + # Add author line + updated_front_matter = front_matter.rstrip() + '\nauthor: Anonymous\n' + + # Replace the original front matter + updated_content = re.sub( + r'^---\n.*?---', + f'---\n{updated_front_matter}---', + content, + flags=re.DOTALL + ) + + with open(file_path, 'w') as f: + f.write(updated_content) + print(f"Updated {file_path} with default author") def main(): posts_dir = '_posts' From d514fa9d5d51b010d96bb06e4869e5f2d4de0ae2 Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:47:07 +0000 Subject: [PATCH 7/8] Update test for improved front matter parsing --- test_update_post_authors.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test_update_post_authors.py b/test_update_post_authors.py index 54cb7e1..35d3dcb 100644 --- a/test_update_post_authors.py +++ b/test_update_post_authors.py @@ -1,5 +1,5 @@ import os -import yaml +import re import unittest from update_post_authors import update_post_frontmatter @@ -22,13 +22,14 @@ def test_update_frontmatter(self): with open(self.test_file, 'r') as f: content = f.read() - # Split front matter - front_matter = content.split('---')[1].strip() - parsed_front_matter = yaml.safe_load(f"---\n{front_matter}\n---") + # Use regex to parse front matter + front_matter_match = re.match(r'^---\n(.*?\n)---', content, re.DOTALL) + self.assertIsNotNone(front_matter_match) + + front_matter = front_matter_match.group(1) # Check author is added - self.assertIn('author', parsed_front_matter) - self.assertEqual(parsed_front_matter['author'], 'Anonymous') + self.assertIn('author: Anonymous', front_matter) def tearDown(self): # Remove test file From 886ea3d7b9b7e758a6304239c0fbb8355abc5849 Mon Sep 17 00:00:00 2001 From: Ralfmal Date: Thu, 12 Jun 2025 18:47:20 +0000 Subject: [PATCH 8/8] Create comprehensive .gitignore file --- .gitignore | 45 ++++++++++++++++-- ..._post_authors.cpython-312-pytest-8.4.0.pyc | Bin 2354 -> 2315 bytes .../update_post_authors.cpython-312.pyc | Bin 1574 -> 1813 bytes 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 76a0bf1..3a3bab4 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,42 @@ -_site -.sass-cache -Gemfile.lock +# Python +__pycache__/ +*.py[cod] +*$py.class +.pytest_cache/ + +# Jekyll +_site/ +.sass-cache/ +.jekyll-cache/ +.jekyll-metadata + +# Development environments +.env +.venv +venv/ +ENV/ + +# IDEs and editors +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# Dependency directories +node_modules/ +jspm_packages/ + +# Build output +dist/ +build/ + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Miscellaneous +.DS_Store +Thumbs.db \ No newline at end of file diff --git a/__pycache__/test_update_post_authors.cpython-312-pytest-8.4.0.pyc b/__pycache__/test_update_post_authors.cpython-312-pytest-8.4.0.pyc index f53c46d7230dd69d15614be402475f4ad9470691..6f64dd98a66263d5acffb1e9e52ed167321e8e04 100644 GIT binary patch delta 614 zcmdla)Gfq&nwOW00SHzrcxR+-bvH*1ngT$CwYFH+>v&iZt zS1?C1lrw6w`rTqIsuGCP)zyv3)6mnhkIB;nvR{Hss}f8sEy>6)vQn6Qkwr0{sVMap zYi?pma>gw-7yl4PAD>(NiN(dKMJ1lae)%PS`FTM3^rHOIf?FI=@jOk|B5t5bMLa;_ z7JG7jUP)?R$t|I@A|NXsXjVyT5r_gB$ul{aHJ!0}@@`h+`Y#*|atiY!W=334v)o~R z#Ob)_LC?#weit~TZgB8i=a9L`A#*`i{|bk}198pk;`$fG^*1nH7B}kP`M}1&$=lD{ z$$LRebA`=S4vX)i41DSrc-4LtgPgHO&`F;8kUXoC2759zxPYPz44}XT;m^~6#B_$q z4Q!tol_r<4r&`MZ1&Wk_#7c%DWe}SeM6kjLHXx%|5Jz6(I8#OKxIjUXeOT6mHxt4x8Nkl+v73yCUPs_c^32Id3!Y z-(@iW!XnS8HpAk&w9Z9ooi7YP&Icz(1{R){w3L#B-Bj|#8gdeFcE5F>p`Rjixwd_p_M{dx?7X5*~HxqwILw~ zJt$RF7W_d(y+!Jw>cwO5>LnpcWU6@fpoCfwJUL@qG6UcHzV|-fd(5o+-};D ztVb{9l{eB!2Iiev<}PZwilS47W22B(0Z^F`!J@}`$%G}wmi{McX2i*%u_p5rsO&Rl zW6#|{bx`!}dxlZv>S)8Yt05qsz_7N@>PY42ER`QR*T4}l2`sqkf?yFqa_{KZnMJS) z6G9e4Gg@O(snicTy@m*L*N~e8%qdknUpBGmw9&Z2S{1!uW7e|GLItBWrKDrgQdYE_ zURG2rD3+y}_Pl{TyKL@SRnZfy=^<@RF9FOimknDpZ0ubz3Coof+ty4Rs3@kTsX1qs zy$T;XEq1Co5J2$IqsD{Ai_1OvcF|0e)Oj&-E?UyH8x z+LxJNK1{HgNq%|n{lU8n90%dJljSujLf1b^;1w`qPMep5ej;vyZI{UUwhu_`9Q++& z*f=Tv;`3aT+GS@+n7I-s6r++-Fw6wa#wgIQ$HJLXS*_~YS@RT;bgGphFkm2r-)Zw3 k;ui31fzfYZW(P%J{PF32IN1#+cK{KCS?8y45Ycx302-8_FaQ7m diff --git a/__pycache__/update_post_authors.cpython-312.pyc b/__pycache__/update_post_authors.cpython-312.pyc index 84f4c9eac1bf70f6d1556170a7f3893c0828b9f6..a25aa9ee59bb61bd4093bf16765967f174363310 100644 GIT binary patch delta 1080 zcmah|O=ufO6rRz}YIo(8qMy`~+^Uu<+p&rjlYmXBleEUBl*ZVQ_TmyElAVeN|9 zRaA>LDwKi<30R0?g%a#iC@IRp_nurAddOuRyF{6!AqlwzauC5_$SJdu6(y(4gZIAu z-uvFZ8D{%8cfbJG$NN0!`)ECMBV>ItzFGLk@vpEY z?1sOwQ125i+z7_+1;=)RW1Da{c(N=uok0AcHoMa^@;EkjFE+6go7jzgW=)>kiJh~= z=)M#553Hwel+q1vf5RWNLZenNaqC;ld!peDKI{#xDHUa3VEaAg`F#)Y_pT}%fj!^Q zEnmayTjMHR?Z}>YgpTDOekS@>zpgFR&RWMNE&r+i#M8|P5aUe&@O=kvI=3Z6ULB0m zO3OF&N)OU~UiVFhn7>E;(}N$!Bo9`hpD)gyET&6D%BSdH@p3#k)-SKH`7=s>uM<*OI*kSYQnj delta 837 zcmZWm&1(}u6rb7IkIBd8Lx{DJ)=g_$QVd#ZQETxdP%DTQ@zjgU;%w=LWD_PE+lH+< zh|r4ChDD5sSP}f77yku&^%8A`I$nD4;w^Y7^yF@uM2hb*GjD$H_j~UR^DOi(82Td1 ze&E`Ya$_!wsv!$Ls6L#o5U#@Aht#&YjNqjY8$lcJ09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