Advertisement
AZJIO

Untitled

Jul 27th, 2022
2,305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 13.20 KB | None | 0 0
  1. ; Здесь вынесены регулярные выражения обработки файлов справки
  2.  
  3. Func _AutoIt3_functions_Code(ByRef $sExampleData)
  4.  
  5.     ; функции UDF
  6.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S15">([\w]+?)</span>', '<a class="le" href="UDFs3.chm::/html/libfunctions/\1.htm"><span class="S15">\1</span></a>')
  7.  
  8.     ; функции
  9.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S4">([\w]+?)</span>', '<a class="le" href="\1.htm"><span class="S4">\1</span></a>')
  10.     $sExampleData=StringReplace($sExampleData, 'href="Opt.htm">', 'href="AutoItSetOption.htm">')
  11.    
  12.     ; исключение для UDPStartup, UDPShutdown
  13.     $sExampleData=StringReplace($sExampleData, '<a class="le" href="UDPStartup.htm"><span class="S4">UDPStartup</span></a>', '<a class="le" href="TCPStartup.htm"><span class="S4">UDPStartup</span></a>')
  14.     $sExampleData=StringReplace($sExampleData, '<a class="le" href="UDPShutdown.htm"><span class="S4">UDPShutdown</span></a>', '<a class="le" href="TCPShutdown.htm"><span class="S4">UDPShutdown</span></a>')
  15.  
  16.     ; макросы
  17.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S6">(@[^<]+)</span>', '<a class="le" href="../macros.htm#\1"><span class="S6">\1</span></a>')
  18.    
  19.     ; операторы
  20.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S8">((?:[+^*/=&-]|&gt;|&lt;)+)</span>', '<a class="le" href="../intro/lang_operators.htm"><span class="S8">\1</span></a>')
  21.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Not|And|Or)</span>', '<a class="le" href="../intro/lang_operators.htm"><span class="S5">\1</span></a>')
  22.     ; замена ключевые слова
  23.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(ContinueCase|ContinueLoop|Default|Dim|Do|Enum|Exit|ExitLoop|For|Func|If|ReDim|Select|Static|Switch|While|With)</span>', '<a class="le" href="../keywords/\1.htm"><span class="S5">\1</span></a>')
  24.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Else|Then|ElseIf|EndIf)</span>', '<a class="le" href="../keywords/IfElseEndIf.htm"><span class="S5">\1</span></a>')
  25.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Next|To|Step)</span>', '<a class="le" href="../keywords/For.htm"><span class="S5">\1</span></a>')
  26.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Case|EndSwitch)</span>', '<a class="le" href="../keywords/Switch.htm"><span class="S5">\1</span></a>')
  27.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Global|Local|Const)</span>', '<a class="le" href="../keywords/Dim.htm"><span class="S5">\1</span></a>')
  28.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(EndFunc|ByRef|Return)</span>', '<a class="le" href="../keywords/Func.htm"><span class="S5">\1</span></a>')
  29.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(True|False)</span>', '<a class="le" href="../keywords/Booleans.htm"><span class="S5">\1</span></a>')
  30.     $sExampleData=StringReplace($sExampleData, '<span class="S5">Until</span>', '<a class="le" href="../keywords/Do.htm"><span class="S5">Until</span></a>')
  31.     $sExampleData=StringReplace($sExampleData, '<span class="S5">WEnd</span>', '<a class="le" href="../keywords/While.htm"><span class="S5">WEnd</span></a>')
  32.     $sExampleData=StringReplace($sExampleData, '<span class="S5">EndSelect</span>', '<a class="le" href="../keywords/Select.htm"><span class="S5">EndSelect</span></a>')
  33.     $sExampleData=StringReplace($sExampleData, '<span class="S5">In</span>', '<a class="le" href="../keywords/ForInNext.htm"><span class="S5">In</span></a>')
  34.     $sExampleData=StringReplace($sExampleData, '<span class="S5">EndWith</span>', '<a class="le" href="../keywords/With.htm"><span class="S5">EndWith</span></a>')
  35.    
  36.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#OnAutoItStartRegister</span>', '<a class="le" href="../keywords/OnAutoItStartRegister.htm"><span class="S11">#OnAutoItStartRegister</span></a>')
  37.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#include</span>', '<a class="le" href="../keywords/include.htm"><span class="S11">#include</span></a>')
  38.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#include-once</span>', '<a class="le" href="../keywords/include-once.htm"><span class="S11">#include-once</span></a>')
  39.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#RequireAdmin</span>', '<a class="le" href="../keywords/RequireAdmin.htm"><span class="S11">#RequireAdmin</span></a>')
  40.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#NoTrayIcon</span>', '<a class="le" href="../keywords/NoTrayIcon.htm"><span class="S11">#NoTrayIcon</span></a>')
  41. EndFunc
  42.  
  43. Func _UDF_libfunctions_Code(ByRef $sExampleData)
  44.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S15">([\w]+?)</span>', '<a class="le" href="\1.htm"><span class="S15">\1</span></a>') ; функции UDF
  45.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S9">(\$tag\w+?)</span>', '<a class="le" href="\1.htm"><span class="S9">\1</span></a>') ; структуры $tag... в примерах
  46.    
  47.     ; ссылки на файл AutoIt3.chm
  48.  
  49.     ; функции
  50.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S4">([\w]+?)</span>', '<a class="le" href="AutoIt3.chm::/html/functions/\1.htm"><span class="S4">\1</span></a>')
  51.  
  52.     ; макросы
  53.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S6">(@[^<]+)</span>', '<a class="le" href="AutoIt3.chm::/html/macros.htm#\1"><span class="S6">\1</span></a>')
  54.  
  55.     ; операторы
  56.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S8">((?:[+^*/=&-]|&gt;|&lt;)+)</span>', '<a class="le" href="AutoIt3.chm::/html/intro/lang_operators.htm"><span class="S8">\1</span></a>')
  57.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Not|And|Or)</span>', '<a class="le" href="AutoIt3.chm::/html/intro/lang_operators.htm"><span class="S5">\1</span></a>')
  58.     ; замена ключевые слова
  59.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(ContinueCase|ContinueLoop|Default|Dim|Do|Enum|Exit|ExitLoop|For|Func|If|ReDim|Select|Static|Switch|While|With)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/\1.htm"><span class="S5">\1</span></a>')
  60.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Else|Then|ElseIf|EndIf)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/IfElseEndIf.htm"><span class="S5">\1</span></a>')
  61.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Next|To|Step)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/For.htm"><span class="S5">\1</span></a>')
  62.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Case|EndSwitch)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/Switch.htm"><span class="S5">\1</span></a>')
  63.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Global|Local|Const)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/Dim.htm"><span class="S5">\1</span></a>')
  64.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(EndFunc|ByRef|Return)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/Func.htm"><span class="S5">\1</span></a>')
  65.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(True|False)</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/Booleans.htm"><span class="S5">\1</span></a>')
  66.     $sExampleData=StringReplace($sExampleData, '<span class="S5">Until</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/Do.htm"><span class="S5">Until</span></a>')
  67.     $sExampleData=StringReplace($sExampleData, '<span class="S5">WEnd</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/While.htm"><span class="S5">WEnd</span></a>')
  68.     $sExampleData=StringReplace($sExampleData, '<span class="S5">EndSelect</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/Select.htm"><span class="S5">EndSelect</span></a>')
  69.     $sExampleData=StringReplace($sExampleData, '<span class="S5">In</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/ForInNext.htm"><span class="S5">In</span></a>')
  70.     $sExampleData=StringReplace($sExampleData, '<span class="S5">EndWith</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/With.htm"><span class="S5">EndWith</span></a>')
  71.    
  72.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#OnAutoItStartRegister</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/OnAutoItStartRegister.htm"><span class="S11">#OnAutoItStartRegister</span></a>')
  73.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#include</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/include.htm"><span class="S11">#include</span></a>')
  74.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#include-once</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/include-once.htm"><span class="S11">#include-once</span></a>')
  75.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#RequireAdmin</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/RequireAdmin.htm"><span class="S11">#RequireAdmin</span></a>')
  76.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#NoTrayIcon</span>', '<a class="le" href="AutoIt3.chm::/html/keywords/NoTrayIcon.htm"><span class="S11">#NoTrayIcon</span></a>')
  77. EndFunc
  78.  
  79. Func _AutoIt3_keywords_Code(ByRef $sExampleData)
  80.  
  81.     ; функции UDF
  82.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S15">([\w]+?)</span>', '<a class="le" href="UDFs3.chm::/html/libfunctions/\1.htm"><span class="S15">\1</span></a>')
  83.  
  84.     $sExampleData=StringRegExpReplace($sExampleData, '<span class="S4">([\w]+?)</span>', '<a class="le" href="../functions/\1.htm"><span class="S4">\1</span></a>')
  85.     $sExampleData=StringReplace($sExampleData, 'href="../functions/Opt.htm">', 'href="../functions/AutoItSetOption.htm">')
  86.     ; операторы
  87.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S8">((?:[+^*/=&-]|&gt;|&lt;)+)</span>', '<a class="le" href="../intro/lang_operators.htm"><span class="S8">\1</span></a>')
  88.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Not|And|Or)</span>', '<a class="le" href="../intro/lang_operators.htm"><span class="S5">\1</span></a>')
  89.  
  90.     ; макросы
  91.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S6">(@[^<]+)</span>', '<a class="le" href="../macros.htm#\1"><span class="S6">\1</span></a>')
  92.  
  93.     ; замена ключевые слова
  94.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(ContinueCase|ContinueLoop|Default|Dim|Do|Enum|Exit|ExitLoop|For|Func|If|ReDim|Select|Static|Switch|While|With)</span>', '<a class="le" href="\1.htm"><span class="S5">\1</span></a>')
  95.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Else|Then|ElseIf|EndIf)</span>', '<a class="le" href="IfElseEndIf.htm"><span class="S5">\1</span></a>')
  96.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Next|To|Step)</span>', '<a class="le" href="For.htm"><span class="S5">\1</span></a>')
  97.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Case|EndSwitch)</span>', '<a class="le" href="Switch.htm"><span class="S5">\1</span></a>')
  98.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Global|Local|Const)</span>', '<a class="le" href="Dim.htm"><span class="S5">\1</span></a>')
  99.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(EndFunc|ByRef|Return)</span>', '<a class="le" href="Func.htm"><span class="S5">\1</span></a>')
  100.     $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(True|False)</span>', '<a class="le" href="Booleans.htm"><span class="S5">\1</span></a>')
  101.     $sExampleData=StringReplace($sExampleData, '<span class="S5">Until</span>', '<a class="le" href="Do.htm"><span class="S5">Until</span></a>')
  102.     $sExampleData=StringReplace($sExampleData, '<span class="S5">WEnd</span>', '<a class="le" href="While.htm"><span class="S5">WEnd</span></a>')
  103.     $sExampleData=StringReplace($sExampleData, '<span class="S5">EndSelect</span>', '<a class="le" href="Select.htm"><span class="S5">EndSelect</span></a>')
  104.     $sExampleData=StringReplace($sExampleData, '<span class="S5">In</span>', '<a class="le" href="ForInNext.htm"><span class="S5">In</span></a>')
  105.     $sExampleData=StringReplace($sExampleData, '<span class="S5">EndWith</span>', '<a class="le" href="With.htm"><span class="S5">EndWith</span></a>')
  106.    
  107.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#OnAutoItStartRegister</span>', '<a class="le" href="OnAutoItStartRegister.htm"><span class="S11">#OnAutoItStartRegister</span></a>')
  108.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#include</span>', '<a class="le" href="include.htm"><span class="S11">#include</span></a>')
  109.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#include-once</span>', '<a class="le" href="include-once.htm"><span class="S11">#include-once</span></a>')
  110.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#RequireAdmin</span>', '<a class="le" href="RequireAdmin.htm"><span class="S11">#RequireAdmin</span></a>')
  111.     $sExampleData=StringReplace($sExampleData, '<span class="S11">#NoTrayIcon</span>', '<a class="le" href="NoTrayIcon.htm"><span class="S11">#NoTrayIcon</span></a>')
  112. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement