File

mod_ogp/test.lua @ 6111:ffd0184cd478

mod_compliance_latest: New module that depends on and therefore loads the latest compliance tester mod. diff --git a/mod_compliance_latest/README.md b/mod_compliance_latest/README.md new file mode 100644 --- /dev/null +++ b/mod_compliance_latest/README.md @@ -0,0 +1,25 @@ +--- +summary: XMPP Compliance Suites self-test +labels: +- Stage-Beta +rockspec: + dependencies: + - mod_compliance_2023 +... + +# Introduction + +This module will always require and load to the lastest compliance tester we have in the community modules. +Currently this is [mod_compliance_2023]. + +# Configuration + +Just load this module as any other module and it will automatically install [mod_compliance_2023] if you use the Prosody plugin installer. +See the linked module for further details. + +# Compatibility + + Prosody-Version Status + --------------- ---------------------- + trunk Works as of 2024-12-22 + 0.12 Works diff --git a/mod_compliance_latest/mod_compliance_latest.lua b/mod_compliance_latest/mod_compliance_latest.lua new file mode 100644 --- /dev/null +++ b/mod_compliance_latest/mod_compliance_latest.lua @@ -0,0 +1,1 @@ +module:depends("compliance_2023");
author Menel <menel@snikket.de>
date Sun, 22 Dec 2024 18:12:42 +0100
parent 4255:38da10e4b593
line wrap: on
line source

local html = [[
<meta property="og:title" content="Example 1 A">
<meta property=og:title content="Example 2 B">
<meta property="og:title" content="Example 3 C" >
<meta property="og:title" content="Example 4 D" />
<meta property="og:title" content="Example 5 E"/>
<meta property=og:title content=Example 6 F/>
<meta property="og:title" content= "Example 7 G" />
<meta property="og:title" itemprop="image primaryImageOfPage" content="Example 8 H" />
<meta property='og:title' content='Example 9 I' />
<meta content="Example 10 J" property="og:title" >
<meta content="Example 11 K" property="og:title">
<meta content="Example 12 L" property="og:title"/>
<meta content="Example 13 M" property="og:title" />
<meta content="Example 14 N" property=og:title >
<meta content=Example 15 O property=og:title >
<meta content= "Example 16 P" property="og:title" />
<meta content="Example 17 Q" itemprop="image primaryImageOfPage"  property="og:title" />
<meta content= 'Example 18 R' property='og:title' />
]]



local meta_pattern = [[<meta (.-)/?>]]
for match in html:gmatch(meta_pattern) do
    local property = match:match([[property=%s*["']?(og:.-)["']?%s]])
    if not property then
        property = match:match([[property=["']?(og:.-)["']$]])
    end

    local content = match:match([[content=%s*["'](.-)["']%s]])
    if not content then
        content = match:match([[content=["']?(.-)["']$]])
    end
    if not content then
        content = match:match([[content=(.-) property]])
    end
    if not content then
        content = match:match([[content=(.-)$]])
    end

    print(property, '\t', content, '\t', match .. "|")
end