Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix documentation workflow and added script.py for typedoc MPX compatible #1314

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ jobs:

- name: Generate Documentation of Markdown pages
run: |
yarn global add typedoc
yarn add typedoc-plugin-markdown
yarn typedoc --entryPoints src/components src/screens --out talawa-admin-docs --plugin typedoc-plugin-markdown --theme markdown --entryPointStrategy expand --exclude "**/*.test.ts" --exclude "**/*.css"
npm install --global typedoc
npm install typedoc-plugin-markdown
npm install --save-dev @types/node
npx typedoc --entryPoints src/components src/screens --out talawa-admin-docs --plugin typedoc-plugin-markdown --theme markdown --entryPointStrategy expand --exclude "**/*.test.ts" --exclude "**/*.css"

- name: Make Markdown Files MPX Compatible
run: python ./script.py --directory talawa-admin-docs
dhiraj0911 marked this conversation as resolved.
Show resolved Hide resolved

- name: Checking doc updated
id: DocUpdated
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the name of the script to be more self-explanatory. Do this for the other PR too

"""
Script to make Markdown files MPX compatible.

This script scans Markdown files and escapes special characters (<, >, {, })
to make them compatible with the MPX standard used in Docusaurus v3.

This script complies with:
1) Pylint
2) Pydocstyle
3) Pycodestyle
4) Flake8
"""

import os
import argparse
import re

def escape_mpx_characters(text):
"""
Escape special characters in a text string for MPX compatibility.

Args:
text: A string containing the text to be processed.

Returns:
A string with special characters (<, >, {, }) escaped.
"""
# Define the replacements
replacements = {
"<": "\\<",
">": "\\>",
"{": "\\{",
"}": "\\}"
}

# Replace the special characters
for old, new in replacements.items():
text = text.replace(old, new)

return text

def process_file(filepath):
"""
Process a single Markdown file for MPX compatibility.

Args:
filepath: The path to the Markdown file to process.

Returns:
None, writes the processed content back to the file.
"""
with open(filepath, 'r', encoding='utf-8') as file:
content = file.read()

# Escape MPX characters
new_content = escape_mpx_characters(content)

# Write the processed content back to the file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only do this if there is a change. Do this for the other PR too.

with open(filepath, 'w', encoding='utf-8') as file:
file.write(new_content)

def main():
"""
Main function to process all Markdown files in a given directory.

Scans for all Markdown files in the specified directory and processes each
one for MPX compatibility.

Args:
None

Returns:
None
"""
parser = argparse.ArgumentParser(description="Make Markdown files MPX compatible.")
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.endswith(".md"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this case insensitive. Do this for the other PR too

process_file(os.path.join(root, file))

if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Follow this [link](https://getbootstrap.com/docs/5.3/customize/sass/) to learn h

**File Structure**

- `src/assets/scss/components/{partialFile}.scss` - where the {partialFile} are the following files
- `src/assets/scss/components/{'{partialFile}'}.scss` - where the {'{partialFile}'} are the following files
- **_accordion.scss**
- **_alert.scss**
- **_badge.scss**
Expand All @@ -195,12 +195,12 @@ Follow this [link](https://getbootstrap.com/docs/5.3/customize/sass/) to learn h
- **_progress.scss**
- **_spinners.scss**

- `src/assets/scss/content/{partialFile}.scss` - where the {partialFile} are the following files
- `src/assets/scss/content/{'{partialFile}'}.scss` - where the {'{partialFile}'} are the following files
- **_table.scss**
- **_typography.scss**


- `src/assets/scss/forms/{partialFile}.scss` - where the {partialFile} are the following files
- `src/assets/scss/forms/{'{partialFile}'}.scss` - where the {'{partialFile}'} are the following files
- **_check-radios.scss**
- **_floating-label.scss**
- **_form-control.scss**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

### fetchInstalled

▸ **fetchInstalled**(): `Promise`<`any`\>
▸ **fetchInstalled**(): `Promise`\<`any`\\>

#### Returns

`Promise`<`any`\>
`Promise`\<`any`\\>

#### Defined in

Expand All @@ -40,11 +40,11 @@ ___

### fetchStore

▸ **fetchStore**(): `Promise`<`any`\>
▸ **fetchStore**(): `Promise`\<`any`\\>

#### Returns

`Promise`<`any`\>
`Promise`\<`any`\\>

#### Defined in

Expand All @@ -54,7 +54,7 @@ ___

### generateLinks

▸ **generateLinks**(`plugins`): { `name`: `string` ; `url`: `string` }[]
▸ **generateLinks**(`plugins`): \{ `name`: `string` ; `url`: `string` \}[]

#### Parameters

Expand All @@ -64,7 +64,7 @@ ___

#### Returns

{ `name`: `string` ; `url`: `string` }[]
\{ `name`: `string` ; `url`: `string` \}[]

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ___

### checkIn

• **checkIn**: ``null`` \| { `_id`: `string` ; `allotedRoom`: `string` ; `allotedSeat`: `string` ; `time`: `string` }
• **checkIn**: ``null`` \| \{ `_id`: `string` ; `allotedRoom`: `string` ; `allotedSeat`: `string` ; `time`: `string` \}

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ___

### handleClose

• **handleClose**: () => `void`
• **handleClose**: () =\> `void`

#### Type declaration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

### checkIn

• **checkIn**: ``null`` \| { `_id`: `string` ; `allotedRoom`: `string` ; `allotedSeat`: `string` ; `time`: `string` }
• **checkIn**: ``null`` \| \{ `_id`: `string` ; `allotedRoom`: `string` ; `allotedSeat`: `string` ; `time`: `string` \}

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ___

### setHideDrawer

• **setHideDrawer**: `Dispatch`<`SetStateAction`<``null`` \| `boolean`\>\>
• **setHideDrawer**: `Dispatch`\<`SetStateAction`\<``null`` \| `boolean`\\>\\>

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ___

### setHideDrawer

• **setHideDrawer**: `Dispatch`<`SetStateAction`<``null`` \| `boolean`\>\>
• **setHideDrawer**: `Dispatch`\<`SetStateAction`\<``null`` \| `boolean`\\>\\>

#### Defined in

Expand Down
8 changes: 4 additions & 4 deletions talawa-admin-docs/modules/components_AddOn_AddOn.default.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
| Name | Type |
| :------ | :------ |
| `children` | ``null`` |
| `extras` | {} |
| `extras` | \{\} |
| `name` | `string` |

#### Defined in
Expand All @@ -39,9 +39,9 @@ ___

| Name | Type |
| :------ | :------ |
| `children` | `Requireable`<`any`\> |
| `extras` | `Requireable`<`InferProps`<{ `actions`: `Requireable`<`InferProps`<{}\>\> ; `components`: `Requireable`<`InferProps`<{}\>\> }\>\> |
| `name` | `Requireable`<`string`\> |
| `children` | `Requireable`\<`any`\\> |
| `extras` | `Requireable`\<`InferProps`\<\{ `actions`: `Requireable`\<`InferProps`\<\{\}\\>\\> ; `components`: `Requireable`\<`InferProps`\<\{\}\\>\\> \}\\>\\> |
| `name` | `Requireable`\<`string`\\> |

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ ___

| Name | Type |
| :------ | :------ |
| `configurable` | `Requireable`<`boolean`\> |
| `description` | `Requireable`<`string`\> |
| `enabled` | `Requireable`<`boolean`\> |
| `isInstalled` | `Requireable`<`boolean`\> |
| `title` | `Requireable`<`string`\> |
| `configurable` | `Requireable`\<`boolean`\\> |
| `description` | `Requireable`\<`string`\\> |
| `enabled` | `Requireable`\<`boolean`\\> |
| `isInstalled` | `Requireable`\<`boolean`\\> |
| `title` | `Requireable`\<`string`\\> |

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ___

| Name | Type |
| :------ | :------ |
| `createdBy` | `Requireable`<`string`\> |
| `createdBy` | `Requireable`\<`string`\\> |

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

### changeLanguage

▸ **changeLanguage**(`languageCode`): `Promise`<`void`\>
▸ **changeLanguage**(`languageCode`): `Promise`\<`void`\\>

#### Parameters

Expand All @@ -23,7 +23,7 @@

#### Returns

`Promise`<`void`\>
`Promise`\<`void`\\>

#### Defined in

Expand Down
2 changes: 1 addition & 1 deletion talawa-admin-docs/modules/components_CheckIn_TableRow.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| :------ | :------ |
| `«destructured»` | `Object` |
| › `data` | [`InterfaceTableCheckIn`](../interfaces/components_CheckIn_types.InterfaceTableCheckIn.md) |
| › `refetch` | () => `void` |
| › `refetch` | () =\> `void` |

#### Returns

Expand Down
6 changes: 3 additions & 3 deletions talawa-admin-docs/modules/components_CheckIn_mocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

### checkInMutationSuccess

• `Const` **checkInMutationSuccess**: { `request`: { `query`: `DocumentNode` = MARK\_CHECKIN; `variables`: { `allotedRoom`: `string` = ''; `allotedSeat`: `string` = ''; `eventId`: `string` = 'event123'; `userId`: `string` = 'user123' } } ; `result`: { `data`: { `checkIn`: { `_id`: `string` = '123' } } } }[]
• `Const` **checkInMutationSuccess**: \{ `request`: \{ `query`: `DocumentNode` = MARK\_CHECKIN; `variables`: \{ `allotedRoom`: `string` = ''; `allotedSeat`: `string` = ''; `eventId`: `string` = 'event123'; `userId`: `string` = 'user123' \} \} ; `result`: \{ `data`: \{ `checkIn`: \{ `_id`: `string` = '123' \} \} \} \}[]

#### Defined in

Expand All @@ -24,7 +24,7 @@ ___

### checkInMutationUnsuccess

• `Const` **checkInMutationUnsuccess**: { `error`: `Error` ; `request`: { `query`: `DocumentNode` = MARK\_CHECKIN; `variables`: { `allotedRoom`: `string` = ''; `allotedSeat`: `string` = ''; `eventId`: `string` = 'event123'; `userId`: `string` = 'user123' } } }[]
• `Const` **checkInMutationUnsuccess**: \{ `error`: `Error` ; `request`: \{ `query`: `DocumentNode` = MARK\_CHECKIN; `variables`: \{ `allotedRoom`: `string` = ''; `allotedSeat`: `string` = ''; `eventId`: `string` = 'event123'; `userId`: `string` = 'user123' \} \} \}[]

#### Defined in

Expand All @@ -34,7 +34,7 @@ ___

### checkInQueryMock

• `Const` **checkInQueryMock**: { `request`: { `query`: `DocumentNode` = EVENT\_CHECKINS; `variables`: { `id`: `string` = 'event123' } } ; `result`: { `data`: [`InterfaceAttendeeQueryResponse`](../interfaces/components_CheckIn_types.InterfaceAttendeeQueryResponse.md) = checkInQueryData } }[]
• `Const` **checkInQueryMock**: \{ `request`: \{ `query`: `DocumentNode` = EVENT\_CHECKINS; `variables`: \{ `id`: `string` = 'event123' \} \} ; `result`: \{ `data`: [`InterfaceAttendeeQueryResponse`](../interfaces/components_CheckIn_types.InterfaceAttendeeQueryResponse.md) = checkInQueryData \} \}[]

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

### default

▸ **default**(`props`, `context?`): ``null`` \| `ReactElement`<`any`, `any`\>
▸ **default**(`props`, `context?`): ``null`` \| `ReactElement`\<`any`, `any`\\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `props` | `PropsWithChildren`<`InterfaceCalendarProps`\> |
| `props` | `PropsWithChildren`\<`InterfaceCalendarProps`\\> |
| `context?` | `any` |

#### Returns

``null`` \| `ReactElement`<`any`, `any`\>
``null`` \| `ReactElement`\<`any`, `any`\\>

#### Defined in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

| Name | Type |
| :------ | :------ |
| `handleClose` | () => `void` |
| `organization` | { `_id`: `string` ; `members`: `InterfaceUser`[] } |
| `handleClose` | () =\> `void` |
| `organization` | \{ `_id`: `string` ; `members`: `InterfaceUser`[] \} |
| `organization._id` | `string` |
| `organization.members` | `InterfaceUser`[] |
| `refetchData` | () => `void` |
| `refetchData` | () =\> `void` |
| `show` | `boolean` |
| `task` | `InterfaceTask` |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

### default

▸ **default**(`props`, `context?`): ``null`` \| `ReactElement`<`any`, `any`\>
▸ **default**(`props`, `context?`): ``null`` \| `ReactElement`\<`any`, `any`\\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `props` | `PropsWithChildren`<`InterfaceUserPasswordUpdateProps`\> |
| `props` | `PropsWithChildren`\<`InterfaceUserPasswordUpdateProps`\\> |
| `context?` | `any` |

#### Returns

``null`` \| `ReactElement`<`any`, `any`\>
``null`` \| `ReactElement`\<`any`, `any`\\>

#### Defined in

Expand Down
Loading