#1 2015-07-13 06:55

UksusoFF
Member
Registered: 2015-07-13
Posts: 3

More HTML tags?

Hi!

Can I rename files with html canonical or shortlink tag?

Offline

#2 2015-07-13 07:06

UksusoFF
Member
Registered: 2015-07-13
Posts: 3

Re: More HTML tags?

Meta tags also will be usefull.

For e.g.:
<link rel="canonical" href=" " />
<link rel="shortlink" href=" " />
<meta property="og:site_name" content=" " />
<meta property="og:type" content="article" />
<meta property="og:url" content=" " />
<meta property="og:updated_time" content="2015-01-05T13:56:36+04:00" />
<meta property="og:image" content=" " />
<meta property="article:published_time" content="2012-01-20T17:00:36+04:00" />
<meta property="article:modified_time" content="2015-01-05T13:56:36+04:00" />

Offline

#3 2015-07-13 17:19

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,479

Re: More HTML tags?

You can extract anything you want using a PascalScript rule.

For example, the code below extracts the content of <TITLE> HTML tag.

const
  REGEX_PATTERN = '<title>(.*?)</title>';
var
  Content: WideString;
  Matches: TStringsArray;
begin
  Content := UTF8Decode(FileReadContent(FilePath));
  Matches := SubMatchesRegEx(Content, REGEX_PATTERN, False);
  if Length(Matches) > 0 then
    FileName := Matches[0];
end.

It can be easily modified to extract any other portion of HTML file by changing the REGEX_PATTERN constant.

Note: The code assumes that the HTML file uses UTF-8 encoding, hence, the use of UTF8Decode function.

Offline

#4 2015-07-13 17:20

UksusoFF
Member
Registered: 2015-07-13
Posts: 3

Re: More HTML tags?

Thanks, I will try it.

Offline

Board footer

Powered by FluxBB