Module:Hatnote inline

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search

Template:Replace

This module produces hatnote-style notes ≠ self-references and notes-to-reader – usually to related articles or a section/anchor at the same page. It does this inside a <span>...</span>, instead of the <div>...</div> used by Module:Hatnote. It implements the {{hatnote inline}} meta-template.

Usage

{{#invoke:Hatnote inline|hatnote|text}}

--------------------------------------------------------------------------------
--                              Module:Hatnote-inline                         --
--                                                                            --
-- This module produces hatnote-style links, and links to related articles,	  --
-- but inside a <span>, instead of the <div> used by Module:Hatnote.  It      --
-- implements the {{hatnote-inline}} meta-template.                           --
--------------------------------------------------------------------------------

local mHatnote = require('Module:Hatnote')
local mArguments = require('Module:Arguments')
local yesno = require('Module:Yesno')
local p = {}

function p.hatnoteInline (frame)
	local args = mArguments.getArgs(frame)
	local hatnote = mHatnote.hatnote(frame)
	if args.inline == nil or yesno(args.inline, true) then
		local subs = {
			['<div'] = '<span',
			['</div>$'] = '</span>'
		}
		for k, v in pairs(subs) do hatnote = string.gsub(hatnote, k, v, 1) end
	end
	return hatnote
end

p.hatnote = p.hatnoteInline --alias

return p
https://crocwiki.com/wiki/Module:Hatnote_inline
crocwiki.com
CC-MAIN-2024-26
37958
application/http; msgtype=response
sha1:3ACSPXC4X7MH2MQGLHIGXE2LQYFCTDPR
<urn:uuid:e63d2550-441d-49c0-b4ec-43c0c4fb13cb>
2024-06-23T23:28:01Z
38.46.223.206
text/html
sha1:TZL3I3YB47UAGEAWUSOWC5VZREU74GXN
<urn:uuid:32bda93b-fc7e-4b75-8bfa-b615cb592fdf>
https://crocwiki.com/wiki/Module:Hatnote_inline
response
<urn:uuid:a3d9ecd8-78e5-4315-9b4a-0c1931f89eaf>
isPartOf: CC-MAIN-2024-26
publisher: Common Crawl
description: Wide crawl of the web for June 2024
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-185
software: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/