Convert images to images instead of links #5

Merged
tslocum merged 3 commits from f/gmitohtml:image-output into master 2021-07-10 03:03:20 +00:00
Contributor

Image links will result in a img tag instead of a a tag. This
behaviour is disabled by default and can be enabled by adding the
following line to to config file:

convertimages: true

To get access to the config in the convert file, I had to move the
config file inside the gmitohtml namespace. This is specially handy
later on if the config file contains other settings which are useful for
the rest of the codebase.

But this resolves #4 only partially, because it seems that binary files are not supported jet. Can you confirm that @tslocum ?

Image links will result in a `img` tag instead of a `a` tag. This behaviour is disabled by default and can be enabled by adding the following line to to config file: convertimages: true To get access to the config in the convert file, I had to move the config file inside the gmitohtml namespace. This is specially handy later on if the config file contains other settings which are useful for the rest of the codebase. But this resolves #4 only partially, because it seems that binary files are not supported jet. Can you confirm that @tslocum ?
f added 1 commit 2021-06-08 23:26:44 +00:00
586b293bef Convert images to images instead of links
Image links will result in a `img` tag instead of a `a` tag. This
behaviour is disabled by default and can be enabled by adding the
following line to to config file:

convertimages: true

To get access to the config in the convert file, I had to move the
config file inside the gmitohtml namespace. This is specially handy
later on if the config file contains other settings which are useful for
the rest of the codebase.
Author
Contributor

Any update on this @tslocum ?

Any update on this @tslocum ?
Owner

Thanks for your contributions. I plan on reviewing your PRs over the next week or so.

Thanks for your contributions. I plan on reviewing your PRs over the next week or so.
tslocum requested changes 2021-07-09 05:45:39 +00:00
config.go Outdated
@ -1,4 +1,4 @@
package main
package gmitohtml
Owner

Please do not rename the package.

Please do not rename the package.
Author
Contributor

This was intended, see my initial PR comment.

This was intended, see my initial PR comment.
tslocum marked this conversation as resolved
@ -132,3 +131,1 @@
link = append(link, []byte(`</a>`)...)
result = append(result, link...)
result = append(result, []byte("<br>")...)
// If link ends with gif/png/jpg, add a image instead of a link
Owner

Please move this comment to just before if isImage && Config.ConvertImages {.

Please move this comment to just before `if isImage && Config.ConvertImages {`.
f marked this conversation as resolved
@ -135,0 +138,4 @@
}
}
if isImage && Config.ConvertImages {
Owner

Please de-duplicate the code in these blocks to your best ability.

Please de-duplicate the code in these blocks to your best ability.
f marked this conversation as resolved
f added 1 commit 2021-07-09 20:47:05 +00:00
0bec3c3eef Fix wrong package name and clean up tag-building
DRY the tag building for links and images.
f added 1 commit 2021-07-09 21:20:55 +00:00
tslocum merged commit 8e8eef57e2 into master 2021-07-10 03:03:20 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tslocum/gmitohtml#5
No description provided.