-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge with Develop 2024-1-14 (#2640)
* 20241114060032 Deleted all files in the main branch in anticipation of merging develop into main cleanly * 20241114060107 Merge develop into main
- Loading branch information
1 parent
b6b186f
commit c4fc7b6
Showing
40 changed files
with
4,079 additions
and
198 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -27,7 +27,8 @@ env: | |
jobs: | ||
|
||
Flutter-Codebase-Check: | ||
name: Checking codebase | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
name: Checking Codebase | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -72,90 +73,9 @@ jobs: | |
# - name: Echo the GitHub context for troubleshooting | ||
# run: echo "${{ toJSON(github) }}" | ||
|
||
Update-Documentation: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/automated-docs' | ||
environment: TALAWA_ENVIRONMENT | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' # See 'Supported distributions' for available options | ||
java-version: '12.0' | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.22.3' | ||
channel: 'stable' | ||
- uses: dart-lang/setup-dart@v1 | ||
with: | ||
sdk: '3.4.4' | ||
- run: | | ||
cd talawa_lint && flutter pub get && cd .. | ||
flutter pub get | ||
flutter analyze | ||
dart analyze | ||
flutter pub global activate dartdoc | ||
flutter pub global run dartdoc . --output talawa-mobile-docs --format md --exclude=test/widget_tests/widgets/pinned_carousel_widget_test.dart, lib/widgets/pinned_carousel_widget.dart, lib/widgets/post_widget.dart, test/widget_tests/widgets/post_widget_test.dart | ||
rm -rf talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md | ||
rm -rf talawa-mobile-docs/widgets_post_widget/PostContainerState/build.md | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: talawa-mobile-docs | ||
path: talawa-mobile-docs | ||
- name: Checking doc updated | ||
id: DocUpdated | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "updateDoc=true" >> $GITHUB_OUTPUT | ||
echo -e "Documentation has been updated!!" | ||
else | ||
Green='0;32' | ||
NoColor='\033[0m' | ||
echo -e "${Green}No documentation updated${NoColor}" | ||
fi | ||
- name: Set env variables | ||
if: steps.DocUpdated.outputs.updateDoc | ||
run: | | ||
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV | ||
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV | ||
- name: Handle untracked files | ||
if: steps.DocUpdated.outputs.updateDoc | ||
run: | | ||
git config --global user.name "${{github.actor}}" | ||
git config --global user.email "${{env.email}}" | ||
git add . | ||
- name: Update Doc | ||
if: steps.DocUpdated.outputs.updateDoc | ||
run: | | ||
Green='0;32' | ||
NoColor='\033[0m' | ||
git config --global user.name "${{github.actor}}" | ||
git config --global user.email "${{env.email}}" | ||
git commit -a -m "Updated docs" | ||
git push | ||
echo -e "🚀${Green} Hurrah! doc updated${NoColor}" | ||
Documentation-to-talawa-docs: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/automated-docs' | ||
needs: Update-Documentation | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dmnemec/[email protected] | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB_NEW }} | ||
with: | ||
source_file: 'talawa-mobile-docs/' | ||
destination_repo: 'PalisadoesFoundation/talawa-docs' | ||
destination_branch: 'develop' | ||
destination_folder: 'docs' | ||
user_email: '${{env.email}}' | ||
user_name: '${{github.actor}}' | ||
commit_message: 'Overwriting talawa-mobile-docs from talawa-repo' | ||
|
||
|
||
|
||
Flutter-Testing: | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
name: Testing codebase | ||
runs-on: ubuntu-latest | ||
needs: Flutter-Codebase-Check | ||
|
@@ -185,6 +105,7 @@ jobs: | |
name: '${{env.CODECOV_UNIQUE_NAME}}' | ||
|
||
Android-Build-and-Release: | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
name: Testing build for android | ||
permissions: | ||
contents: write | ||
|
@@ -224,6 +145,7 @@ jobs: | |
This may or may not be stable, so please have a look at the stable release(s). | ||
iOS-Build: | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
name: iOS Build and Relaese | ||
runs-on: macos-latest | ||
needs: Flutter-Testing | ||
|
117 changes: 117 additions & 0 deletions
117
.github/workflows/talawa_mobile_md_mdx_format_adjuster.py
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,117 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: UTF-8 -*- | ||
""" | ||
Script to adjust Dart documentation for MDX compatibility in Docusaurus. | ||
This script scans Dart-generated Markdown files and modifies special characters, | ||
code blocks, and Dart-specific symbols to comply with the MDX syntax used in | ||
Docusaurus v3. It ensures compatibility with the markdown processor by making | ||
adjustments like escaping certain characters and modifying code blocks. | ||
This script complies with: | ||
1) Pylint | ||
2) Pydocstyle | ||
3) Pycodestyle | ||
4) Flake8 | ||
""" | ||
import os | ||
import argparse | ||
import re | ||
|
||
def escape_mdx_characters(text): | ||
""" | ||
Escape special characters (<, >, {, }) in Dart docs to make them MDX compatible. | ||
Args: | ||
text (str): The text content to be processed. | ||
Returns: | ||
str: The modified string with escaped MDX characters. | ||
""" | ||
# Replace unescaped <, >, {, } with their escaped equivalents | ||
patterns = { | ||
"<": r"(?<!\\)<", | ||
">": r"(?<!\\)>", | ||
"{": r"(?<!\\){", | ||
"}": r"(?<!\\)}" | ||
} | ||
|
||
for char, pattern in patterns.items(): | ||
text = re.sub(pattern, f"\\{char}", text) | ||
|
||
return text | ||
|
||
def adjust_dart_code_blocks(text): | ||
""" | ||
Modify Dart code blocks to ensure they are correctly formatted in MDX. | ||
This function replaces Dart code block annotations like `///` or `//` | ||
and adjusts code block syntax. | ||
Args: | ||
text (str): The content to be processed. | ||
Returns: | ||
str: The modified text with Dart code blocks adjusted. | ||
""" | ||
# Ensure the Dart code blocks use ```dart for proper syntax highlighting | ||
text = re.sub(r"```(\s*)dart", r"```dart", text) | ||
|
||
# Handle single-line comments in Dart (`//` or `///`) | ||
text = re.sub(r"(///|//)\s*", "", text) | ||
|
||
return text | ||
|
||
def process_file(filepath): | ||
""" | ||
Process a single Dart Markdown file for MDX compatibility. | ||
Args: | ||
filepath (str): The path to the Markdown file to be processed. | ||
Returns: | ||
None: Writes the processed content back to the file if any changes occur. | ||
""" | ||
with open(filepath, 'r', encoding='utf-8') as file: | ||
content = file.read() | ||
|
||
# Escape MDX special characters | ||
content = escape_mdx_characters(content) | ||
# Adjust Dart code blocks for MDX | ||
content = adjust_dart_code_blocks(content) | ||
|
||
# Write back to the file only if changes were made | ||
with open(filepath, 'w', encoding='utf-8') as file: | ||
file.write(content) | ||
|
||
def main(): | ||
""" | ||
Main function to process all Dart Markdown files in a specified directory. | ||
Scans for Markdown files and processes them for MDX compatibility, | ||
especially focusing on Dart-specific docs. | ||
Args: | ||
None | ||
Returns: | ||
None | ||
""" | ||
parser = argparse.ArgumentParser(description="Adjust Dart Markdown files for MDX compatibility.") | ||
parser.add_argument( | ||
"--directory", | ||
type=str, | ||
required=True, | ||
help="Directory containing Markdown files to process." | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
# Process each Markdown file in the directory | ||
for root, _, files in os.walk(args.directory): | ||
for file in files: | ||
if file.lower().endswith(".md"): | ||
process_file(os.path.join(root, file)) | ||
|
||
if __name__ == "__main__": | ||
main() |
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
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,26 @@ | ||
///This class creates an event agenda category model. | ||
class AgendaCategory { | ||
AgendaCategory({ | ||
this.id, | ||
this.name, | ||
this.description, | ||
}); | ||
|
||
/// Creates a new `AgendaCategory` instance from a JSON map. | ||
factory AgendaCategory.fromJson(Map<String, dynamic> json) { | ||
return AgendaCategory( | ||
id: json['_id'] as String?, | ||
name: json['name'] as String?, | ||
description: json['description'] as String?, | ||
); | ||
} | ||
|
||
/// Id of the agenda category. | ||
final String? id; | ||
|
||
/// Name of the category. | ||
final String? name; | ||
|
||
/// Description of the category. | ||
final String? description; | ||
} |
Oops, something went wrong.