Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sExampleData = FileRead($sFileExample)
- ; --- обработка примеров ---
- $sExampleData = StringRegExpReplace($sExampleData, '(<span class="S(\d)">)((?: |[ ])+)(</span>)', '\3') ; удаляем теги пробелов, которые не могут быть цветными
- ; удаление последовательных одинаковых тегов, кроме keywords
- Do
- $sExampleData=StringRegExpReplace($sExampleData, '(<span class="S([0-389])">[^<]*?)</span>([\s]*)<span class="S\2">', '\1\3')
- Until @Extended=0
- Switch $sType
- Case "keywords"
- $sExampleData=StringRegExpReplace($sExampleData, '<span class="S4">([\w\d]+?)</span>', '<a class="le" href="../functions/\1.htm"><span class="S4">\1</span></a>')
- $sExampleData=StringReplace($sExampleData, 'href="../functions/Opt.htm">', 'href="../functions/AutoItSetOption.htm">')
- ; операторы
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S8">((?:[+^*/=&-]|>|<)+)</span>', '<a class="le" href="../intro/lang_operators.htm"><span class="S8">\1</span></a>')
- $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>')
- ; замена ключевые слова
- $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>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Else|Then|ElseIf|EndIf)</span>', '<a class="le" href="IfElseEndIf.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Next|To|Step)</span>', '<a class="le" href="For.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Case|EndSwitch)</span>', '<a class="le" href="Switch.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Global|Local|Const)</span>', '<a class="le" href="Dim.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(EndFunc|ByRef|Return)</span>', '<a class="le" href="Func.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(True|False)</span>', '<a class="le" href="Booleans.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">Until</span>', '<a class="le" href="Do.htm"><span class="S5">Until</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">WEnd</span>', '<a class="le" href="While.htm"><span class="S5">WEnd</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">EndSelect</span>', '<a class="le" href="Select.htm"><span class="S5">EndSelect</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">In</span>', '<a class="le" href="ForInNext.htm"><span class="S5">In</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">EndWith</span>', '<a class="le" href="With.htm"><span class="S5">EndWith</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#OnAutoItStartRegister</span>', '<a class="le" href="OnAutoItStartRegister.htm"><span class="S11">#OnAutoItStartRegister</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#include</span>', '<a class="le" href="include.htm"><span class="S11">#include</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#include-once</span>', '<a class="le" href="include-once.htm"><span class="S11">#include-once</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#RequireAdmin</span>', '<a class="le" href="RequireAdmin.htm"><span class="S11">#RequireAdmin</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#NoTrayIcon</span>', '<a class="le" href="NoTrayIcon.htm"><span class="S11">#NoTrayIcon</span></a>')
- Case "functions"
- $sExampleData=StringRegExpReplace($sExampleData, '<span class="S4">([\w\d]+?)</span>', '<a class="le" href="\1.htm"><span class="S4">\1</span></a>')
- $sExampleData=StringReplace($sExampleData, 'href="Opt.htm">', 'href="AutoItSetOption.htm">')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S8">((?:[+^*/=&-]|>|<)+)</span>', '<a class="le" href="../intro/lang_operators.htm"><span class="S8">\1</span></a>')
- $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>')
- ; замена ключевые слова
- $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>')
- $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>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Next|To|Step)</span>', '<a class="le" href="../keywords/For.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Case|EndSwitch)</span>', '<a class="le" href="../keywords/Switch.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(Global|Local|Const)</span>', '<a class="le" href="../keywords/Dim.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(EndFunc|ByRef|Return)</span>', '<a class="le" href="../keywords/Func.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringRegExpReplace($sExampleData, '(?i)<span class="S5">(True|False)</span>', '<a class="le" href="../keywords/Booleans.htm"><span class="S5">\1</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">Until</span>', '<a class="le" href="../keywords/Do.htm"><span class="S5">Until</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">WEnd</span>', '<a class="le" href="../keywords/While.htm"><span class="S5">WEnd</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">EndSelect</span>', '<a class="le" href="../keywords/Select.htm"><span class="S5">EndSelect</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">In</span>', '<a class="le" href="../keywords/ForInNext.htm"><span class="S5">In</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S5">EndWith</span>', '<a class="le" href="../keywords/With.htm"><span class="S5">EndWith</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#OnAutoItStartRegister</span>', '<a class="le" href="../keywords/OnAutoItStartRegister.htm"><span class="S11">#OnAutoItStartRegister</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#include</span>', '<a class="le" href="../keywords/include.htm"><span class="S11">#include</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#include-once</span>', '<a class="le" href="../keywords/include-once.htm"><span class="S11">#include-once</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#RequireAdmin</span>', '<a class="le" href="../keywords/RequireAdmin.htm"><span class="S11">#RequireAdmin</span></a>')
- $sExampleData=StringReplace($sExampleData, '<span class="S11">#NoTrayIcon</span>', '<a class="le" href="../keywords/NoTrayIcon.htm"><span class="S11">#NoTrayIcon</span></a>')
- Case "libfunctions"
- $sExampleData=StringRegExpReplace($sExampleData, '<span class="S15">([\w\d]+?)</span>', '<a class="le" href="\1.htm"><span class="S15">\1</span></a>')
- EndSwitch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement