From c309bdb37359b67b247208a0e06abe599a4504db Mon Sep 17 00:00:00 2001 From: kik0220 <4346449+kik0220@users.noreply.github.com> Date: Tue, 9 Apr 2019 17:17:58 +0900 Subject: [PATCH] feat: add otrs.com custom parser (#353) --- fixtures/otrs.com/1553117632270.html | 522 +++++++++++++++++++ src/extractors/custom/index.js | 3 +- src/extractors/custom/otrs.com/index.js | 38 ++ src/extractors/custom/otrs.com/index.test.js | 112 ++++ 4 files changed, 674 insertions(+), 1 deletion(-) create mode 100644 fixtures/otrs.com/1553117632270.html create mode 100644 src/extractors/custom/otrs.com/index.js create mode 100644 src/extractors/custom/otrs.com/index.test.js diff --git a/fixtures/otrs.com/1553117632270.html b/fixtures/otrs.com/1553117632270.html new file mode 100644 index 000000000..c9fe023e8 --- /dev/null +++ b/fixtures/otrs.com/1553117632270.html @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + Silver Society – The young old people | OTRS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Silver Society – The young old people
+
+
+

By continuing to use this site, you agree to the use of cookies. More information. Accept

+
+
+
+ +
+
+ +
+ +
+
+
+
18/03/2019 |
+

Silver Society – The young old people

+

Older workers are often
+considered less efficient,
+less innovative in their thinking
+and not open to change.
+Is that true or do we
+have to change our attitude?

+
+ + + +
+
+
+ + +
+
+ young and old men go upstairs +
+
+ + + +
+ +
+
+
+
+

The world is getting old! All over. People are reaching higher ages than ever before in industrialized countries as well as in emerging economies and even lesser developed countries. The tempo is different in each place, but the problem is universal. As older populations increase, many systems are under pressure to adapt. And it is already clear today that the impacts of an aging population will become more and more noticable in coming decades.

+

The fact is that the older generation is becoming more and more important as a consumer. And, companies also have to think about making changes to their employee structure and culture to embrace this generation.

+

According to experts interviewed, there is concern that the generation of people who are 60 and over will no longer live up to today’s dynamic changes, are less efficient and do not have innovative thinking. Also, the elderly are not viewed as open to change. The rapid technological development and the ever-increasing complexity are considered further difficulties.

+

However, the trend clearly shows that more and more older people do not want to retire in the future, and they want to continue working because working longer can help you to stay fit and active.

+
+
+
+
+
+
+
+
+ +
Working, social contact and an active life helps to maintain performance and supports fitness in older age.”
+ + +
+
+
+
+
+
+
+
+

And that’s good, because one thing is certain: older employees have potential. Certainly, they bring a different kind of potential than someone who is just starting a career or a colleague in the “peak” of their career, but they are still important. Of course.

+

This thinking leads me to ask myself several questions:

+
    +
  • What do companies need to do to benefit from their older employees?
  • +
  • Or in other words – do we want to “profit” from them in the traditional meaning at all?
  • +
  • What is important to us, as leaders, in dealing with our older colleagues?
  • +
  • Do I have to structure my company in such a way that I have employees that bring me the most profit or that I also have the need for employees over 60?
  • +
  • Or is the value of these people completely different and I need a much broader view when looking at this topic?
  • +
  • Do we have to free ourselves from a purely business perspective? I guess, yes.
  • +
+

 

+

Therefore, we require cultural reorientation. We need to rethink, so to speak.

+

The corporate culture should be age-friendly. This means that older employees should not seen as a burden, but instead as valuable and useful. And they are – older colleagues can impart important knowledge to younger employees and act as role models.

+

What is the challenge when older people and younger employees meet?

+

Internalizing diversity and differences as a normal cultural state.

+

That means acceptance and equality of people who are different. So basically, we have the same challenge as with all kinds of diversity, be it skin color, origin, religion, political attitude, sexual orientation or gender. This awareness clearly leads us to the fact that, in the context of productivity and efficiency, older people cannot be compared to the “young go-getters.” And they should not be.

+

It’s not about integrating older people so that they achieve the same goals as 25-year-old employees. No, it’s about creating togetherness, breaking down prejudices, setting aside false expectations or ideas about the “benefit” of an employee, and instead thinking about each person individually. Because that is exactly what is needed if, despite age differences, we want to work together, live side-by-side and support each other.

+

Employees make their contribution not only by achieving sales figures in the shortest possible time with as much overtime as possible using state-of-the-art technology, but also by enriching others and the work environment.  The people themselves are the contribution. With all their differences. And especially when they do their jobs with pleasure.

+

We must take into account that, in contrast to earlier times, a lot has changed.

+

Older people today live completely differently and they feel younger and younger. Surveys show that their perceived age is between 10 and 20 years younger than their biological age. Due to our medical advances, people today increasingly reach a ripe old age with few health concerns. As a consequence, the desire for a more active, self-directed life arises. The traditional ideas of elderly activities and retirement homes are becoming less common. Rather, people who are older seek to not only live as long as possible without help, but to also live consciously and well.

+

All this shows how aging has changed. People beyond 60 years old today are socially interwoven differently than before. These changes contribute to the fact that “generation wars” are less likely to occur in companies than feared, because older people today have a completely different mentality, hence “are different” and use their potential to remain socially active.

+

They are also, so to speak, “up for a challenge.” They are curious and inquisitive. That is why you should train older employees in dealing with new work techniques or technology and should establish systems that specifically promote the exchange between younger and older colleagues. This enables the shared transfer and receipt of experiences.

+

But despite everything, such progress does not mean a loss of diversity.

+

Even as they learn new skills, older people retain their qualifications, experience, social skills and, last but not least, serenity. Instead, it’s simply about the human being as an individual and giving each individual the opportunity to learn and grow.

+
+
+
+
+
+
+
+
+ +
The new culture of aging requires a new corporate culture. It requires today’s management to rethink their take on older employees.
+ + +
+
+
+
+
+
+
+
+

The skills older employees bring can be huge benefits within the intergenerational teams that will inevitably form; however, age-related discrepancies can also lead to misunderstandings. In these teams, therefore, greater attention must be paid to avoid discrimination and clique formation. For example, diversity-sensitive management can help develop the aforementioned corporate culture and establish clear task distribution.

+

All these reflections show us very clearly that each individual has different motives, different goals, different possibilities and different priorities. For example, someone just entering the workforce is hoping for career opportunities, whereas an older employee is hoping to be part of something, to be involved in something and not to stand on the proverbial sidelines.

+

Both will deliver different work results to a company, but if we give both of them the freedom to do so, to act in accordance with their personal goals, we will enjoy two different, yet equally important and good, results. This comes from the fact that each adapted to the circumstances and neither was tied to unrealistic expectations.

+

So if we break away from traditional ways of thinking, both entrepreneurially and personally, we will most likely be able to reach more because we will be freer. We will not only view record sales figures as a success, but also a thriving corporate culture. A coexistence of different people.

+

As is often the case, it is also about our personal commitment. Each of us can make a significant contribution by integrating older colleagues into the company. The employer can support this through face-to-face discussions, education and informational campaigns.

+

Please never forget: We all become old – if we are lucky.

+
+
+
+
+ + + + +
+
+
+ Text:
+ Photos: John Moeses Bauan on Unsplash
+
+
+
+

+ + + Share the Story    

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +

Categories

+ + + +
+
+ +
+
+ + + + +
+
+
+
+

Follow us

+ + + +
+
+
+
+ + + + + + + + + +
+ + + + +
+
+ + +
+ + + + + + + + + + + + + + + + + + + diff --git a/src/extractors/custom/index.js b/src/extractors/custom/index.js index efdce6d83..60b9d74fc 100644 --- a/src/extractors/custom/index.js +++ b/src/extractors/custom/index.js @@ -94,4 +94,5 @@ export * from './www.fastcompany.com'; export * from './blisterreview.com'; export * from './news.mynavi.jp'; export * from './github.com'; -export * from './www.reddit.com'; \ No newline at end of file +export * from './www.reddit.com'; +export * from './otrs.com'; diff --git a/src/extractors/custom/otrs.com/index.js b/src/extractors/custom/otrs.com/index.js new file mode 100644 index 000000000..a610ec9f0 --- /dev/null +++ b/src/extractors/custom/otrs.com/index.js @@ -0,0 +1,38 @@ +export const OtrsComExtractor = { + domain: 'otrs.com', + + title: { + selectors: ['#main article h1'], + }, + + author: { + selectors: ['div.dateplusauthor a'], + }, + + date_published: { + selectors: [['meta[name="article:published_time"]', 'value']], + }, + + dek: { + selectors: [['meta[name="og:description"]', 'value']], + }, + + lead_image_url: { + selectors: [['meta[name="og:image"]', 'value']], + }, + + content: { + selectors: ['#main article'], + + defaultCleaner: false, + + transforms: {}, + + clean: [ + 'div.dateplusauthor', + 'div.gr-12.push-6.footershare', + '#atftbx', + 'div.category-modul', + ], + }, +}; diff --git a/src/extractors/custom/otrs.com/index.test.js b/src/extractors/custom/otrs.com/index.test.js new file mode 100644 index 000000000..ddddbbbd8 --- /dev/null +++ b/src/extractors/custom/otrs.com/index.test.js @@ -0,0 +1,112 @@ +import assert from 'assert'; +import URL from 'url'; +import cheerio from 'cheerio'; + +import Mercury from 'mercury'; +import getExtractor from 'extractors/get-extractor'; +import { excerptContent } from 'utils/text'; + +const fs = require('fs'); + +describe('OtrsComExtractor', () => { + describe('initial test case', () => { + let result; + let url; + beforeAll(() => { + url = 'https://otrs.com/otrsmag/silver-society-the-young-old-people/'; + const html = fs.readFileSync('./fixtures/otrs.com/1553117632270.html'); + result = Mercury.parse(url, { + html, + fallback: false, + }); + }); + + it('is selected properly', () => { + // This test should be passing by default. + // It sanity checks that the correct parser + // is being selected for URLs from this domain + const extractor = getExtractor(url); + assert.equal(extractor.domain, URL.parse(url).hostname); + }); + + it('returns the title', async () => { + // To pass this test, fill out the title selector + // in ./src/extractors/custom/otrs.com/index.js. + const { title } = await result; + + // Update these values with the expected values from + // the article. + assert.equal(title, `Silver Society – The young old people`); + }); + + it('returns the author', async () => { + // To pass this test, fill out the author selector + // in ./src/extractors/custom/otrs.com/index.js. + const { author } = await result; + + // Update these values with the expected values from + // the article. + assert.equal(author, 'André Mindermann'); + }); + + it('returns the date_published', async () => { + // To pass this test, fill out the date_published selector + // in ./src/extractors/custom/otrs.com/index.js. + const { date_published } = await result; + + // Update these values with the expected values from + // the article. + assert.equal(date_published, `2019-03-18T09:00:11.000Z`); + }); + + it('returns the dek', async () => { + // To pass this test, fill out the dek selector + // in ./src/extractors/custom/otrs.com/index.js. + const { dek } = await result; + + // Update these values with the expected values from + // the article. + assert.equal( + dek, + 'Older workers are often considered less efficient, less innovative in their thinking and not open to change. Is that true or do we have to change our attitude?' + ); + }); + + it('returns the lead_image_url', async () => { + // To pass this test, fill out the lead_image_url selector + // in ./src/extractors/custom/otrs.com/index.js. + const { lead_image_url } = await result; + + // Update these values with the expected values from + // the article. + assert.equal( + lead_image_url, + `https://otrs.com/wp-content/uploads/john-moeses-bauan-687723-unsplash-1-e1552668096960.jpg` + ); + }); + + it('returns the content', async () => { + // To pass this test, fill out the content selector + // in ./src/extractors/custom/otrs.com/index.js. + // You may also want to make use of the clean and transform + // options. + const { content } = await result; + + const $ = cheerio.load(content || ''); + + const first13 = excerptContent( + $('*') + .first() + .text(), + 13 + ); + + // Update these values with the expected values from + // the article. + assert.equal( + first13, + 'Older workers are often considered less efficient, less innovative in their thinking and' + ); + }); + }); +});