-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
[Feature]: Remove newlines from RSS post titles #34
Comments
You can now use blog-post-workflow/blog-post-workflow.js Lines 240 to 254 in 0d45a71
You can do something like this: name: Latest Tweets workflow
on:
schedule: # Run workflow automatically
- cron: '0 * * * *'
jobs:
update-readme-with-blog:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gautamkrishnar/blog-post-workflow@master
with:
feed_list: "https://rss.app/feeds/7YyygtUxDsIaLQ3s.xml"
item_exec: |
post.title = post.title.replace('\n',' '); post.title = post.title.replace('\r\n',' ');
console.log("test\n world"); Another interesting use case example: name: Latest youtube videos
on:
schedule: # Run workflow automatically
- cron: '5 * * * *' # Runs every hour, on the hour
workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly
jobs:
update-readme-with-youtube:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gautamkrishnar/blog-post-workflow@master
with:
feed_list: "https://www.youtube.com/feeds/videos.xml?channel_id=UCvmONGrUQxL3B3PmSv1JQqQ"
item_exec: "post.title = post.title.split('|')[0]"
comment_tag_name: "YOUTUBE"
commit_message: "Updated with the latest youtube video" Stripping out html contents in description example: name: Latest blog post workflow
on:
schedule:
- cron: 0 * * * *
push:
branches:
- main
jobs:
update-readme-with-blog:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gautamkrishnar/blog-post-workflow@master
with:
max_post_count: '5'
feed_list: 'https://medium.com/feed/@nicko170'
template: '- [$title]($url): $description $newline'
date_format: 'UTC:ddd yyyy-mm-dd h:MM:ss TT Z'
filter_comments: medium
tag_post_pre_newline: 'true'
item_exec: |
post.description = post.description.replace(/<\/?[^>]+(>|$)/g, ""); |
Wow ! I'm simply shocked by your reactivity ! |
Just for the record. There is a problem with As an example, for my case, the correct item_exec: "post.title = post.title.replace(/(?:\\r\\n|\\r|\\n)/g,' ');" |
Thanks for pointing it out @nil0x42 |
@gautamkrishnar , is it possible to use this new feature to ignore an entry? |
@nil0x42 thanks for the suggestion, just released this feature. You can ignore any item by setting post variable to null via javascript using the Eg: item_exec: "if (post.title.indexOf('example title to ignore') > -1) post = null;" You may need to add proper escaping for some special characters. |
Hi ! Thank you again for the speed at which you adress issues ! Also, as item_exec migh alter title's length, it might be useful to put TITLE_MAX_LENGTH trimming block code after item_exec, so if item_exec changes the title-'s length, the trimming happens after. |
@nil0x42 oopsie, I will fix that, will update the code to use let instead. 👍 Happy to help. |
@nil0x42 thanks for your suggestions, it's now released: https://github.com/gautamkrishnar/blog-post-workflow/releases/tag/1.3.4 |
Is your feature request related to a problem? Please describe.
I use a twitter RSS feed as input, and sometimes titles containg newlines, leading to improper markdown formatting.
Describe the solution you'd like
Replace occurences of
\r\n
&\n
in the title by simple spaceDescribe alternatives you've considered
n/a
Additional context
Here's how titles get formatted:
The text was updated successfully, but these errors were encountered: