Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request HTML Characters plugin #1250

Open
hg2581 opened this issue May 13, 2023 · 14 comments
Open

Feature request HTML Characters plugin #1250

hg2581 opened this issue May 13, 2023 · 14 comments

Comments

@hg2581
Copy link

hg2581 commented May 13, 2023

Would it be possible to add the reverse functionality of this plugin, ie translating HTML entities into UTF-8?

@Skif-off
Copy link
Contributor

Skif-off commented May 29, 2023

What about GeanyLua? And something like this

-- HTML-entity-to-symbol.lua (cross-platform)
-- 2023.06.01
--[[
EntitiesToUTF8(): see
  https://stackoverflow.com/questions/18694131/how-to-convert-utf8-byte-arrays-to-string-in-lua
]]

local aentities = {
["Á"] = "Á", ["á"] = "á", ["Ă"] = "Ă", ["ă"] = "ă", ["∾"] = "∾", ["∿"] = "∿", ["Â"] = "Â", ["â"] = "â", ["´"] = "´", ["Æ"] = "Æ",
["æ"] = "æ", ["À"] = "À", ["à"] = "à", ["ℵ"] = "ℵ", ["Α"] = "Α", ["α"] = "α", ["Ā"] = "Ā", ["ā"] = "ā", ["&"] = "&", ["∧"] = "∧",
["∠"] = "∠", ["∡"] = "∡", ["∟"] = "∟", ["⊾"] = "⊾", ["∢"] = "∢", ["Ą"] = "Ą", ["ą"] = "ą", ["≋"] = "≋", ["'"] = "'", ["≊"] = "≊",
["Å"] = "Å", ["å"] = "å", ["*"] = "*", ["≈"] = "≈", ["≍"] = "≍", ["Ã"] = "Ã", ["ã"] = "ã", ["Ä"] = "Ä", ["ä"] = "ä", ["∳"] = "∳",
["϶"] = "϶", ["⊽"] = "⊽", ["≌"] = "≌", ["„"] = "„", ["∵"] = "∵", ["ℬ"] = "ℬ", ["Β"] = "Β", ["β"] = "β", ["ℶ"] = "ℶ", ["≬"] = "≬",
["⋈"] = "⋈", ["‵"] = "‵", ["¦"] = "¦", ["⁏"] = "⁏", ["∽"] = "∽", ["⋍"] = "⋍", ["\"] = "\", ["•"] = "•", ["≎"] = "≎", ["≏"] = "≏",
["Ć"] = "Ć", ["ć"] = "ć", ["∩"] = "∩", ["⋒"] = "⋒", ["⁁"] = "⁁", ["Č"] = "Č", ["č"] = "č", ["Ç"] = "Ç", ["ç"] = "ç", ["Ĉ"] = "Ĉ",
["ĉ"] = "ĉ", ["∰"] = "∰", ["Ċ"] = "Ċ", ["ċ"] = "ċ", ["¸"] = "¸", ["¢"] = "¢", ["ℭ"] = "ℭ", ["✓"] = "✓", ["Χ"] = "Χ", ["χ"] = "χ",
["ˆ"] = "ˆ", ["≗"] = "≗", ["♣"] = "♣", [":"] = ":", ["∷"] = "∷", ["≔"] = "≔", [","] = ",", ["@"] = "@", ["∁"] = "∁", ["∘"] = "∘",
["≅"] = "≅", ["∮"] = "∮", ["∯"] = "∯", ["ℂ"] = "ℂ", ["∐"] = "∐", ["©"] = "©", ["℗"] = "℗", ["↵"] = "↵", ["✗"] = "✗", ["⋯"] = "⋯",
["⤸"] = "⤸", ["⤵"] = "⤵", ["⋞"] = "⋞", ["⋟"] = "⋟", ["↶"] = "↶", ["⤽"] = "⤽", ["∪"] = "∪", ["⋓"] = "⋓", ["⊍"] = "⊍", ["↷"] = "↷",
["⤼"] = "⤼", ["¤"] = "¤", ["&current;"] = "¤", ["⋎"] = "⋎", ["⋏"] = "⋏", ["∲"] = "∲", ["∱"] = "∱", ["†"] = "†", ["‡"] = "‡", ["ℸ"] = "ℸ",
["↓"] = "↓", ["↡"] = "↡", ["⇓"] = "⇓", ["⊣"] = "⊣", ["Ď"] = "Ď", ["ď"] = "ď", ["ⅅ"] = "ⅅ", ["ⅆ"] = "ⅆ", ["⇊"] = "⇊", ["⤑"] = "⤑",
["°"] = "°", ["Δ"] = "Δ", ["δ"] = "δ", ["⥿"] = "⥿", ["⥥"] = "⥥", ["⇃"] = "⇃", ["⇂"] = "⇂", ["⋄"] = "⋄", ["♦"] = "♦", ["⋲"] = "⋲",
["÷"] = "÷", ["⋇"] = "⋇", ["$"] = "$", ["⤓"] = "⤓", ["̑"] = "̑", ["⥐"] = "⥐", ["⥞"] = "⥞", ["⥖"] = "⥖", ["⥟"] = "⥟", ["⥗"] = "⥗",
["Đ"] = "Đ", ["đ"] = "đ", ["⋱"] = "⋱", ["⇵"] = "⇵", ["⥯"] = "⥯", ["⟿"] = "⟿", ["É"] = "É", ["é"] = "é", ["Ě"] = "Ě", ["ě"] = "ě",
["≖"] = "≖", ["Ê"] = "Ê", ["ê"] = "ê", ["≕"] = "≕", ["Ė"] = "Ė", ["ė"] = "ė", ["≑"] = "≑", ["ⅇ"] = "ⅇ", ["≒"] = "≒", ["È"] = "È",
["è"] = "è", ["ℓ"] = "ℓ", ["Ē"] = "Ē", ["ē"] = "ē", ["∅"] = "∅", [" "] = " ", ["Ŋ"] = "Ŋ", ["ŋ"] = "ŋ", [" "] = " ", ["Ę"] = "Ę",
["ę"] = "ę", ["⋕"] = "⋕", ["Ε"] = "Ε", ["ε"] = "ε", ["="] = "=", ["≟"] = "≟", ["≡"] = "≡", ["⥱"] = "⥱", ["≓"] = "≓", ["ℯ"] = "ℯ",
["ℰ"] = "ℰ", ["≐"] = "≐", ["≂"] = "≂", ["Η"] = "Η", ["η"] = "η", ["Ð"] = "Ð", ["ð"] = "ð", ["Ë"] = "Ë", ["ë"] = "ë", ["€"] = "€",
["!"] = "!", ["∃"] = "∃", ["♀"] = "♀", ["♭"] = "♭", ["ƒ"] = "ƒ", ["∀"] = "∀", ["⋔"] = "⋔", ["½"] = "½", ["⅓"] = "⅓", ["¼"] = "¼",
["⅕"] = "⅕", ["⅙"] = "⅙", ["⅛"] = "⅛", ["⅔"] = "⅔", ["⅖"] = "⅖", ["¾"] = "¾", ["⅗"] = "⅗", ["⅜"] = "⅜", ["⅘"] = "⅘", ["⅚"] = "⅚",
["⅝"] = "⅝", ["⅞"] = "⅞", ["⁄"] = "⁄", ["ℱ"] = "ℱ", ["Γ"] = "Γ", ["γ"] = "γ", ["Ϝ"] = "Ϝ", ["ϝ"] = "ϝ", ["Ğ"] = "Ğ", ["ğ"] = "ğ",
["Ģ"] = "Ģ", ["Ĝ"] = "Ĝ", ["ĝ"] = "ĝ", ["Ġ"] = "Ġ", ["ġ"] = "ġ", ["≥"] = "≥", ["≧"] = "≧", ["⋛"] = "⋛", ["⋙"] = "⋙", ["ℷ"] = "ℷ",
["≷"] = "≷", ["≩"] = "≩", ["⋧"] = "⋧", ["`"] = "`", ["ℊ"] = "ℊ", ["≳"] = "≳", [">"] = ">", ["≫"] = "≫", ["⋗"] = "⋗", ["⥸"] = "⥸",
["ℋ"] = "ℋ", ["↔"] = "↔", ["⇔"] = "⇔", ["⥈"] = "⥈", ["↭"] = "↭", ["^"] = "^", ["Ĥ"] = "Ĥ", ["ĥ"] = "ĥ", ["♥"] = "♥", ["…"] = "…",
["⊹"] = "⊹", ["ℌ"] = "ℌ", ["⇿"] = "⇿", ["∻"] = "∻", ["ℍ"] = "ℍ", ["―"] = "―", ["Ħ"] = "Ħ", ["ħ"] = "ħ", ["⁃"] = "⁃", ["‐"] = "‐",
["Í"] = "Í", ["í"] = "í", ["Î"] = "Î", ["î"] = "î", ["İ"] = "İ", ["¡"] = "¡", ["Ì"] = "Ì", ["ì"] = "ì", ["ⅈ"] = "ⅈ", ["∭"] = "∭",
["℩"] = "℩", ["IJ"] = "IJ", ["ij"] = "ij", ["Ī"] = "Ī", ["ī"] = "ī", ["ℑ"] = "ℑ", ["ı"] = "ı", ["⊷"] = "⊷", ["℅"] = "℅", ["∞"] = "∞",
["∫"] = "∫", ["∬"] = "∬", ["⊺"] = "⊺", ["Į"] = "Į", ["į"] = "į", ["Ι"] = "Ι", ["ι"] = "ι", ["¿"] = "¿", ["ℐ"] = "ℐ", ["∈"] = "∈",
["⋵"] = "⋵", ["⋹"] = "⋹", ["⋴"] = "⋴", ["⋳"] = "⋳", ["Ĩ"] = "Ĩ", ["ĩ"] = "ĩ", ["Ï"] = "Ï", ["ï"] = "ï", ["Ĵ"] = "Ĵ", ["ĵ"] = "ĵ",
["Κ"] = "Κ", ["κ"] = "κ", ["Ķ"] = "Ķ", ["ķ"] = "ķ", ["ĸ"] = "ĸ", ["⇚"] = "⇚", ["Ĺ"] = "Í", ["Ĺ"] = "Ĺ", ["ĺ"] = "ĺ", ["Λ"] = "Λ",
["λ"] = "λ", ["⟨"] = "〈", ["«"] = "«", ["←"] = "←", ["↞"] = "↞", ["⇐"] = "⇐", ["⇤"] = "⇤", ["⤟"] = "⤟", ["⤝"] = "⤝", ["↩"] = "↩",
["↫"] = "↫", ["⤹"] = "⤹", ["⥳"] = "⥳", ["↢"] = "↢", ["&larrw;"] = "↜", ["⤙"] = "⤙", ["⤛"] = "⤛", ["⤌"] = "⤌", ["⤎"] = "⤎", ["❲"] = "❲",
["{"] = "{", ["["] = "[", ["Ľ"] = "Ľ", ["ľ"] = "ľ", ["Ļ"] = "Ļ", ["ļ"] = "ļ", ["⌈"] = "⌈", ["&Lcirc;"] = "Î", ["{"] = "{", ["⤶"] = "⤶",
["“"] = "“", ["⥧"] = "⥧", ["⥋"] = "⥋", ["↲"] = "↲", ["≤"] = "≤", ["≦"] = "≦", ["⥡"] = "⥡", ["⥙"] = "⥙", ["⥎"] = "⥎", ["⥚"] = "⥚",
["⥑"] = "⥑", ["⥠"] = "⥠", ["⥘"] = "⥘", ["⥒"] = "⥒", ["⋚"] = "⋚", ["⥼"] = "⥼", ["⌊"] = "⌊", ["≶"] = "≶", ["&Lgrave;"] = "Ì", ["⥢"] = "⥢",
["↽"] = "↽", ["↼"] = "↼", ["⥪"] = "⥪", ["⋘"] = "⋘", ["⇇"] = "⇇", ["⥫"] = "⥫", ["Ŀ"] = "Ŀ", ["ŀ"] = "ŀ", ["≨"] = "≨", ["⋦"] = "⋦",
["⇽"] = "⇽", ["∗"] = "∗", ["_"] = "_", ["◊"] = "◊", ["("] = "(", ["⇆"] = "⇆", ["⇋"] = "⇋", ["⥭"] = "⥭", ["‎"] = "‎", ["⊿"] = "⊿",
["‹"] = "‹", ["ℒ"] = "ℒ", ["↰"] = "↰", ["≲"] = "≲", ["["] = "[", ["‘"] = "‘", ["Ł"] = "Ł", ["ł"] = "ł", ["<"] = "<", ["≪"] = "≪",
["⋖"] = "⋖", ["⋋"] = "⋋", ["⋉"] = "⋉", ["⥶"] = "⥶", ["⊴"] = "⊴", ["&Luml;"] = "Ï", ["⥊"] = "⥊", ["⥦"] = "⥦", ["¯"] = "¯", ["♂"] = "♂",
["✠"] = "✠", ["⤅"] = "⤅", ["↧"] = "↧", ["↤"] = "↤", ["&mapstoright;"] = "↦", ["↥"] = "↥", ["—"] = "—", ["∺"] = "∺", ["℧"] = "℧", ["µ"] = "µ",
["∣"] = "∣", ["·"] = "·", ["−"] = "-", ["−"] = "−", ["⊟"] = "⊟", ["∸"] = "∸", ["∓"] = "∓", ["⊧"] = "⊧", ["ℳ"] = "ℳ", ["Μ"] = "Μ",
["μ"] = "μ", ["⊸"] = "⊸", ["∇"] = "∇", ["Ń"] = "Ń", ["ń"] = "ń", ["≉"] = "≉", ["ʼn"] = "ʼn", ["♮"] = "♮", [" "] = " ", ["Ň"] = "Ň",
["ň"] = "ň", ["Ņ"] = "Ņ", ["ņ"] = "ņ", ["≇"] = "≇", ["–"] = "–", ["≠"] = "≠", ["⤤"] = "⤤", ["↗"] = "↗", ["⇗"] = "⇗", ["≢"] = "≢",
["⤨"] = "⤨", ["∄"] = "∄", ["≱"] = "≱", ["≵"] = "≵", ["≯"] = "≯", ["↮"] = "↮", ["⇎"] = "⇎", ["∋"] = "∋", ["∋"] = "∗", ["⋼"] = "⋼",
["⋺"] = "⋺", ["↚"] = "↚", ["⇍"] = "⇍", ["‥"] = "‥", ["≰"] = "≰", ["≴"] = "≴", ["≮"] = "≮", ["⋪"] = "⋪", ["⋬"] = "⋬", ["∤"] = "∤",
["ℕ"] = "ℕ", ["¬"] = "¬", ["≭"] = "≭", ["∉"] = "∉", ["⋷"] = "⋷", ["⋶"] = "⋶", ["∌"] = "∌", ["⋾"] = "⋾", ["⋽"] = "⋽", ["∦"] = "∦",
["⊀"] = "⊀", ["⋠"] = "⋠", ["↛"] = "↛", ["⇏"] = "⇏", ["⋫"] = "⋫", ["⋭"] = "⋭", ["⊁"] = "⊁", ["⋡"] = "⋡", ["≁"] = "≁", ["≄"] = "≄",
["⋢"] = "⋢", ["⋣"] = "⋣", ["⊄"] = "⊄", ["⊈"] = "⊈", ["⊅"] = "⊅", ["⊉"] = "⊉", ["≹"] = "≹", ["Ñ"] = "Ñ", ["ñ"] = "ñ", ["≸"] = "≸",
["Ν"] = "Ν", ["ν"] = "ν", ["#"] = "#", ["№"] = "№", ["⊬"] = "⊬", ["⊭"] = "⊭", ["⊮"] = "⊮", ["⊯"] = "⊯", ["⤄"] = "⤄", ["⤂"] = "⤂",
["⤃"] = "⤃", ["⤣"] = "⤣", ["↖"] = "↖", ["⇖"] = "⇖", ["⤧"] = "⤧", ["Ó"] = "Ó", ["ó"] = "ó", ["⊛"] = "⊛", ["⊚"] = "⊚", ["Ô"] = "Ô",
["ô"] = "ô", ["⊝"] = "⊝", ["Ő"] = "Ő", ["ő"] = "ő", ["⊙"] = "⊙", ["Œ"] = "Œ", ["œ"] = "œ", ["Ò"] = "Ò", ["ò"] = "ò", ["↺"] = "↺",
["‾"] = "‾", ["Ō"] = "Ō", ["ō"] = "ō", ["Ω"] = "Ω", ["ω"] = "ω", ["Ο"] = "Ο", ["ο"] = "ο", ["⊖"] = "⊖", ["⊕"] = "⊕", ["∨"] = "∨",
["↻"] = "↻", ["ª"] = "ª", ["º"] = "º", ["⊶"] = "⊶", ["ℴ"] = "ℴ", ["Ø"] = "Ø", ["ø"] = "ø", ["⊘"] = "⊘", ["Õ"] = "Õ", ["õ"] = "õ",
["⊗"] = "⊗", ["Ö"] = "Ö", ["ö"] = "ö", ["¶"] = "¶", ["∥"] = "∥", ["∂"] = "∂", ["%"] = "%", ["."] = ".", ["‰"] = "‰", ["‰"] = "‰",
["⊥"] = "⊥", ["‱"] = "‱", ["Φ"] = "Φ", ["φ"] = "φ", ["☎"] = "☎", ["Π"] = "Π", ["π"] = "π", ["ϖ"] = "ϖ", ["ℏ"] = "ℏ", ["ℎ"] = "ℎ",
["+"] = "+", ["⊞"] = "⊞", ["∔"] = "∔", ["±"] = "±", ["ℙ"] = "ℙ", ["£"] = "£", ["≺"] = "≺", ["≼"] = "≼", ["′"] = "′", ["″"] = "″",
["⋨"] = "⋨", ["∏"] = "∏", ["∝"] = "∝", ["≾"] = "≾", ["⊰"] = "⊰", ["Ψ"] = "Ψ", ["ψ"] = "ψ", ["ℚ"] = "ℚ", ["⁗"] = "⁗", ["?"] = "?",
["""] = """, ["⇛"] = "⇛", ["Ŕ"] = "Ŕ", ["ŕ"] = "ŕ", ["√"] = "√", ["⟩"] = "〉", ["»"] = "»", ["→"] = "→", ["↠"] = "↠", ["⇒"] = "⇒",
["⥵"] = "⥵", ["⇥"] = "⇥", ["⤠"] = "⤠", ["⤳"] = "⤳", ["⤞"] = "⤞", ["↪"] = "↪", ["↬"] = "↬", ["⥅"] = "⥅", ["⥴"] = "⥴", ["⤖"] = "⤖",
["↣"] = "↣", ["↝"] = "↝", ["⤚"] = "⤚", ["⤜"] = "⤜", ["∶"] = "∶", ["⤍"] = "⤍", ["⤏"] = "⤏", ["⤐"] = "⤐", ["❳"] = "❳", ["}"] = "}",
["]"] = "]", ["Ř"] = "Ř", ["ř"] = "ř", ["Ŗ"] = "Ŗ", ["ŗ"] = "ŗ", ["⌉"] = "⌉", ["}"] = "}", ["⤷"] = "⤷", ["⥩"] = "⥩", ["”"] = "”",
["↳"] = "↳", ["ℜ"] = "ℜ", ["®"] = "®", ["⥽"] = "⥽", ["⌋"] = "⌋", ["⥤"] = "⥤", ["⇁"] = "⇁", ["⇀"] = "⇀", ["⥬"] = "⥬", ["Ρ"] = "Ρ",
["ρ"] = "ρ", ["⥝"] = "⥝", ["⥕"] = "⥕", ["⥛"] = "⥛", ["⥏"] = "⥏", ["⥜"] = "⥜", ["⥔"] = "⥔", ["⥓"] = "⥓", ["⇄"] = "⇄", ["⇌"] = "⇌",
["‏"] = "‏", ["⇾"] = "⇾", ["ℝ"] = "ℝ", ["⥰"] = "⥰", [")"] = ")", ["⇉"] = "⇉", ["›"] = "›", ["ℛ"] = "ℛ", ["↱"] = "↱", ["]"] = "]",
["’"] = "’", ["⋌"] = "⋌", ["⋊"] = "⋊", ["⊵"] = "⊵", ["⥨"] = "⥨", ["℞"] = "℞", ["Ś"] = "Ś", ["ś"] = "ś", ["‚"] = "‚", ["≻"] = "≻",
["Š"] = "Š", ["š"] = "š", ["≽"] = "≽", ["Ş"] = "Ş", ["ş"] = "ş", ["Ŝ"] = "Ŝ", ["ŝ"] = "ŝ", ["⋩"] = "⋩", ["≿"] = "≿", ["⋅"] = "⋅",
["⊡"] = "⊡", ["⤥"] = "⤥", ["↘"] = "↘", ["⇘"] = "⇘", ["§"] = "§", [";"] = "&#59;", ["⤩"] = "⤩", ["∖"] = "∖", ["✶"] = "✶", ["♯"] = "♯",
["­"] = "­", ["Σ"] = "Σ", ["σ"] = "σ", ["ς"] = "ς", ["∼"] = "∼", ["≃"] = "≃", ["≆"] = "≆", ["⥲"] = "⥲", ["/"] = "/", ["♠"] = "♠",
["⊓"] = "⊓", ["⊔"] = "⊔", ["⊏"] = "⊏", ["⊑"] = "⊑", ["⊐"] = "⊐", ["⊒"] = "⊒", ["⋆"] = "⋆", ["☆"] = "☆", ["★"] = "★", ["ϵ"] = "ϵ",
["ϕ"] = "ϕ", ["⊂"] = "⊂", ["⋐"] = "⋐", ["⊆"] = "⊆", ["⊊"] = "⊊", ["⥹"] = "⥹", ["∑"] = "∑", ["♪"] = "♪", ["¹"] = "¹", ["²"] = "²",
["³"] = "³", ["⊃"] = "⊃", ["⋑"] = "⋑", ["⊇"] = "⊇", ["⥻"] = "⥻", ["⊋"] = "⊋", ["⤦"] = "⤦", ["↙"] = "↙", ["⇙"] = "⇙", ["⤪"] = "⤪",
["ß"] = "ß", ["Τ"] = "Τ", ["τ"] = "τ", ["Ť"] = "Ť", ["ť"] = "ť", ["Ţ"] = "Ţ", ["ţ"] = "ţ", ["∴"] = "∴", ["Θ"] = "Θ", ["θ"] = "θ",
["ϑ"] = "ϑ", [" "] = " ", ["Þ"] = "Þ", ["þ"] = "þ", ["˜"] = "~", ["×"] = "×", ["⊠"] = "⊠", ["⊤"] = "⊤", ["‴"] = "‴", ["™"] = "™",
["≜"] = "≜", ["Ŧ"] = "Ŧ", ["ŧ"] = "ŧ", ["Ú"] = "Ú", ["ú"] = "ú", ["↑"] = "↑", ["↟"] = "↟", ["⇑"] = "⇑", ["⥉"] = "⥉", ["Ŭ"] = "Ŭ",
["ŭ"] = "ŭ", ["Û"] = "Û", ["û"] = "û", ["⇅"] = "⇅", ["Ű"] = "Ű", ["ű"] = "ű", ["⥮"] = "⥮", ["⥾"] = "⥾", ["Ù"] = "Ù", ["ù"] = "ù",
["⥣"] = "⥣", ["↿"] = "↿", ["↾"] = "↾", ["Ū"] = "Ū", ["ū"] = "ū", ["¨"] = "¨", ["Ų"] = "Ų", ["ų"] = "ų", ["⤒"] = "⤒", ["⊎"] = "⊎",
["ϒ"] = "ϒ", ["Υ"] = "Υ", ["υ"] = "υ", ["Ů"] = "Ů", ["ů"] = "ů", ["⋰"] = "⋰", ["Ũ"] = "Ũ", ["ũ"] = "ũ", ["⇈"] = "⇈", ["Ü"] = "Ü",
["ü"] = "ü", ["ϰ"] = "ϰ", ["↕"] = "↕", ["⇕"] = "⇕", ["ϱ"] = "ϱ", ["⊢"] = "⊢", ["⊨"] = "⊨", ["⊩"] = "⊩", ["⊫"] = "⊫", ["⊻"] = "⊻",
["≚"] = "≚", ["⋮"] = "⋮", ["|"] = "|", ["|"] = "|", ["‖"] = "‖", ["❘"] = "❘", ["⊲"] = "⊲", ["⊳"] = "⊳", ["⊪"] = "⊪", ["Ŵ"] = "Ŵ",
["ŵ"] = "ŵ", ["≙"] = "≙", ["℘"] = "℘", ["≀"] = "≀", ["⋂"] = "⋂", ["⋃"] = "⋃", ["⟷"] = "⟷", ["⟺"] = "⟺", ["Ξ"] = "Ξ", ["ξ"] = "ξ",
["⟵"] = "⟵", ["⟸"] = "⟸", ["⟼"] = "⟼", ["⋻"] = "⋻", ["⟶"] = "⟶", ["⟹"] = "⟹", ["⋁"] = "⋁", ["⋀"] = "⋀", ["Ý"] = "Ý", ["ý"] = "ý",
["Ŷ"] = "Ŷ", ["ŷ"] = "ŷ", ["¥"] = "¥", ["ÿ"] = "ÿ", ["Ÿ"] = "Ÿ", ["Ź"] = "Ź", ["ź"] = "ź", ["Ž"] = "Ž", ["ž"] = "ž", ["Ż"] = "Ż",
["ż"] = "ż", ["Ζ"] = "Ζ", ["ζ"] = "ζ", ["ℨ"] = "ℨ", ["&ziglarr;"] = "⇜", ["⇝"] = "⇝", ["ℤ"] = "ℤ", ["‍"] = "‍", ["‌"] = "‌"
}

local function EntitiesToUTF8(dec)
  -- https://stackoverflow.com/questions/18694131/how-to-convert-utf8-byte-arrays-to-string-in-lua
  local bytemarkers = {{0x7FF, 192}, {0xFFFF, 224}, {0x1FFFFF, 240}}
  if dec < 128 then return string.char(dec) end
  local cbs = {}
  for bytes, vals in ipairs(bytemarkers) do
    if dec <= vals[1] then
      for b = bytes + 1, 2, -1 do
        local mod = dec % 64
        dec = (dec - mod) / 64
        cbs[b] = string.char(128 + mod)
      end
      cbs[1] = string.char(vals[2] + dec)
      break
    end
  end
  return table.concat(cbs)
end

local sres, ssel, stmp

ssel = geany.selection()
if (ssel == nil) or (ssel == "") then
  geany.message("HTML entity to symbol", "Nothing is selected!")
  return
else
  if (string.sub(ssel, 1, 1) ~= "&") and (string.sub(ssel, -1, -1) ~= ";") then
    geany.message("HTML entity to symbol", "Selected text does not look like a HTML entity.")
    return
  end
end

if ssel == "&NewLine;" then
  geany.selection("\n")
  return
end

stmp = aentities[ssel]
if stmp == nil then stmp = ssel end
if string.sub(stmp, 1, 3) == "&#x" then
  sres = EntitiesToUTF8(tonumber(string.sub(stmp, 4, -2), 16))
else
  if string.sub(stmp, 1, 2) == "&#" then
    sres = EntitiesToUTF8(tonumber(string.sub(stmp, 3, -2), 10))
  else
    return
  end
end
if sres ~= ssel then geany.selection(sres) end

Documentation: see here, here /usr/share/doc/geany-plugin-lua or here C:\Program Files\Geany\share\doc\geany-plugins\geanylua.

@hg2581
Copy link
Author

hg2581 commented May 30, 2023 via email

@elextr
Copy link
Member

elextr commented May 30, 2023

To ask the obvious question, did you enable the geanylua plugin?

@hg2581
Copy link
Author

hg2581 commented May 30, 2023 via email

@elextr
Copy link
Member

elextr commented May 30, 2023

Is it available for my version?

Depends on your distro, the Geany project does not make distro packages. The distros decide what version of Lua it has available, and if all the other dependencies are available on that distro to build plugins.

@hg2581
Copy link
Author

hg2581 commented May 30, 2023 via email

@elextr
Copy link
Member

elextr commented May 30, 2023

The output did not give the reason why some failed.

Autotools is such a helpful build tool. [end obligatory autotools hate]

Anyway look at the output of configure, any plugin that didn't configure (no in the summary at the end) probably does not have the development files for the dependency installed. (Many distros separate the runtime packages and the development packages needed to build software using that package, don't know about centos).

The dependency checks for Geanylua are here. I don't read m4 (who does?) but it looks like Lua5.1 and gmodule are all that are checked.

@elextr
Copy link
Member

elextr commented May 30, 2023

BTW you don't need to build all the plugins, --disable-all-plugins --enable-geanylua on configure should only do Geanylua and will fail if dependencies are not met.

@hg2581
Copy link
Author

hg2581 commented May 30, 2023 via email

@elextr
Copy link
Member

elextr commented May 31, 2023

The centos Lua package does not include the files included by Geanylua. As I said above you need the development package https://centos.pkgs.org/7/centos-x86_64/lua-devel-5.1.4-15.el7.x86_64.rpm.html which has those files.

[Edit: That also probably also applies to GTK Glib Gio etc.]

@Skif-off
Copy link
Contributor

@hg2581, how did you install Geany? Just sudo yum install geany? In this case try to run:

sudo yum update
sudo yum install geany-plugins-geanylua

P.S. Finding packages for Fedora or CentOS is... hm... some kind of magic and a bad erotic dream.

@elextr
Copy link
Member

elextr commented May 31, 2023

Finding packages for Fedora or CentOS is... hm... some kind of magic and a bad erotic dream.

Astonishingly google worked for me 😕 to find the links above.

@Skif-off
Copy link
Contributor

Skif-off commented Jun 1, 2023

Sorry, to generate the final aentities table from the list of entities, I wrote a script, but made a ridiculous mistake in it.
The script in my comment has been updated.

@elextr the package search for Debian or Arch Linux is more friendly and each page contains all the necessary information and links. I do not insist, but I have always been annoyed by the search for packages for daughter RHEL distributions :)

@elextr
Copy link
Member

elextr commented Jun 1, 2023

the package search for Debian or Arch Linux is more friendly and each page contains all the necessary information and links. I do not insist, but I have always been annoyed by the search for packages for daughter RHEL distributions :)

I totally agree, thats why the confused emoji when google worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@elextr @Skif-off @hg2581 and others