That's right, now you can keep up with the latest news from PVS-Studio! Our developers noticed — they prefer to get news about other products by email, but PVS-Studio doesn't have this option. So, one of our development teams got together and made the newsletter the way they wanted it to be. Basically, the team was reinventing a wheel for a year, but they were enthusiastic about it! If interested, you're welcome to read.
In August 2021, we were developing a new system to handle users' requests (for trial licenses, support, and more). Right then we realized that the news from our blog was just the same kind of information on our product as the one we already mail out. And we expected to implement the article newsletter almost identically to our existing one, from a technical standpoint. So we decided start a new project: the development of the newsletter. This turned out to be an epic year-long task.
We began with analyzing our content and brainstorming how to share it creatively with our audience.
Currently our blog content is as follows:
Email builder with all possible options seemed overly complicated for us.
Eventually we simplified the blog mailing concept to these two options:
You can subscribe to these newsletters together or choose only one option interesting for you.
Writing and publishing news digests should be as easy as writing and publishing articles. And for the articles we have a ready-made solution.
We just write articles in Word, and our own plugin, Publisher, makes web-pages for our website out of the Word documents in this order:
Stages of a publication process |
Description |
---|---|
Author |
Writes and commits an article to the repository. |
SCM |
Stores the latest version of the file in the version control system. |
Local Server |
Downloads all the relevant Word files. |
Publisher |
Converts Word files to Html pages. |
Importer |
Uploads files to a cloud server. |
Site |
Publishes an article on the website in the "Blog" section. |
So, we just extended the functionality of Publisher to implement mailing.
The body of the email is the HTML markup. That's why we asked our teammates from the web department to create the layout. We also used the same class that converts Word documents to Html:
public class HtmlTransform : WTransform
{
....
}
and implemented a new mailing class (first the releases, then digests). Thus, we override the implementation of the different elements of the Word document:
public class ReleaseTransform : HtmlTransform
{
....
public override bool SaveImages() => false;
public override string DocumentStart() => Resource.Release_Start;
public override string DocumentEnd() => Resource.Release_End;
....
}
A press release is just an article about features in the new analyzer version, but with different layout.
But the blog mailing is more complicated. At first, we had to disable many elements of the parent generator:
public class DigestTransform : HtmlTransform
{
....
public override void TransformHeading3(StringBuilder content,
WHeading header)
{
NotSupported("Digest doesn't support Heading 3.");
}
public override void TransformTable(StringBuilder content,
WTable table)
{
NotSupported("Digest doesn't support tables.");
}
public override void TransformList(StringBuilder content,
List<WListItem> listItems)
{
NotSupported("Digest doesn't support lists.");
}
....
}
And then we supported the new text format so the Word documents with news would be converted into emails.
As I mentioned above, our authors write articles in Word. To simplify the automatic conversion for the blog mailing, we came up with a certain format of text writing.
This is what the original email looks like:
New posts in the PVS-Studio blog
PVS-Studio 7.19: what's new?
Date: 24.06.2022
Tags: Release
Post: https://pvs-studio.com/en/blog/posts/0958/
Image: https://cdn.pvs-studio.com/import/docx/blog/0958_Release_7_19/image1.png
Recently, we have released a new PVS-Studio version — 7.19. In this note, we'll tell you about new features in the analyzer, the enhanced documentation, as well as what to read and... what to play.
Challenge: can you spot an error in C++ code?
Date: 29.06.2022
Tags: Cpp
Post: https://pvs-studio.com/en/blog/posts/cpp/0960/
Image: https://cdn.pvs-studio.com/import/docx/blog/0960_Game_Cpp/image1.png
PVS-Studio developers made an entertaining quiz for you. Try to quickly find a bug in a code fragment. If you spot an error - click on it.
Since 99% of all posts are our own articles, then the process of publication should be completely automated.
That's why we added some new features to our Word plugin:
Now we only have to click on the icon with the Word folder and select the necessary articles in the opened window. After that, the news text will be generated right in the opened Word document. If necessary, we can add more news that is not related to the previously published article. When we click on Digest, an HTML email is created. Then we only have to commit this HTML email to the version control system to provide a link to the browser version in the email.
To create an email about the new release, we only have to open this article and click on the Release button.
Also, the mailing scheduler was added to the admin panel. We add HTML files into the mailing scheduler, and then click on the Schedule button:
In October 2021, the email generator was done. We had to remake the layout once again, since if a project is not released for a long time, the external context changes. So, we had to keep pace with our teammates' developments.
In February 2022, the world welcomed our new system for handling user requests. We didn't include newsletters into that release — our website wasn't updated for this feature yet. That's why the next step was to allow users to subscribe or unsubscribe from the newsletter on the website.
Since the February release of the new system for handling user requests, we hit on the idea of its further development, which took up all our time. And only in July 2022, we returned to the blog mailing feature (while our website has long been ready). Also, some mailing failed again as the paths to images were changed on the website. The reason was still the same – until we released this feature, other teams were developing our website without regard to our unreleased subproject. Conclusion: delaying the release is terribly wrong for the development process.
In August 2022, we're returning to the blog mailing once again to finally finish what we started exactly a year ago.
So, why wasn't a third-party mailing service considered? Well, we still have to make the emails ourselves, and these emails are based on our content. We decided to implement the mailing on our own in order to collect all user activities in one place. This will help us create a functionality that will allow our paid customers and free users to create a personal account on our website.
Even if you got inspired by the idea of changing Word documents using the Word plugin (written in C#), I wouldn't advise you to hurry up and to start a new project of this kind. The future of this technology is murky. Microsoft has already announced the halting of VSTO plugins development, freezing the SDK at version .NET Framework 4.8. But the wide community keeps fighting for developing their own projects of this kind. Maybe someday we will see a transformation of this technology if the community achieves the opening of sources.
PVS-Studio has several more development teams which do not develop the static code analyzer directly. Our mission is to automate all the company's processes and help other teams be more visible to our customers, users, and subscribers. So, check out our eagerly awaited subscription page to witness the result of our efforts here.
0