Technopedia Center
PMB University Brochure
Faculty of Engineering and Computer Science
S1 Informatics S1 Information Systems S1 Information Technology S1 Computer Engineering S1 Electrical Engineering S1 Civil Engineering

faculty of Economics and Business
S1 Management S1 Accountancy

Faculty of Letters and Educational Sciences
S1 English literature S1 English language education S1 Mathematics education S1 Sports Education
  • Registerasi
  • Brosur UTI
  • Kip Scholarship Information
  • Performance
  1. Weltenzyklopädie
  2. Module:API — Wikipédia
Module:API — Wikipédia 👆 Click Here! Read More..
Cette page fait l’objet d’une mesure de semi-protection étendue.
Une page de Wikipédia, l'encyclopédie libre.

 Documentation[voir] [modifier] [historique] [purger]

Ce module regroupe des fonctions liés à l'alphabet phonétique international.

Utilisation

Fonctions exportables :

  • mapi( frame ) – retourne un la liste des symbole API fourni en paramètres, avec lien vers la page correspondant à chaque symbole et si possible un exemple en infobulle.
  • msapi() – retourne entre crochet la fonction mapi.

Autres fonctions :

  • symbolWithExemple( symbol ) – retourne le symbole API avec si possible un exemple en infobulle (span avec title)
  • symbolWithLink( symbol ) – retourne le symbole API avec lien vers la page correspondant au symbole et si possible un exemple en infobulle (span avec title)
  • separateSymbols( args ) – si args n'a qu'un seul paramètre, sépare les symboles API en autant de paramètre.

Modules externes et autres éléments dont ce module a besoin pour fonctionner :

  • Module:API/Infobulle – liste des exemples en infobulle.
  • Module:Outils – fonctions extractArgs et trim.

Modèles appelant directement ce module :

  • {{MSAPI}}
  • {{MAPI}}

Exemples

  • {{#invoke:API|mapi|m|ɛ|ʁ|s|i| |b|i|ɛ̃}} → mɛʁsi biɛ̃
  • {{#invoke:API|mapi|mɛʁsi biɛ̃}} → mɛʁsi biɛ̃
  • {{#invoke:API|msapi|m|ɛ|ʁ|s|i| |b|i|ɛ̃}} → [mɛʁsi biɛ̃]
  • {{#invoke:API|msapi|mɛʁsi biɛ̃}} → [mɛʁsi biɛ̃]
    • Projet Scribunto Projet Scribunto

La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis sa sous-page de documentation. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (modifier).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.

local IPA = { }

local Outils = require ( 'Module:Outils' )

local success, toolTip = pcall ( mw.loadData, 'Module:API/Infobulle' )

-- error if data not loaded
local messageFormat = [[<strong class="error">Le chargement du module API/Infobulle génère une erreur : </strong><br> %s<br> 
<span class="error">Cette erreur doit être corrigée pour que les infobulles explicatives soient de nouveau affichées.</span>
]]
local errorMessage
if not success then
	errorMessage = string.format( messageFormat, toolTip )
	toolTip = { }
end

local ipaClass = ' class="API nowrap"'
local ipaTitle = ' title="Alphabet phonétique international"'

local ipaStyle = ' style="font-family:'
	.. "'Segoe UI',"                  -- Widonws Vista, 7, 8
	.. "'DejaVu Sans',"               -- Most linux, OpenOffice, LibreOffice
	.. "'Lucida Grande',"             -- MacOsX
	.. "'Lucida Sans Unicode',"       -- Windows XP (but lack U+203F & U+035C)
	.. "'Arial Unicode MS',"          -- MS Office (provides U+203F & U+035C to Windows XP users)
	.. "'Hiragino Kaku Gothic Pro',"  -- ios 3+
	.. "sans-serif"                   -- default, Android.
	.. ';"'

local function symbolWithExemple( symbol )
	if type( symbol ) == 'string' then
		local title = toolTip[ Outils.trim( symbol ) ]
		if title then 
			return '<span title="' .. title ..'">' .. symbol .. '</span>'
		else
			return symbol
		end
	end
end

local function symbolWithLink( symbol )
	if symbol == '[' or symbol == ']' then
		return mw.text.nowiki( symbol )
	elseif symbol ~= '/' and Outils.trim( symbol ) then
		return '[[API ' .. symbol .. '|'.. symbolWithExemple( symbol ) .. ']]'
	else 
		return symbol
	end
end

local function separateSymbols( args )
	local len1 = args[1] and mw.ustring.len( args[1] )
	if args[2] == nil and len1 and len1 > 1 then
		local api = args[1]
		local apiCodes = { mw.ustring.codepoint( args[1], 1, len1 ) }
		local result = { }
		local i = 1
		while apiCodes[i] do
			local tmplen = 0
			if apiCodes[i + 2] and  apiCodes[i + 1] > 859 and apiCodes[i + 1] < 867 then -- tie
				tmplen = 2
			end
			if apiCodes[i + tmplen + 1] and apiCodes[i + tmplen + 1] > 767 and apiCodes[i + tmplen + 1] < 860 then -- Diacritical
				tmplen = tmplen + 1
			end
			table.insert( result, mw.ustring.sub( api, i, i + tmplen ) )
			i = i + tmplen + 1
		end
		return result
	end
	return args
end

local function symbolsWithLink( args )
	local wikiTable = {
		'<span' .. ipaClass .. ipaTitle ..  ipaStyle .. '>' 
	}
	local symbolsTable = separateSymbols( args )
	 
	local i = 1
	local symbol
	while symbolsTable[i] do
		symbol = symbolWithLink( symbolsTable[i] )
		if symbol then 
			table.insert( wikiTable, symbol )
		end
		i = i + 1
	end
	table.insert( wikiTable, '</span>' )
	
	return wikiTable
end

function IPA.mapi( frame )
	local args = Outils.extractArgs( frame )
	local wikiTable = symbolsWithLink( args )
	return table.concat( wikiTable )
end

function IPA.msapi ( frame )
	local args = Outils.extractArgs( frame )
	local wikiTable = symbolsWithLink( args )
	
	if mw.ustring.match(wikiTable[2], '[ʃɲjʄɟ]' ) then
		table.insert( wikiTable, 2, '&#8198;' )          -- &#8198; =  	Six-Per-Em Space, otherwise ʃ touches [ on windows.
	end
	if mw.ustring.match(wikiTable[#wikiTable - 1], '[ʃʈɭʄɖɻʠʧ]' ) then
		table.insert( wikiTable, #wikiTable, '&#8198;' )
	end
	 
	if not ( wikiTable[2] == '&#91;' or wikiTable[2] == '/' ) then
		table.insert( wikiTable, 2, '&#91;' )          -- &#91; = <nowiki>[</nowiki> 
		table.insert( wikiTable, #wikiTable, '&#93;' ) -- &#93; = <nowiki>]</nowiki> 
	end
	return table.concat( wikiTable )
end

function IPA.api()
end

-- erreurModuleData affiche  d'un message d'erreur si le Module:Langue/Data n'a pas été chargé correctement,
-- pour la page de discussion de la base de donnée et ceux qui veulent surveiller cette page.
function IPA.toolTipModuleError()
    if success == false then 
        return errorMessage
    end
end

return IPA
Ce document provient de « https://fr.teknopedia.teknokrat.ac.id/w/index.php?title=Module:API&oldid=167434263 ».
Catégorie :
  • Module appelé directement par un modèle
Catégorie cachée :
  • Module en semi-protection étendue

  • indonesia
  • Polski
  • الرية
  • Deutsch
  • English
  • Español
  • Français
  • Italiano
  • مصر
  • Nederlands
  • 本語
  • Português
  • Sinugboanong Binisaya
  • Svenska
  • Українска
  • Tiếng Việt
  • Winaray
  • 中文
  • Русски
Sunting pranala
Pusat Layanan

UNIVERSITAS TEKNOKRAT INDONESIA | ASEAN's Best Private University
Jl. ZA. Pagar Alam No.9 -11, Labuhan Ratu, Kec. Kedaton, Kota Bandar Lampung, Lampung 35132
Phone: (0721) 702022
Email: pmb@teknokrat.ac.id