Zum Inhalt springen

Modul:Unicodezeichen

aus Wikipedia, der freien Enzyklopädie
Dies ist eine alte Version dieser Seite, zuletzt bearbeitet am 11. März 2020 um 11:11 Uhr durch Karl432 (Diskussion | Beiträge). Sie kann sich erheblich von der aktuellen Version unterscheiden.

Die Dokumentation für dieses Modul kann unter Modul:Unicodezeichen/Doku erstellt werden

local Zeichen = {}

    function Zeichen.Dezimalcode(frame) -- liefert Dezimalcode gemäß DIN 5008 Anhang H
      local a = tonumber(frame.args[1],16)	  
      if not a then
        return 0
      end  

      local cc
      if     a >  0x2122 then return a -- Jenseits des maximalen Werts der in Win1252 enthaltenen Zeichen kann so die if-Kaskade übergangen werden
      elseif a == 0x20ac then cc = ' (0128)' -- 0x80 (Win1252 code)
      elseif a == 0x201a then cc = ' (0130)' -- 0x82
      elseif a == 0x0192 then cc = ' (0131)' -- 0x83
      elseif a == 0x201e then cc = ' (0132)' -- 0x84
      elseif a == 0x2026 then cc = ' (0133)' -- 0x85
      elseif a == 0x2020 then cc = ' (0134)' -- 0x86
      elseif a == 0x2021 then cc = ' (0135)' -- 0x87
      elseif a == 0x02c6 then cc = ' (0136)' -- 0x88
      elseif a == 0x2030 then cc = ' (0137)' -- 0x89
      elseif a == 0x0160 then cc = ' (0138)' -- 0x8a
      elseif a == 0x2039 then cc = ' (0139)' -- 0x8b
      elseif a == 0x0152 then cc = ' (0140)' -- 0x8c
      elseif a == 0x017d then cc = ' (0142)' -- 0x8e
      elseif a == 0x2018 then cc = ' (0145)' -- 0x91
      elseif a == 0x2019 then cc = ' (0146)' -- 0x92
      elseif a == 0x201c then cc = ' (0147)' -- 0x93
      elseif a == 0x201d then cc = ' (0148)' -- 0x94
      elseif a == 0x2022 then cc = ' (0149)' -- 0x95
      elseif a == 0x2013 then cc = ' (0150)' -- 0x96
      elseif a == 0x2014 then cc = ' (0151)' -- 0x97
      elseif a == 0x02dc then cc = ' (0152)' -- 0x98
      elseif a == 0x2122 then cc = ' (0153)' -- 0x99
      elseif a == 0x0161 then cc = ' (0154)' -- 0x9a
      elseif a == 0x203a then cc = ' (0155)' -- 0x9b
      elseif a == 0x0153 then cc = ' (0156)' -- 0x9c
      elseif a == 0x017e then cc = ' (0158)' -- 0x9e
      elseif a == 0x0178 then cc = ' (0159)' -- 0x9f
      else                    cc = ''
      end
      
      if a < 1000 then
      	return '0' .. a .. cc
      else
        return a .. cc
      end
    end

return Zeichen