Skip to content

Commit

Permalink
use root
Browse files Browse the repository at this point in the history
  • Loading branch information
HomunMage committed Oct 12, 2024
1 parent 5af1448 commit c69caeb
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 16 deletions.
5 changes: 0 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
url = https://github.com/PosetMage/Jekyll_includes.git
branch = main

[submodule "assets"]
path = assets
url = https://github.com/PosetMage/jekyll_assets.git
branch = main

[submodule "_layouts"]
path = _layouts
url = ../homun_layouts.git
Expand Down
2 changes: 1 addition & 1 deletion OS/Docker
2 changes: 1 addition & 1 deletion OS/Windows/Powershell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ reg file:
Loading content...
</div>

<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>
2 changes: 1 addition & 1 deletion OS/Windows/VSCode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Regedit folder: 電腦\HKEY_CLASSES_ROOT\Directory\shell\VSCode\command
* <div class="load_as_code_session" data-url="vs.reg">Loading content...</div>


<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>
2 changes: 1 addition & 1 deletion Productivity/Converter/EPUB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* example genbook.ps1:
* <div class="load_as_code_session" data-url="genbook.ps1">Loading content...</div>

<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>


## example code
Expand Down
2 changes: 1 addition & 1 deletion Productivity/Converter/Subtitle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ graph TD;
```

<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>
2 changes: 1 addition & 1 deletion Productivity/Images/QRCode/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# QR Code Generator

<script src="{{ '/assets/js/GenQRCode.js' | relative_url }}" defer></script>
<script src="https://posetmage.com/assets/js/GenQRCode.js" defer></script>

<label for="urlInput">Enter URL:</label>
<input type="text" id="urlInput" placeholder="Enter URL here">
Expand Down
2 changes: 1 addition & 1 deletion Productivity/Images/metadata/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ python embed_metadata.py input.png output.png metadata.json



<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>
2 changes: 1 addition & 1 deletion Productivity/Images/svg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ result: ![](./concentric_circles.svg)

result: ![](./labeled_triangle.svg)

<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>
2 changes: 1 addition & 1 deletion Productivity/Youtube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ download form url.txt
</div>


<script src="{{ '/assets/js/LoadAsCodeSession.js' | relative_url }}"></script>
<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>
2 changes: 1 addition & 1 deletion _layouts
Submodule _layouts updated 2 files
+2 −2 base.html
+1 −1 page
1 change: 0 additions & 1 deletion assets
Submodule assets deleted from 48d692
40 changes: 40 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os

# Define the directory to start the recursive search (you can change this to your specific directory)
root_dir = "."

# The string to search for
old_script = '<script src="{{ \'/assets/js/LoadAsCodeSession.js\' | relative_url }}"></script>'

# The string to replace it with
new_script = '<script src="https://posetmage.com/assets/js/LoadAsCodeSession.js"></script>'

def replace_in_file(file_path):
"""Replaces occurrences of old_script with new_script in the given file."""
try:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()

# Only replace if the old_script is found in the content
if old_script in content:
new_content = content.replace(old_script, new_script)

# Write the modified content back to the file
with open(file_path, 'w', encoding='utf-8') as file:
file.write(new_content)
print(f"Updated: {file_path}")
else:
print(f"No changes in: {file_path}")

except Exception as e:
print(f"Error processing file {file_path}: {e}")

def replace_in_files_recursively(directory):
"""Recursively traverses the directory and replaces old_script in all files."""
for dirpath, _, filenames in os.walk(directory):
for filename in filenames:
file_path = os.path.join(dirpath, filename)
replace_in_file(file_path)

# Start the replacement process
replace_in_files_recursively(root_dir)

0 comments on commit c69caeb

Please sign in to comment.