Skip to content

Commit

Permalink
Add triple quotes export option for python docstrings (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
SolvedSphinx126 authored May 9, 2024
1 parent 1f439b7 commit 2e804a1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useObserver } from "mobx-react";
import * as React from "react";

export interface IExportConfig {
wrapper?: "star" | "star-filled" | "hash" | "slash" | "three-slashes" | "dash" | "apostrophe" | "semicolon" | "backticks" | "four-spaces";
wrapper?: "star" | "star-filled" | "triple-quotes" | "hash" | "slash" | "three-slashes" | "dash" | "apostrophe" | "semicolon" | "backticks" | "four-spaces";
indent?: number;
characters?: "basic" | "extended";
}
Expand Down Expand Up @@ -84,6 +84,9 @@ export function ExportDialog({
<MenuItem value={"star-filled"}>
Filled multi-line <CommentTypeChip label="/***/" />
</MenuItem>
<MenuItem value={"triple-quotes"}>
Quotes multi-line <CommentTypeChip label='""" """' />
</MenuItem>
<MenuItem value={"hash"}>
Hashes <CommentTypeChip label="#" />
</MenuItem>
Expand Down Expand Up @@ -204,6 +207,13 @@ function applyConfig(text: string, exportConfig: IExportConfig) {
" */",
]);
}
if (exportConfig.wrapper === "triple-quotes") {
setLines([
exportConfig.characters === "basic" ? "\"\"\"" : "u\"\"\"",
...lines(),
"\"\"\"",
]);
}
if (exportConfig.wrapper === "hash") {
setLines(lines().map((line) => `# ${line}`));
}
Expand Down

0 comments on commit 2e804a1

Please sign in to comment.