Pastakhov has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348673 )

Change subject: Highlighting text as wikitext inside <ref> tag for CodeMirror 
extension
......................................................................

Highlighting text as wikitext inside <ref> tag for CodeMirror extension

DO NOT MERGE
just examlpe (though it works fine, merge if you sure that it is well)

<pre> tag will be colored green
   after I499e1e4b2e1e4fa972e28fc05a65047ecadc204c merged.

Change-Id: I1bf156fa813af4d5f891619f692047bbdb8a1a86
---
M extension.json
M includes/CiteHooks.php
A modules/ext.cite.codemirror.css
3 files changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite 
refs/changes/73/348673/1

diff --git a/extension.json b/extension.json
index ac9cd43..7c55c45 100644
--- a/extension.json
+++ b/extension.json
@@ -24,6 +24,9 @@
                }
        },
        "Hooks": {
+               "CodeMirrorGetAdditionalResources": [
+                       "CiteHooks::onCodeMirrorGetAdditionalResources"
+               ],
                "ParserFirstCallInit": [
                        "Cite::setHooks"
                ],
@@ -47,6 +50,9 @@
                ]
        },
        "ResourceModules": {
+               "ext.cite.codemirror": {
+                       "styles": "ext.cite.codemirror.css"
+               },
                "ext.cite.styles": {
                        "styles": {
                                "ext.cite.styles.css": {},
diff --git a/includes/CiteHooks.php b/includes/CiteHooks.php
index 7e3c5bf..481dca2 100644
--- a/includes/CiteHooks.php
+++ b/includes/CiteHooks.php
@@ -255,4 +255,16 @@
                $vars['wgCiteVisualEditorOtherGroup'] = $config->get( 
'CiteVisualEditorOtherGroup' );
                return true;
        }
+
+       /**
+        * Defines text/mediawiki mode for text inside <ref> tag for the 
CodeMirror extension
+        * @param array $extResources
+        * @param array $extMode
+        */
+       public static function onCodeMirrorGetAdditionalResources( 
&$extResources, &$extMode ) {
+               $extResources['dependencies']['ext.cite.codemirror'] = true;
+               $extMode['tag']['ref'] = 'text/mediawiki';
+               return true;
+       }
+
 }
diff --git a/modules/ext.cite.codemirror.css b/modules/ext.cite.codemirror.css
new file mode 100644
index 0000000..bbe835c
--- /dev/null
+++ b/modules/ext.cite.codemirror.css
@@ -0,0 +1,5 @@
+/* CSS for CodeMirror extension */
+
+.cm-mw-ext-ref.cm-mw-exttag-name { color: #170; font-weight: bold; }
+.cm-mw-ext-ref.cm-mw-exttag-bracket { color: #170; font-weight: normal; }
+.cm-mw-ext-ref.cm-mw-exttag-attribute { color: #170; font-weight: normal; }

-- 
To view, visit https://gerrit.wikimedia.org/r/348673
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bf156fa813af4d5f891619f692047bbdb8a1a86
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to