-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
76 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/bridge/BitcoinTx.sol/library.BitcoinTx.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/bridge/BridgeState.sol/library.BridgeState.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/bridge/IRelay.sol/interface.IRelay.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/bridge/WitnessTx.sol/library.WitnessTx.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
docs/docs/contracts/src/src/relay/DummyRelay.sol/contract.DummyRelay.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
docs/docs/contracts/src/src/relay/LightRelay.sol/contract.LightRelay.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
docs/docs/contracts/src/src/relay/LightRelay.sol/interface.ILightRelay.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/relay/LightRelay.sol/library.RelayUtils.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/relay/LightRelay.sol/struct.Epoch.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/swap/Btc_Marketplace.sol/contract.BtcMarketPlace.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/swap/Marketplace.sol/contract.MarketPlace.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/docs/contracts/src/src/swap/Wrapped.sol/contract.BobWrappedBtc.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import os | ||
import re | ||
|
||
# Function to parse the Inherits line in the Markdown content | ||
def parse_inherits(md_content): | ||
inherits_match = re.search(r'\*\*Inherits:\*\*\s*([\s\S]*?)\n', md_content) | ||
if inherits_match: | ||
inheritances = inherits_match.group(1).strip() | ||
return inheritances | ||
return None | ||
|
||
# Function to replace paths inside brackets with empty brackets | ||
def replace_paths_with_empty_brackets(line): | ||
def replace_path(match): | ||
default_path = 'docs/docs/src' | ||
path = default_path + match.group(0)[1:-1] # Remove parentheses | ||
start = "docs/docs/src/src/X/X/" | ||
relative_path = os.path.relpath(path, start) | ||
print(f"Original Path: {relative_path}") | ||
return '(' + relative_path + ')' | ||
return re.sub(r'\([^)]+\)', replace_path, line) | ||
|
||
# Function to process a single Markdown file | ||
def process_md_file(file_path): | ||
with open(file_path, 'r') as file: | ||
md_content = file.read() | ||
|
||
# Parse Inherits line | ||
inherits = parse_inherits(md_content) | ||
|
||
# Modify the Inherits line | ||
if inherits: | ||
modified_inherits = replace_paths_with_empty_brackets(inherits) | ||
md_content = md_content.replace(inherits, modified_inherits) | ||
|
||
# Write the modified content back to the original file | ||
with open(file_path, 'w') as file: | ||
file.write(md_content) | ||
|
||
print(f"File modified: {file_path}") | ||
|
||
# Check if the file name is README.md or SUMMARY.md and delete it | ||
file_name = os.path.basename(file_path) | ||
if file_name.lower() in ['readme.md', 'summary.md']: | ||
os.remove(file_path) | ||
print(f"Deleted file: {file_path}") | ||
|
||
# Main function to process all Markdown files in a directory and its subdirectories | ||
def process_all_md_files(directory): | ||
for root, dirs, files in os.walk(directory): | ||
for file in files: | ||
if file.endswith('.md'): | ||
file_path = os.path.join(root, file) | ||
process_md_file(file_path) | ||
|
||
if __name__ == "__main__": | ||
# Specify the directory path | ||
directory_path = '../docs/docs/contracts/src' | ||
|
||
# Process all Markdown files in the specified directory and its subdirectories | ||
process_all_md_files(directory_path) | ||
|
||
print("All Markdown files in the directory processed.") |