This repository has been archived by the owner on Feb 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add asset handling and fix minor changelog issue (#46)
- Loading branch information
1 parent
63ef7c4
commit 0ebd0c6
Showing
26 changed files
with
371 additions
and
39 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 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 |
---|---|---|
|
@@ -2,14 +2,26 @@ | |
|
||
## 0.6.0 (2022-01-XX) | ||
|
||
### 🚀 Features (1) | ||
### 🚀 Features (2) | ||
|
||
#### `[email protected]` | ||
|
||
- Process replacement commands in partial files | ||
|
||
- Suggested in [GH#30 - Process replacement commands in partial files](https://github.com/joachimdalen/azext/issues/30) | ||
- Added in [PR#45 - Process replacement commands in partial files](https://github.com/joachimdalen/azext/pull/45) | ||
|
||
- Added asset handling for images to support multiple documentation displays | ||
- Suggested in [GH#3 - Documentation generation](https://github.com/joachimdalen/azext/issues/3) | ||
- Added in [PR#46 - Add asset handling and fix minor changelog issue](https://github.com/joachimdalen/azext/pull/46) | ||
|
||
### 🐛 Fixes (1) | ||
|
||
#### `[email protected]` | ||
|
||
- Fixed extra splitting line added for the first version | ||
- Fixed in [PR#46 - Add asset handling and fix minor changelog issue](https://github.com/joachimdalen/azext/pull/46) | ||
|
||
--- | ||
|
||
## 0.5.0 (2022-01-16) | ||
|
@@ -98,18 +110,6 @@ | |
|
||
## 0.2.2 (2021-12-26) | ||
|
||
### 💬 Other (2) | ||
|
||
#### `[email protected]` | ||
|
||
- Refactor how cli parameters are set in the cli definition | ||
- Pull Request: [PR#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25) | ||
|
||
#### `[email protected]` | ||
|
||
- Refactor how cli parameters are set in the cli definition | ||
- Pull Request: [PR#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25) | ||
|
||
### 🐛 Fixes (3) | ||
|
||
#### `[email protected]` | ||
|
@@ -129,6 +129,18 @@ | |
- Reported in [GH#21 - Can not initialize in a new project](https://github.com/joachimdalen/azext/issues/21) | ||
- Fixed in [PR#26 - Fix not being able to initialize in a new project](https://github.com/joachimdalen/azext/pull/26) | ||
|
||
### 💬 Other (2) | ||
|
||
#### `[email protected]` | ||
|
||
- Refactor how cli parameters are set in the cli definition | ||
- Pull Request: [PR#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25) | ||
|
||
#### `[email protected]` | ||
|
||
- Refactor how cli parameters are set in the cli definition | ||
- Pull Request: [PR#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25) | ||
|
||
--- | ||
|
||
## 0.2.1 (2021-12-25) | ||
|
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
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
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
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,54 @@ | ||
import path from 'path'; | ||
|
||
import ReplacementCommandFormatter, { | ||
ReplacementOptions | ||
} from '../models/replacement-command-formatter'; | ||
import TaskService from '../task-service'; | ||
|
||
export interface IncludeImageFormatterOptions { | ||
imagePath: string; | ||
profile?: string; | ||
} | ||
|
||
export default class IncludeImageFormatter extends ReplacementCommandFormatter<IncludeImageFormatterOptions> { | ||
private _service: TaskService; | ||
|
||
constructor() { | ||
super(); | ||
this._service = new TaskService(); | ||
} | ||
async getFormatted( | ||
options: ReplacementOptions<IncludeImageFormatterOptions> | ||
): Promise<any> { | ||
if (options.profile === undefined) { | ||
throw new Error('A profile is required. Set with --profile'); | ||
} | ||
|
||
const config = await this._service.getReadMeConfig(); | ||
|
||
if (config) { | ||
const profile = config.profiles?.find((x) => x.name === options.profile); | ||
|
||
if (profile === undefined) { | ||
throw new Error('No such profile ' + options.profile); | ||
} | ||
|
||
const imgPath = path.join(profile.imageFolder, options.imagePath); | ||
|
||
const imagePath = profile.relative | ||
? path.join( | ||
path.relative( | ||
path.resolve(path.dirname(options.input)), | ||
path.resolve(path.dirname(imgPath)) | ||
), | ||
path.basename(options.imagePath) | ||
) | ||
: imgPath; | ||
|
||
const img = `![${options.imagePath}](${imagePath})`; | ||
return img; | ||
} | ||
|
||
return undefined; | ||
} | ||
} |
Oops, something went wrong.