diff --git a/.gitignore b/.gitignore index 052815a..470fb63 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /conlite/includes/include.style_edit_form_1.php /cms/config.local.php /cms/dflip/ +/cms/js/firstlevel/ diff --git a/conlite/classes/class.genericdb.php b/conlite/classes/class.genericdb.php index 5225cff..507c3d3 100644 --- a/conlite/classes/class.genericdb.php +++ b/conlite/classes/class.genericdb.php @@ -1119,7 +1119,8 @@ abstract class ItemCollection extends cItemBaseAbstract { * @param string $primaryKeyValue Optional parameter for direct input of primary key value * @return Item The newly created object */ - public function createNewItem($aData = NULL) { /* @var $oDb DB_ConLite */ + public function createNewItem($aData = NULL) { + /* @var $oDb DB_ConLite */ $oDb = $this->_getSecondDBInstance(); if (is_null($aData) || empty($aData)) { $iNextId = $oDb->nextid($this->table); @@ -1318,6 +1319,13 @@ abstract class Item extends cItemBaseAbstract { * @var string */ protected $_metaObject; + + /** + * Last executed SQL statement + * + * @var string + */ + protected $_lastSQL; /** * Constructor function @@ -1383,6 +1391,52 @@ abstract class Item extends cItemBaseAbstract { $this->loadByRecordSet($this->db->toArray()); return true; } + + public function loadByMany(array $aAttributes, $bSafe = true) { + $this->_resetItem(); + + if ($bSafe) { + $aAttributes = $this->_inFilter($aAttributes); + } + + // @todo add cache here + + + // SQL-Statement to select by fields + $sql = 'SELECT * FROM `:mytab` WHERE'; + foreach (array_keys($aAttributes) as $sKey) { + // add quotes if key is a string + if (is_string($sKey)) { + $sql .= " $sKey = ':$sKey' AND"; + } else { + $sql .= " $sKey = :$sKey AND"; + } + } + // strip the last " AND" token + $sql = cString::getPartOfString($sql, 0, cString::getStringLength($sql) - 4); + $sql = $this->db->_prepareQueryf($sql, array_merge(array( + 'mytab' => $this->table + ), $aAttributes)); + + // Query the database + $this->db->query($sql); + + $this->_lastSQL = $sql; + + if ($this->db->num_rows() > 1) { + $msg = 'Tried to load a single line with fields ' . print_r(array_keys($aAttributes), true) . ' and values ' . print_r(array_values($aAttributes), true) . ' from ' . $this->table . ' but found more than one row'; + throw new Contenido_ItemException($msg); + } + + // Advance to the next record, return false if nothing found + if (!$this->db->next_record()) { + return false; + } + + $this->loadByRecordSet($this->db->toArray()); + $this->_setLoaded(true); + return true; + } /** * Loads an item by passed where clause from the database. @@ -1444,14 +1498,6 @@ abstract class Item extends cItemBaseAbstract { self::$_oCache->addItem($this->table . "_" . $this->oldPrimaryKey, $this->values); } - /** - * Checks if a the item is already loaded. - * @return boolean - */ - public function isLoaded() { - return ($this->virgin) ? FALSE : TRUE; - } - /** * Function which is called whenever an item is loaded. * Inherited classes should override this function if desired. @@ -1704,20 +1750,22 @@ abstract class Item extends cItemBaseAbstract { /** * Filters the passed data using the functions defines in the _arrInFilters array. * - * @see setFilters - * - * @todo This method is used from public scope, but it should be protected - * - * @param mixed $mData Data to filter - * @return mixed Filtered data + * @see Item::setFilters() + * @param mixed $mData + * Data to filter + * @return mixed + * Filtered data */ - public function _inFilter($mData) { - if (is_numeric($mData) || is_array($mData)) - return $mData; - + public function _inFilter($mData) { foreach ($this->_arrInFilters as $_function) { if (function_exists($_function)) { - $mData = $_function($mData); + if (is_array($mData)) { + foreach ($mData as $key => $value) { + $mData[$key] = $_function($value); + } + } else { + $mData = $_function($mData); + } } } return $mData; @@ -1731,7 +1779,7 @@ abstract class Item extends cItemBaseAbstract { * @param mixed $mData Data to filter * @return mixed Filtered data */ - protected function _outFilter($mData) { + public function _outFilter($mData) { if (is_numeric($mData)) return $mData; @@ -1771,5 +1819,18 @@ abstract class Item extends cItemBaseAbstract { return $_metaObjectCache[$qclassname]; } } + + /** + * Resets class variables back to default + * This is handy in case a new item is tried to be loaded into this class instance. + */ + protected function _resetItem() { + parent::_resetItem(); + // make sure not to reset filters because then default filters would always be used for loading + $this->values = null; + $this->modifiedValues = null; + $this->_metaObject = null; + $this->_lastSQL = null; + } } diff --git a/conlite/classes/class.security.php b/conlite/classes/class.security.php index f86ae8a..a4629a1 100644 --- a/conlite/classes/class.security.php +++ b/conlite/classes/class.security.php @@ -35,7 +35,7 @@ class Contenido_Security_Exception extends Exception { * @static * @var boolean */ - protected static $_logging = false; + protected static $_logging = true; /** * @see Exception::__construct() @@ -45,7 +45,12 @@ class Contenido_Security_Exception extends Exception { // check if logging is enabled if (self::$_logging == true) { - $sLogFile = realpath(dirname(__FILE__) . '/../logs/') . '/security.txt'; + $sPath = realpath(dirname(__FILE__) . '/../../data/logs'); + if(is_writable($sPath)) { + $sLogFile = $sPath . '/security.txt'; + } else { + $sLogFile = realpath(dirname(__FILE__) . '/../') . '/security.txt'; + } $sFileContent = '---------' . PHP_EOL; $sFileContent .= "Invalid call caused by parameter '" . $sParamName . "' at " . date("c") . PHP_EOL; @@ -355,7 +360,7 @@ class cSecurity { public static function checkRequestSession() { if (isset($_REQUEST['contenido']) && !preg_match('/^[0-9a-f]{32}$/', $_REQUEST['contenido'])) { if ($_REQUEST['contenido'] != '') { - throw new Contenido_Security_Exception('Invalid call', 'contenido'); + throw new Contenido_Security_Exception('Invalid call', 'conlite'); } } return true; diff --git a/conlite/classes/class.versionFile.php b/conlite/classes/class.versionFile.php index 6c29609..d82948b 100644 --- a/conlite/classes/class.versionFile.php +++ b/conlite/classes/class.versionFile.php @@ -1,4 +1,5 @@ sType = $sTypeContent; - + $this->sType = $sTypeContent; + // File Name for xml node - $this->sFileName = $sFileName; - + $this->sFileName = $sFileName; + // File Information, set for class Version to generate head xml nodes - $this->sDescripion = $aFileInfo["description"]; - $this->sAuthor = $aFileInfo["author"]; - $this->dLastModified = $aFileInfo["lastmodified"]; - $this->dCreated = $aFileInfo["created"]; - + $this->sDescripion = $aFileInfo["description"]; + $this->sAuthor = $aFileInfo["author"]; + $this->dLastModified = $aFileInfo["lastmodified"]; + $this->dCreated = $aFileInfo["created"]; + // Frontendpath to files - if($sTypeContent == "templates"){ - $sTypeContent = "tpl"; - } - + if ($sTypeContent == "templates") { + $sTypeContent = "tpl"; + } + $this->sPath = $this->aCfgClient[$this->iClient][$sTypeContent]["path"]; - -// Identity the Id of Content Type - $this->iIdentity = $iIdOfType; - -// This function looks if maximum number of stored versions is achieved + + // Identity the Id of Content Type + $this->iIdentity = $iIdOfType; + + //This function looks if maximum number of stored versions is achieved $this->prune(); - -// Take revision files if exists - $this->initRevisions(); - -// Get code of style - $this->initFileContent(); - -// Set Layout Table Iformation, currently not in use! - #$this->setLayoutTable(); - + + //Take revision files if exists + $this->initRevisions(); + + //Get code of style + $this->initFileContent(); + + // Set Layout Table Iformation, currently not in use! + #$this->setLayoutTable(); + if ($sVersionFileName == '') { $sVersionFileName = $this->sFileName; } - + // Create Body Node of Xml File - $this->setData("name", $sVersionFileName); - $this->setData("code", $this->sCode); - $this->setData("description", $this->sDescripion); - } - - /** - * This function init the class member sCode with current file content - * - * @return void only init sCode - */ + $this->setData("name", $sVersionFileName); + $this->setData("code", $this->sCode); + $this->setData("description", $this->sDescripion); + } + + /** + * This function init the class member sCode with current file content + * + * @return void only init sCode + */ protected function initFileContent() { - if (file_exists($this->sPath.$this->sFileName)) { - if (!$handle = fopen( $this->sPath.$this->sFileName, "rb")) { - print i18n("Can not open file "). $this->sPath.$this->sFileName; - return; - } do { - $_data = fread($handle, 4096); - if (strlen($_data) == 0) { - break; - } - $this->sCode .= $_data; - } while(true); - fclose($handle); - }else{ - echo "
File not exists " . $this->sPath.$this->sFileName; - } + if (file_exists($this->sPath . $this->sFileName)) { + if (!$handle = fopen($this->sPath . $this->sFileName, "rb")) { + print i18n("Can not open file ") . $this->sPath . $this->sFileName; + return; + } do { + $_data = fread($handle, 4096); + if (strlen($_data) == 0) { + break; + } + $this->sCode .= $_data; + } while (true); + fclose($handle); + } else { + echo "
File not exists " . $this->sPath . $this->sFileName; + } } - - - /** - * This function read an xml file nodes - * - * @param string $sPath Path to file - * - * @return {array} returns array width nodes - */ + + /** + * This function read an xml file nodes + * + * @param string $sPath Path to file + * + * @return {array} returns array width nodes + */ public function initXmlReader($sPath) { - $aResult = array(); - if($sPath !=""){ - // Output this xml file - $sXML = simplexml_load_file($sPath); - - if ($sXML) { - foreach ($sXML->body as $oBodyValues) { - // if choose xml file read value an set it - $aResult["name"] = $oBodyValues->name; - $aResult["desc"] = $oBodyValues->description; - $aResult["code"] = $oBodyValues->code; - } - - } - - } - - return $aResult; + $aResult = array(); + if ($sPath != "") { + // Output this xml file + $sXML = simplexml_load_file($sPath); + + if ($sXML) { + foreach ($sXML->body as $oBodyValues) { + // if choose xml file read value an set it + $aResult["name"] = $oBodyValues->name; + $aResult["desc"] = $oBodyValues->description; + $aResult["code"] = $oBodyValues->code; + } + } + } + + return $aResult; } - - /** - * This function reads the path of file - * - * @param string $sPath Path to file - * - * @return string the path of file - */ + + /** + * This function reads the path of file + * + * @param string $sPath Path to file + * + * @return string the path of file + */ public function getPathFile() { - return $this->sPath; + return $this->sPath; } - - /** - * Function returns javascript which refreshes contenido frames for file list an subnavigation. - * This is neccessary, if filenames where changed, when a history entry is restored - * - * @param integer $iIdClient - id of client which contains this file - * @param string $sArea - name of contenido area in which this procedure should be done - * @param string $sFilename - new filename of file which should be updated in other frames - * @param object $sess - Contenido session object - * - * @return string - Javascript for refrehing frames - */ + + /** + * Function returns javascript which refreshes contenido frames for file list an subnavigation. + * This is neccessary, if filenames where changed, when a history entry is restored + * + * @param integer $iIdClient - id of client which contains this file + * @param string $sArea - name of contenido area in which this procedure should be done + * @param string $sFilename - new filename of file which should be updated in other frames + * @param object $sess - Contenido session object + * + * @return string - Javascript for refrehing frames + */ public function renderReloadScript($sArea, $sFilename, $sess) { $sReloadScript = " + '; + } + + public function setReload(array $parameters = []) { + $reloadParameters = count($parameters) > 0 ? json_encode($parameters) : ''; + $this->_uniqueScripts['left_bottom'] = ' + + '; + } + + public function reloadFrame($frameName, $updatedParameters = null) { + if (is_array($updatedParameters)) { + $reloadParameters = count($updatedParameters) > 0 ? json_encode($updatedParameters) : '{}'; + $this->_uniqueScripts[$frameName] = ' + + '; + } else { + $this->_uniqueScripts[$frameName] = ' + + '; + } + } + + public function reloadLeftTopFrame($updatedParameters = null) { + if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) { + $updatedParameters['frame'] = 1; + } + $this->reloadFrame('left_top', $updatedParameters); + } + + public function reloadLeftBottomFrame($updatedParameters = null) { + if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) { + $updatedParameters['frame'] = 2; + } + $this->reloadFrame('left_bottom', $updatedParameters); + } + + public function reloadRightTopFrame($updatedParameters = null) { + if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) { + $updatedParameters['frame'] = 3; + } + $this->reloadFrame('right_top', $updatedParameters); + } + + public function reloadRightBottomFrame($updatedParameters = null) { + if (is_array($updatedParameters) && !isset($updatedParameters['frame'])) { + $updatedParameters['frame'] = 4; + } + $this->reloadFrame('right_bottom', $updatedParameters); + } + + public function setMarkScript($item) { + $this->_markScript = markSubMenuItem($item, true); + } + + public function setEncoding($encoding) { + if (empty($encoding)) { + return; + } + $this->_metaTags[] = [ + 'http-equiv' => 'Content-type', + 'content' => 'text/html;charset=' . $encoding + ]; + } + + public function set($type, $key, $value) { + $this->_contentTemplate->set($type, $key, $value); + } + + public function setPageBase($filename = '') { + $sFolder = ($this->_bHTML5)?'html5/':''; + if ('' === $filename) { + $cfg = cRegistry::getConfig(); + $this->_pageBase = $cfg['path']['templates']. $sFolder . $cfg['templates']['generic_page']; + } else { + $this->_pageBase = $sFolder.$filename; + } + } + + public function next() { + $this->_contentTemplate->next(); + } + + public function abortRendering() { + $this->_abort = true; + } + + public function displayCriticalError($msg) { + $this->_error = $msg; + $this->_abort = true; + } + + public function displayError($msg) { + $this->_error .= $msg . '
'; + } + + public function displayWarning($msg) { + $this->_warning .= $msg . '
'; + } + + public function displayInfo($msg) { + $this->_info .= $msg . '
'; + } + + public function displayOk($msg) { + $this->_ok .= $msg . '
'; + } + + public function setContent($objects) { + if (!is_array($objects)) { + $objects = [ + $objects + ]; + } + $this->_objects = $objects; + } + + public function appendContent($objects) { + if (!is_array($objects)) { + $this->_objects[] = $objects; + } else { + $this->_objects = array_merge($this->_objects, $objects); + } + } + + public function render($template = NULL, $return = false) { + + if ($template == NULL) { + $template = $this->_contentTemplate; + } + + // Render some parts like meta tags, scripts, styles, etc... + $this->_renderMetaTags(); + $this->_renderScripts(); + $this->_renderStyles(); + + // Set body class attribute values + $this->_pageTemplate->set('s', 'PAGECLASS', implode(' ', $this->_bodyClassNames)); + + // Get all messages for the content + $text = $this->_renderContentMessages(); + if (cString::getStringLength(trim($text)) > 0) { + $this->_skipTemplateCheck = true; + } + + if (!$this->_abort) { + if (count($this->_objects) == 0) { + $output = $this->_renderTemplate($template); + } else { + $output = $this->_renderObjects(); + } + $this->_pageTemplate->set('s', 'CONTENT', $text . $output); + } else { + $this->_pageTemplate->set('s', 'CONTENT', $text); + } + + return $this->_pageTemplate->generate($this->_pageBase, $return); + } + + protected function _renderMetaTags() { + // render the meta tags + // NB! We don't produce xhtml in the backend + // $produceXhtml = getEffectiveSetting('generator', 'xhtml', 'false'); + $produceXhtml = false; + $meta = ''; + foreach ($this->_metaTags as $metaTag) { + $tag = ' $value) { + $tag .= ' ' . $key . '="' . $value . '"'; + } + if ($produceXhtml) { + $tag .= ' /'; + } + $tag .= ">\n"; + $meta .= $tag; + } + if (!empty($meta)) { + $this->_pageTemplate->set('s', 'META', $meta); + } else { + $this->_pageTemplate->set('s', 'META', ''); + } + } + + protected function _renderScripts() { + $scripts = $this->_subnav . "\n" . $this->_markScript . "\n"; + $scripts .= implode("\n", $this->_uniqueScripts); + foreach ($this->_scripts as $script) { + if (cString::findFirstPos($script, 'http') === 0 || cString::findFirstPos($script, '//') === 0) { + $scripts .= '' . "\n"; + } else if (cString::findFirstPos($script, '' . "\n"; + } else { + $scripts .= $script; + } + } + $this->_pageTemplate->set('s', 'SCRIPTS', $scripts); + } + + protected function _renderStyles() { + $styles = ''; + foreach ($this->_styles as $style) { + if (cString::findFirstPos($style, 'http') === 0 || cString::findFirstPos($style, '//') === 0) { + $styles .= '' . "\n"; + } else { + $styles .= '' . "\n"; + } + } + $this->_pageTemplate->set('s', 'STYLES', $styles); + } + + protected function _renderContentMessages() { + global $notification; + + // Get messages from cRegistry + $okMessages = cRegistry::getOkMessages(); + foreach ($okMessages as $message) { + $this->displayOk($message); + } + + $infoMessages = cRegistry::getInfoMessages(); + foreach ($infoMessages as $message) { + $this->displayInfo($message); + } + + $errorMessages = cRegistry::getErrorMessages(); + foreach ($errorMessages as $message) { + $this->displayError($message); + } + + $warningMessages = cRegistry::getWarningMessages(); + foreach ($warningMessages as $message) { + $this->displayWarning($message); + } + + $text = ''; + if ($this->_ok != '') { + $text .= $notification->returnNotification('ok', $this->_ok) . '
'; + } + if ($this->_info != '') { + $text .= $notification->returnNotification('info', $this->_info) . '
'; + } + if ($this->_warning != '') { + $text .= $notification->returnNotification('warning', $this->_warning) . '
'; + } + if ($this->_error != '') { + $text .= $notification->returnNotification('error', $this->_error) . '
'; + } + + return $text; + } + + protected function _renderObjects() { + $output = ''; + + foreach ($this->_objects as $obj) { + if (is_string($obj)) { + $output .= $obj; + } + + if (!method_exists($obj, 'render')) { + continue; + } + + // Ridiculous workaround because some objects return + // code if the parameter is true and some return the + // code if the parameter is false. + $oldOutput = $output; + + // We don't want any code outside the body (in case the + // object outputs directly we will catch this output). + ob_start(); + $output .= $obj->render(false); + + // We get the code either directly or via the output + $output .= ob_get_contents(); + if ($oldOutput == $output) { + cWarning(__FILE__, __LINE__, "Rendering this object (" . print_r($obj, true) . ") doesn't seem to have any effect."); + } + ob_end_clean(); + } + + return $output; + } + + protected function _renderTemplate($template) { + global $currentuser, $notification; + + $perm = cRegistry::getPerm(); + $cfg = cRegistry::getConfig(); + + if ($this->_pluginName == '') { + $sHtml5 = ($this->_bHTML5)?'html5/':''; + $file = $cfg['path']['templates'] . $sHtml5 . 'template.' . $this->_pageName . '.html'; + } else { + $file = $cfg['path']['plugins'] . $this->_pluginName . '/templates/template.' . $this->_pageName . '.html'; + } + + $output = ''; + // Warning message for not existing resources + if (!$this->_skipTemplateCheck && $perm->isSysadmin($currentuser) && !cFileHandler::exists($file)) { + $output .= $notification->returnNotification('warning', i18n("The requested resource") . " template." . $this->_pageName . ".html " . i18n("was not found")) . '
'; + } + + if (cFileHandler::exists($file)) { + $output .= $template->generate($file, true); + } else { + $output .= ''; + } + + return $output; + } + + protected function _getRealFilePathName($file) { + $tmp = explode('?', $file); + return $tmp[0]; + } + + function __destruct() { + $this->_bHTML5 = false; + } +} diff --git a/conlite/classes/gui/class.sourceeditor.php b/conlite/classes/gui/class.sourceeditor.php new file mode 100644 index 0000000..fc2b2c5 --- /dev/null +++ b/conlite/classes/gui/class.sourceeditor.php @@ -0,0 +1,284 @@ +_bHTML5 = true; + parent::__construct("generic_source_editor"); + // check permissions + if (!$perm->have_perm_area_action($area, $action)) { + $this->displayCriticalError(i18n('Permission denied')); + } + + // display empty page if no client is selected + if (!(int) $client > 0) { + $this->abortRendering(); + } + + // determine the filetype and path by using the area + if ($filetype == '') { + switch($_REQUEST['area']) { + case 'style': + $filepath = $cfgClient[$client]['css']['path'] . $filename; + $filetype = 'css'; + break; + case 'js': + $filepath = $cfgClient[$client]['js']['path'] . $filename; + $filetype = 'js'; + break; + case 'htmltpl': + $filepath = $cfgClient[$client]['tpl']['path'] . $filename; + $filetype = 'html'; + break; + } + } + + // assign variables + $this->_filetype = $filetype; + $this->_filepath = $filepath; + + $this->_readOnly = (getEffectiveSetting("client", "readonly", "false") == "true"); + if($this->_readOnly) { + cRegistry::addWarningMessage(i18n("This area is read only! The administrator disabled edits!")); + } + + $this->_filename = $filename; + + // include the class and create the codemirror instance + cInclude('external', 'codemirror/class.codemirror.php'); + $this->_codeMirror = new CodeMirror('code', $this->_filetype, cString::getPartOfString(cString::toLowerCase($belang), 0, 2), true, $cfg, !$this->_readOnly); + + $this->_versioning = $versioning; + + // update the edited file by using the super global _REQUEST + $this->update($_REQUEST); + } + + protected function update($req) { + global $cfgClient; + + $cfg = cRegistry::getConfig(); + $client = cRegistry::getClientId(); + $db = cRegistry::getDb(); + $frame = cRegistry::getFrame(); + $perm = cRegistry::getPerm(); + $area = cRegistry::getArea(); + $action = cRegistry::getAction(); + + // check permissions + if (!$perm->have_perm_area_action($area, $action)) { + $this->displayCriticalError(i18n('Permission denied')); + } + + // if read only is activated or no data has been sent, skip the update step + if( ($this->_readOnly || ($req['status'] != 'send')) && $req['delfile'] == '') { + if($req['action'] == '') { + $this->abortRendering(); + } + return; + } + + // if magic quotes are on, strip slashes from the array + if(ini_get('magic_quotes_gpc')) { + foreach($req as $key => $value) { + $req[$key] = stripslashes($value); + } + } + + // determine the file type for the file information table + $dbFileType = ''; + switch($req['area']) { + case 'style': + $dbFileType = 'css'; + break; + case 'js': + $dbFileType = 'js'; + break; + case 'htmltpl': + $dbFileType = 'templates'; + break; + } + + // delete the specified file + if ($req['delfile'] != '') { + // check if it exists + if (cFileHandler::exists($this->_filepath . $req['delfile'])) { + // load information + $fileInfos = new cApiFileInformationCollection(); + $fileInfos->select('filename = \'' . $req['delfile'] . '\''); + $fileInfo = $fileInfos->next(); + // if there is information and if there are versioning files, delete them + if ($fileInfo != null) { + $idsfi = $fileInfo->get('idsfi'); + + if (cSecurity::isInteger($idsfi) && is_dir($cfgClient[$client]['version']['path'] . "$dbFileType/$idsfi")) { + cDirHandler::recursiveRmdir($cfgClient[$client]['version']['path'] . "$dbFileType/$idsfi"); + } + } + + // remove the file + cFileHandler::remove($this->_filepath . $req['delfile']); + + // remove the file information + $fileInfos->removeFileInformation(array( + 'filename' => $req['delfile'] + )); + + // display the information and reload the frame + $this->displayOk(i18n('File deleted successfully!')); + $this->abortRendering(); + + $this->reloadLeftBottomFrame(['file' => null]); + } + return; + } + + // Set version filename + $this->_versionfilename = $this->_filename; + + // if the filename is empty, display an empty editor and create a new file + if (is_dir($this->_filepath) && cFileHandler::writeable($this->_filepath)) { + // validate the file name + if (!cFileHandler::validateFilename($req['file'], false)) { + $this->displayError(i18n('Not a valid filename!')); + return; + } + // check if the file exists already + if (cFileHandler::exists($this->_filepath . '/' . $req['file'])) { + $this->displayError(i18n('A file with this name exists already')); + return; + } + // set the variables and create the file. Reload frames + $this->_filepath = $this->_filepath . '/' . $req['file']; + $this->_filename = $req['file']; + + cFileHandler::write($this->_filepath, ''); + } + + // save the old code and the old name + $oldCode = cFileHandler::read($this->_filepath); + $oldName = $this->_filename; + + // load the file information and update the description + $fileInfos = new cApiFileInformationCollection(); + $fileInfos->select('filename = \'' . $this->_filename . '\''); + $fileInfo = $fileInfos->next(); + $oldDesc = ''; + if ($fileInfo == null) { + // file information does not exist yet. Create the row + $fileInfo = $fileInfos->create($dbFileType, $this->_filename, $req['description']); + } else { + $oldDesc = $fileInfo->get('description'); + if ($oldDesc != $req['description']) { + $fileInfo->set('description', $req['description']); + } + } + + // rename the file + if ($req['file'] != $this->_filename) { + // validate the file name + if (!cFileHandler::validateFilename($req['file'], false)) { + $this->displayError(i18n('Not a valid filename!')); + } else { + // check if a file with that name exists already + if (!cFileHandler::exists(dirname($this->_filepath) . '/' . $req['file'])) { + // rename the file and set the variables accordingly + cFileHandler::rename($this->_filepath, $req['file']); + $this->_filepath = dirname($this->_filepath) . '/' . $req['file']; + $this->_filename = $req['file']; + + // update the file information + $fileInfo->set('filename', $req['file']); + } else { + $this->displayError(i18n('Couldn\'t rename file. Does it exist already?')); + return; + } + } + } + + // if the versioning should be updated and the code changed, create a versioning instance and update it + if ($this->_versioning && $oldCode != $req['code']) { + $fileInfoArray = $fileInfos->getFileInformation($this->_versionfilename, $dbFileType); + $oVersion = new cVersionFile($fileInfo->get('idsfi'), $fileInfoArray, $req['file'], $dbFileType, $cfg, $cfgClient, $db, $client, $area, $frame, $this->_versionfilename); + // Create new Layout Version in cms/version/css/ folder + $oVersion->createNewVersion(); + } + + // write the code changes and display an error message or success message + if (cFileHandler::write($this->_filepath, $req['code'])) { + // store the file information + $fileInfo->store(); + $this->displayOk(i18n('Changes saved successfully!')); + } else { + $this->displayError(i18n('Couldn\'t save the changes! Check the file system permissions.')); + } + } + + public function render($template = NULL, $return = false) { + + $cfg = cRegistry::getConfig(); + $area = cRegistry::getArea(); + $action = cRegistry::getAction(); + + // load the file information + $fileInfos = new cApiFileInformationCollection(); + $fileInfos->select('filename = \'' . $this->_filename . '\''); + $fileInfo = $fileInfos->next(); + $desc = ''; + if ($fileInfo != null) { + $desc = $fileInfo->get('description'); + } + + // assign description + $this->set('s', 'DESCRIPTION', $desc); + + // assign the codemirror script, and other variables + $this->set('s', 'CODEMIRROR_SCRIPT', $this->_codeMirror->renderScript()); + $this->set('s', 'AREA', $area); + $this->set('s', 'ACTION', $action); + $this->set('s', 'FILENAME', $this->_filename); + if (cFileHandler::readable($this->_filepath) && $this->_filename != '') { + $this->set('s', 'SOURCE', conHtmlentities(cFileHandler::read($this->_filepath))); + } else { + $this->set('s', 'SOURCE', ''); + } + if ($this->_readOnly) { + // if the read only mode is activated, display a greyed out icon + $this->set('s', 'SAVE_BUTTON_IMAGE', $cfg['path']['images'] . 'but_ok_off.gif'); + $this->set('s', 'SAVE_BUTTON_DESC', i18n('The administratos has disabled edits')); + } else { + $this->set('s', 'SAVE_BUTTON_IMAGE', $cfg['path']['images'] . 'but_ok.gif'); + $this->set('s', 'SAVE_BUTTON_DESC', i18n('Save changes')); + } + + if ($this->_filename) { + $this->reloadRightTopFrame(['file' => $this->_filename]); + $this->reloadLeftBottomFrame(['file' => $this->_filename]); + } else { + $this->reloadLeftBottomFrame(['file' => null]); + } + + // call the render method of cGuiPage + parent::render(); + } + +} diff --git a/conlite/classes/template/class.template.php b/conlite/classes/template/class.template.php index 8004a23..dc34f42 100644 --- a/conlite/classes/template/class.template.php +++ b/conlite/classes/template/class.template.php @@ -214,6 +214,9 @@ class Template { $content = (($note) ? "\n" : "") . $content; + // CEC for template pre processing + $content = CEC_Hook::executeAndReturn('Contenido.Template.BeforeParse', $content, $this); + $pieces = array(); //replace i18n strings before replacing other placeholders $this->replacei18n($content, "i18n"); @@ -329,5 +332,6 @@ class Template { } -# end class -?> \ No newline at end of file +class cTemplate extends Template { + +} \ No newline at end of file diff --git a/conlite/external/codemirror/class.codemirror.php b/conlite/external/codemirror/class.codemirror.php new file mode 100644 index 0000000..b6b7363 --- /dev/null +++ b/conlite/external/codemirror/class.codemirror.php @@ -0,0 +1,309 @@ + + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + */ + +defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.'); + +/** + * Class for handling and displaying CodeMirror + * + * @package Core + * @subpackage Backend + */ +class CodeMirror { + + /** + * Properties which were used to init CodeMirror + * + * @var array + */ + private $_properties = array(); + + /** + * HTML-ID of textarea which is replaced by CodeMirror + * + * @var string + */ + private $_textareaId = ''; + + /** + * defines if textarea is used or not (by system/client/user property) + * + * @var boolean + */ + private $_activated = true; + + /** + * defines if js-script for CodeMirror is included on rendering process + * + * @var boolean + */ + private $_addScript = true; + + /** + * The CONTENIDO configuration array + * + * @var array + */ + private $_cfg = array(); + + /** + * Language of CodeMirror + * + * @var string + */ + private $_language = ''; + + /** + * Syntax of CodeMirror + * + * @var string + */ + private $_syntax = ''; + + /** + * Constructor of CodeMirror initializes class variables + * + * @param string $id - The id of textarea which is replaced by editor + * @param string $syntax - Name of syntax highlighting which is used (html, + * css, js, php, ...) + * @param string $lang - lang which is used into editor. Notice NOT + * CONTENIDO language id + * ex: de, en ... To get it from CONTENIDO language use: + * substr(strtolower($belang), 0, 2) in backend + * @param bool $addScript - defines if CodeMirror script is included or + * not + * interesting when there is more than only one editor on page + * @param array $cfg - The CONTENIDO configuration array + * @param bool $editable - Optional defines if content is editable or not + */ + public function __construct($id, $syntax, $lang, $addScript, $cfg, $editable = true) { + // init class variables + $this->_properties = array(); + $this->_cfg = (array) $cfg; + $this->_addScript = (boolean) $addScript; + $this->_textareaId = (string) $id; + $this->_activated = true; + $this->_language = (string) $lang; + $this->_syntax = (string) $syntax; + + // make content not editable if not allowed + if ($editable == false) { + $this->setProperty('readOnly', 'true', true); + } + + $this->setProperty('lineNumbers', 'true', true); + $this->setProperty('lineWrapping', 'true', true); + $this->setProperty('matchBrackets', 'true', true); + $this->setProperty('indentUnit', 4, true); + $this->setProperty('indentWithTabs', 'true', true); + $this->setProperty('enterMode', 'keep', false); + $this->setProperty('tabMode', 'shift', false); + + // internal function which appends more properties to $this->setProperty + // wich where defined + // by user or sysadmin in systemproperties / client settings / user + // settings ... + $this->_getSystemProperties(); + } + + /** + * Function gets properties from CONTENIDO for CodeMirror and stores it into + * $this->setProperty so user is able to overwride standard settings or + * append + * other settings. + * Function also checks if CodeMirror is activated or deactivated + * by user + */ + private function _getSystemProperties() { + // check if editor is disabled or enabled by user/admin + if (getEffectiveSetting('codemirror', 'activated', 'true') == 'false') { + $this->_activated = false; + } + + $userSettings = getEffectiveSettingsByType('codemirror'); + foreach ($userSettings as $key => $value) { + if ($key != 'activated') { + if ($value == 'true' || $value == 'false' || is_numeric($value)) { + $this->setProperty($key, $value, true); + } else { + $this->setProperty($key, $value, false); + } + } + } + } + + /** + * Function for setting a property for CodeMirror to $this->setProperty + * existing properties were overwritten + * + * @param string $name - Name of CodeMirror property + * @param string $value - Value of CodeMirror property + * @param bool $isNumeric - Defines if value is numeric or not + * in case of a numeric value, there is no need to use + * quotes + */ + public function setProperty($name, $value, $isNumeric = false) { + // datatype check + $name = (string) $name; + $value = (string) $value; + $isNumeric = (boolean) $isNumeric; + + // generate a new array for new property + $record = array(); + $record['name'] = $name; + $record['value'] = $value; + $record['is_numeric'] = $isNumeric; + + // append it to class variable $this->aProperties + // when key already exists, overwride it + $this->_properties[$name] = $record; + } + + private function _getSyntaxScripts() { + $path = $this->_cfg['path']['contenido_fullhtml'] . 'external/codemirror'; + + $js = ''; + $jsTemplate = ''; + + $modes = array(); + + $syntax = $this->_syntax; + if ($syntax == 'js' || $syntax == 'html' || $syntax == 'php') { + $modes[] = 'javascript'; + } + + if ($syntax == 'css' || $syntax == 'html' || $syntax == 'php') { + $modes[] = 'css'; + } + + if ($syntax == 'html' || $syntax == 'php') { + $modes[] = 'xml'; + } + + if ($syntax == 'php') { + $modes[] = 'php'; + $modes[] = 'clike'; + } + + if ($syntax == 'html') { + $modes[] = 'htmlmixed'; + } + + foreach ($modes as $mode) { + $js .= sprintf($jsTemplate, $path, $mode, $mode) . PHP_EOL; + } + + return $js; + } + + private function _getSyntaxName() { + if ($this->_syntax == 'php') { + return 'application/x-httpd-php'; + } + + if ($this->_syntax == 'html') { + return 'text/html'; + } + + if ($this->_syntax == 'css') { + return 'text/css'; + } + + if ($this->_syntax == 'js') { + return 'text/javascript'; + } + } + + /** + * Function renders js_script for inclusion into an header of a html file + * + * @return string - js_script for CodeMirror + */ + public function renderScript() { + // if editor is disabled, there is no need to render this script + if ($this->_activated == false) { + return ''; + } + + // if external js file for editor should be included, do this here + $js = ''; + if ($this->_addScript) { + $conPath = $this->_cfg['path']['contenido_fullhtml']; + $path = $conPath . 'external/codemirror/'; + + $language = $this->_language; + if (!file_exists($this->_cfg['path']['contenido'] . 'external/codemirror/lib/lang/' . $language . '.js')) { + $language = 'en'; + } + + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= $this->_getSyntaxScripts(); + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + $js .= '' . PHP_EOL; + } + + // define template for CodeMirror script + $js .= << +(function(Con, $) { + $(function() { + if (!$('#{ID}')[0]) { + // Node is missing, nothing to initialize here... + return; + } + Con.CodeMirrorHelper.init('{ID}', { + extraKeys: { + 'F11': function() { + Con.CodeMirrorHelper.toggleFullscreenEditor('{ID}'); + }, + 'Esc': function() { + Con.CodeMirrorHelper.toggleFullscreenEditor('{ID}'); + } + } + {PROPERTIES} + }); + }); +})(Con, Con.$); + +JS; + + $this->setProperty('mode', $this->_getSyntaxName(), false); + $this->setProperty('theme', 'default ' . $this->_textareaId, false); + + // get all stored properties and convert it in order to insert it into + // CodeMirror js template + $properties = ''; + foreach ($this->_properties as $property) { + if ($property['is_numeric'] == true) { + $properties .= ', ' . $property['name'] . ': ' . $property['value']; + } else { + $properties .= ', ' . $property['name'] . ': "' . $property['value'] . '"'; + } + } + + // fill js template + $textareaId = $this->_textareaId; + $jsResult = str_replace('{ID}', $textareaId, $js); + $jsResult = str_replace('{PROPERTIES}', $properties, $jsResult); + + return $jsResult; + } + +} diff --git a/conlite/external/codemirror/keymap/emacs.js b/conlite/external/codemirror/keymap/emacs.js new file mode 100644 index 0000000..2a57e2f --- /dev/null +++ b/conlite/external/codemirror/keymap/emacs.js @@ -0,0 +1,29 @@ +// TODO number prefixes +(function() { + // Really primitive kill-ring implementation. + var killRing = []; + function addToRing(str) { + killRing.push(str); + if (killRing.length > 50) killRing.shift(); + } + function getFromRing() { return killRing[killRing.length - 1] || ""; } + function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); } + + CodeMirror.keyMap.emacs = { + "Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");}, + "Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, + "Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, + "Alt-W": function(cm) {addToRing(cm.getSelection());}, + "Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());}, + "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());}, + "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", + "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace", + "Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete", + fallthrough: ["basic", "emacsy"] + }; + + CodeMirror.keyMap["emacs-Ctrl-X"] = { + "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close", + auto: "emacs", nofallthrough: true + }; +})(); diff --git a/conlite/external/codemirror/keymap/vim.js b/conlite/external/codemirror/keymap/vim.js new file mode 100644 index 0000000..51876d9 --- /dev/null +++ b/conlite/external/codemirror/keymap/vim.js @@ -0,0 +1,785 @@ +// Supported keybindings: +// +// Cursor movement: +// h, j, k, l +// e, E, w, W, b, B +// Ctrl-f, Ctrl-b +// Ctrl-n, Ctrl-p +// $, ^, 0 +// G +// ge, gE +// gg +// f, F, t, T +// Ctrl-o, Ctrl-i TODO (FIXME - Ctrl-O wont work in Chrome) +// /, ?, n, N TODO (does not work) +// #, * TODO +// +// Entering insert mode: +// i, I, a, A, o, O +// s +// ce, cb (without support for number of actions like c3e - TODO) +// cc +// S, C TODO +// cf, cF, ct, cT +// +// Deleting text: +// x, X +// J +// dd, D +// de, db (without support for number of actions like d3e - TODO) +// df, dF, dt, dT +// +// Yanking and pasting: +// yy, Y +// p, P +// p' TODO - test +// y' TODO - test +// m TODO - test +// +// Changing text in place: +// ~ +// r +// +// Visual mode: +// v, V TODO +// +// Misc: +// . TODO +// + +(function() { + var count = ""; + var sdir = "f"; + var buf = ""; + var yank = 0; + var mark = []; + var reptTimes = 0; + function emptyBuffer() { buf = ""; } + function pushInBuffer(str) { buf += str; } + function pushCountDigit(digit) { return function(cm) {count += digit;}; } + function popCount() { var i = parseInt(count, 10); count = ""; return i || 1; } + function iterTimes(func) { + for (var i = 0, c = popCount(); i < c; ++i) func(i, i == c - 1); + } + function countTimes(func) { + if (typeof func == "string") func = CodeMirror.commands[func]; + return function(cm) { iterTimes(function () { func(cm); }); }; + } + + function iterObj(o, f) { + for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]); + } + function iterList(l, f) { + for (var i in l) f(l[i]); + } + function toLetter(ch) { + // T -> t, Shift-T -> T, '*' -> *, "Space" -> " " + if (ch.slice(0, 6) == "Shift-") { + return ch.slice(0, 1); + } else { + if (ch == "Space") return " "; + if (ch.length == 3 && ch[0] == "'" && ch[2] == "'") return ch[1]; + return ch.toLowerCase(); + } + } + var SPECIAL_SYMBOLS = "~`!@#$%^&*()_-+=[{}]\\|/?.,<>:;\"\'1234567890"; + function toCombo(ch) { + // t -> T, T -> Shift-T, * -> '*', " " -> "Space" + if (ch == " ") return "Space"; + var specialIdx = SPECIAL_SYMBOLS.indexOf(ch); + if (specialIdx != -1) return "'" + ch + "'"; + if (ch.toLowerCase() == ch) return ch.toUpperCase(); + return "Shift-" + ch.toUpperCase(); + } + + var word = [/\w/, /[^\w\s]/], bigWord = [/\S/]; + function findWord(line, pos, dir, regexps) { + var stop = 0, next = -1; + if (dir > 0) { stop = line.length; next = 0; } + var start = stop, end = stop; + // Find bounds of next one. + outer: for (; pos != stop; pos += dir) { + for (var i = 0; i < regexps.length; ++i) { + if (regexps[i].test(line.charAt(pos + next))) { + start = pos; + for (; pos != stop; pos += dir) { + if (!regexps[i].test(line.charAt(pos + next))) break; + } + end = pos; + break outer; + } + } + } + return {from: Math.min(start, end), to: Math.max(start, end)}; + } + function moveToWord(cm, regexps, dir, times, where) { + var cur = cm.getCursor(); + + for (var i = 0; i < times; i++) { + var line = cm.getLine(cur.line), startCh = cur.ch, word; + while (true) { + // If we're at start/end of line, start on prev/next respectivly + if (cur.ch == line.length && dir > 0) { + cur.line++; + cur.ch = 0; + line = cm.getLine(cur.line); + } else if (cur.ch == 0 && dir < 0) { + cur.line--; + cur.ch = line.length; + line = cm.getLine(cur.line); + } + if (!line) break; + + // On to the actual searching + word = findWord(line, cur.ch, dir, regexps); + cur.ch = word[where == "end" ? "to" : "from"]; + if (startCh == cur.ch && word.from != word.to) cur.ch = word[dir < 0 ? "from" : "to"]; + else break; + } + } + return cur; + } + function joinLineNext(cm) { + var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line); + CodeMirror.commands.goLineEnd(cm); + if (cur.line != cm.lineCount()) { + CodeMirror.commands.goLineEnd(cm); + cm.replaceSelection(" ", "end"); + CodeMirror.commands.delCharRight(cm); + } + } + function delTillMark(cm, cHar) { + var i = mark[cHar]; + if (i === undefined) { + // console.log("Mark not set"); // TODO - show in status bar + return; + } + var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l; + cm.setCursor(start); + for (var c = start; c <= end; c++) { + pushInBuffer("\n"+cm.getLine(start)); + cm.removeLine(start); + } + } + function yankTillMark(cm, cHar) { + var i = mark[cHar]; + if (i === undefined) { + // console.log("Mark not set"); // TODO - show in status bar + return; + } + var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l; + for (var c = start; c <= end; c++) { + pushInBuffer("\n"+cm.getLine(c)); + } + cm.setCursor(start); + } + function goLineStartText(cm) { + // Go to the start of the line where the text begins, or the end for whitespace-only lines + var cur = cm.getCursor(), firstNonWS = cm.getLine(cur.line).search(/\S/); + cm.setCursor(cur.line, firstNonWS == -1 ? line.length : firstNonWS, true); + } + + function charIdxInLine(cm, cHar, motion_options) { + // Search for cHar in line. + // motion_options: {forward, inclusive} + // If inclusive = true, include it too. + // If forward = true, search forward, else search backwards. + // If char is not found on this line, do nothing + var cur = cm.getCursor(), line = cm.getLine(cur.line), idx; + var ch = toLetter(cHar), mo = motion_options; + if (mo.forward) { + idx = line.indexOf(ch, cur.ch + 1); + if (idx != -1 && mo.inclusive) idx += 1; + } else { + idx = line.lastIndexOf(ch, cur.ch); + if (idx != -1 && !mo.inclusive) idx += 1; + } + return idx; + } + + function moveTillChar(cm, cHar, motion_options) { + // Move to cHar in line, as found by charIdxInLine. + var idx = charIdxInLine(cm, cHar, motion_options), cur = cm.getCursor(); + if (idx != -1) cm.setCursor({line: cur.line, ch: idx}); + } + + function delTillChar(cm, cHar, motion_options) { + // delete text in this line, untill cHar is met, + // as found by charIdxInLine. + // If char is not found on this line, do nothing + var idx = charIdxInLine(cm, cHar, motion_options); + var cur = cm.getCursor(); + if (idx !== -1) { + if (motion_options.forward) { + cm.replaceRange("", {line: cur.line, ch: cur.ch}, {line: cur.line, ch: idx}); + } else { + cm.replaceRange("", {line: cur.line, ch: idx}, {line: cur.line, ch: cur.ch}); + } + } + } + + function enterInsertMode(cm) { + // enter insert mode: switch mode and cursor + popCount(); + cm.setOption("keyMap", "vim-insert"); + } + + function dialog(cm, text, shortText, f) { + if (cm.openDialog) cm.openDialog(text, f); + else f(prompt(shortText, "")); + } + function showAlert(cm, text) { + if (cm.openDialog) cm.openDialog(CodeMirror.htmlEscape(text) + " "); + else alert(text); + } + + // main keymap + var map = CodeMirror.keyMap.vim = { + // Pipe (|); TODO: should be *screen* chars, so need a util function to turn tabs into spaces? + "'|'": function(cm) { + cm.setCursor(cm.getCursor().line, popCount() - 1, true); + }, + "A": function(cm) { + cm.setCursor(cm.getCursor().line, cm.getCursor().ch+1, true); + enterInsertMode(cm); + }, + "Shift-A": function(cm) { CodeMirror.commands.goLineEnd(cm); enterInsertMode(cm);}, + "I": function(cm) { enterInsertMode(cm);}, + "Shift-I": function(cm) { goLineStartText(cm); enterInsertMode(cm);}, + "O": function(cm) { + CodeMirror.commands.goLineEnd(cm); + CodeMirror.commands.newlineAndIndent(cm); + enterInsertMode(cm); + }, + "Shift-O": function(cm) { + CodeMirror.commands.goLineStart(cm); + cm.replaceSelection("\n", "start"); + cm.indentLine(cm.getCursor().line); + enterInsertMode(cm); + }, + "G": function(cm) { cm.setOption("keyMap", "vim-prefix-g");}, + "Shift-D": function(cm) { + // commented out verions works, but I left original, cause maybe + // I don't know vim enouth to see what it does + /* var cur = cm.getCursor(); + var f = {line: cur.line, ch: cur.ch}, t = {line: cur.line}; + pushInBuffer(cm.getRange(f, t)); + */ + emptyBuffer(); + mark["Shift-D"] = cm.getCursor(false).line; + cm.setCursor(cm.getCursor(true).line); + delTillMark(cm,"Shift-D"); mark = []; + }, + + "S": function (cm) { + countTimes(function (_cm) { + CodeMirror.commands.delCharRight(_cm); + })(cm); + enterInsertMode(cm); + }, + "M": function(cm) {cm.setOption("keyMap", "vim-prefix-m"); mark = [];}, + "Y": function(cm) {cm.setOption("keyMap", "vim-prefix-y"); emptyBuffer(); yank = 0;}, + "Shift-Y": function(cm) { + emptyBuffer(); + mark["Shift-D"] = cm.getCursor(false).line; + cm.setCursor(cm.getCursor(true).line); + yankTillMark(cm,"Shift-D"); mark = []; + }, + "/": function(cm) {var f = CodeMirror.commands.find; f && f(cm); sdir = "f";}, + "'?'": function(cm) { + var f = CodeMirror.commands.find; + if (f) { f(cm); CodeMirror.commands.findPrev(cm); sdir = "r"; } + }, + "N": function(cm) { + var fn = CodeMirror.commands.findNext; + if (fn) sdir != "r" ? fn(cm) : CodeMirror.commands.findPrev(cm); + }, + "Shift-N": function(cm) { + var fn = CodeMirror.commands.findNext; + if (fn) sdir != "r" ? CodeMirror.commands.findPrev(cm) : fn.findNext(cm); + }, + "Shift-G": function(cm) { + count == "" ? cm.setCursor(cm.lineCount()) : cm.setCursor(parseInt(count, 10)-1); + popCount(); + CodeMirror.commands.goLineStart(cm); + }, + "':'": function(cm) { + var exModeDialog = ': '; + dialog(cm, exModeDialog, ':', function(command) { + if (command.match(/^\d+$/)) { + cm.setCursor(command - 1, cm.getCursor().ch); + } else { + showAlert(cm, "Bad command: " + command); + } + }); + }, + nofallthrough: true, style: "fat-cursor" + }; + + // standard mode switching + iterList(["d", "t", "T", "f", "F", "c", "r"], + function (ch) { + CodeMirror.keyMap.vim[toCombo(ch)] = function (cm) { + cm.setOption("keyMap", "vim-prefix-" + ch); + emptyBuffer(); + }; + }); + + function addCountBindings(keyMap) { + // Add bindings for number keys + keyMap["0"] = function(cm) { + count.length > 0 ? pushCountDigit("0")(cm) : CodeMirror.commands.goLineStart(cm); + }; + for (var i = 1; i < 10; ++i) keyMap[i] = pushCountDigit(i); + } + addCountBindings(CodeMirror.keyMap.vim); + + // main num keymap + // Add bindings that are influenced by number keys + iterObj({ + "Left": "goColumnLeft", "Right": "goColumnRight", + "Down": "goLineDown", "Up": "goLineUp", "Backspace": "goCharLeft", + "Space": "goCharRight", + "X": function(cm) {CodeMirror.commands.delCharRight(cm);}, + "P": function(cm) { + var cur = cm.getCursor().line; + if (buf!= "") { + if (buf[0] == "\n") CodeMirror.commands.goLineEnd(cm); + cm.replaceRange(buf, cm.getCursor()); + } + }, + "Shift-X": function(cm) {CodeMirror.commands.delCharLeft(cm);}, + "Shift-J": function(cm) {joinLineNext(cm);}, + "Shift-P": function(cm) { + var cur = cm.getCursor().line; + if (buf!= "") { + CodeMirror.commands.goLineUp(cm); + CodeMirror.commands.goLineEnd(cm); + cm.replaceSelection(buf, "end"); + } + cm.setCursor(cur+1); + }, + "'~'": function(cm) { + var cur = cm.getCursor(), cHar = cm.getRange({line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1}); + cHar = cHar != cHar.toLowerCase() ? cHar.toLowerCase() : cHar.toUpperCase(); + cm.replaceRange(cHar, {line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1}); + cm.setCursor(cur.line, cur.ch+1); + }, + "Ctrl-B": function(cm) {CodeMirror.commands.goPageUp(cm);}, + "Ctrl-F": function(cm) {CodeMirror.commands.goPageDown(cm);}, + "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", + "U": "undo", "Ctrl-R": "redo" + }, function(key, cmd) { map[key] = countTimes(cmd); }); + + // empty key maps + iterList([ + "vim-prefix-d'", + "vim-prefix-y'", + "vim-prefix-df", + "vim-prefix-dF", + "vim-prefix-dt", + "vim-prefix-dT", + "vim-prefix-c", + "vim-prefix-cf", + "vim-prefix-cF", + "vim-prefix-ct", + "vim-prefix-cT", + "vim-prefix-", + "vim-prefix-f", + "vim-prefix-F", + "vim-prefix-t", + "vim-prefix-T", + "vim-prefix-r", + "vim-prefix-m" + ], + function (prefix) { + CodeMirror.keyMap[prefix] = { + auto: "vim", + nofallthrough: true, + style: "fat-cursor" + }; + }); + + CodeMirror.keyMap["vim-prefix-g"] = { + "E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, word, -1, 1, "start"));}), + "Shift-E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, bigWord, -1, 1, "start"));}), + "G": function (cm) { cm.setCursor({line: 0, ch: cm.getCursor().ch});}, + auto: "vim", nofallthrough: true, style: "fat-cursor" + }; + + CodeMirror.keyMap["vim-prefix-d"] = { + "D": countTimes(function(cm) { + pushInBuffer("\n"+cm.getLine(cm.getCursor().line)); + cm.removeLine(cm.getCursor().line); + cm.setOption("keyMap", "vim"); + }), + "'": function(cm) { + cm.setOption("keyMap", "vim-prefix-d'"); + emptyBuffer(); + }, + "B": function(cm) { + var cur = cm.getCursor(); + var line = cm.getLine(cur.line); + var index = line.lastIndexOf(" ", cur.ch); + + pushInBuffer(line.substring(index, cur.ch)); + cm.replaceRange("", {line: cur.line, ch: index}, cur); + cm.setOption("keyMap", "vim"); + }, + nofallthrough: true, style: "fat-cursor" + }; + // FIXME - does not work for bindings like "d3e" + addCountBindings(CodeMirror.keyMap["vim-prefix-d"]); + + CodeMirror.keyMap["vim-prefix-c"] = { + "B": function (cm) { + countTimes("delWordLeft")(cm); + enterInsertMode(cm); + }, + "C": function (cm) { + iterTimes(function (i, last) { + CodeMirror.commands.deleteLine(cm); + if (i) { + CodeMirror.commands.delCharRight(cm); + if (last) CodeMirror.commands.deleteLine(cm); + } + }); + enterInsertMode(cm); + }, + nofallthrough: true, style: "fat-cursor" + }; + + iterList(["vim-prefix-d", "vim-prefix-c", "vim-prefix-"], function (prefix) { + iterList(["f", "F", "T", "t"], + function (ch) { + CodeMirror.keyMap[prefix][toCombo(ch)] = function (cm) { + cm.setOption("keyMap", prefix + ch); + emptyBuffer(); + }; + }); + }); + + var MOTION_OPTIONS = { + "t": {inclusive: false, forward: true}, + "f": {inclusive: true, forward: true}, + "T": {inclusive: false, forward: false}, + "F": {inclusive: true, forward: false} + }; + + function setupPrefixBindingForKey(m) { + CodeMirror.keyMap["vim-prefix-m"][m] = function(cm) { + mark[m] = cm.getCursor().line; + }; + CodeMirror.keyMap["vim-prefix-d'"][m] = function(cm) { + delTillMark(cm,m); + }; + CodeMirror.keyMap["vim-prefix-y'"][m] = function(cm) { + yankTillMark(cm,m); + }; + CodeMirror.keyMap["vim-prefix-r"][m] = function (cm) { + var cur = cm.getCursor(); + cm.replaceRange(toLetter(m), + {line: cur.line, ch: cur.ch}, + {line: cur.line, ch: cur.ch + 1}); + CodeMirror.commands.goColumnLeft(cm); + }; + // all commands, related to motions till char in line + iterObj(MOTION_OPTIONS, function (ch, options) { + CodeMirror.keyMap["vim-prefix-" + ch][m] = function(cm) { + moveTillChar(cm, m, options); + }; + CodeMirror.keyMap["vim-prefix-d" + ch][m] = function(cm) { + delTillChar(cm, m, options); + }; + CodeMirror.keyMap["vim-prefix-c" + ch][m] = function(cm) { + delTillChar(cm, m, options); + enterInsertMode(cm); + }; + }); + } + for (var i = 65; i < 65 + 26; i++) { // uppercase alphabet char codes + var ch = String.fromCharCode(i); + setupPrefixBindingForKey(toCombo(ch)); + setupPrefixBindingForKey(toCombo(ch.toLowerCase())); + } + iterList(SPECIAL_SYMBOLS, function (ch) { + setupPrefixBindingForKey(toCombo(ch)); + }); + setupPrefixBindingForKey("Space"); + + CodeMirror.keyMap["vim-prefix-y"] = { + "Y": countTimes(function(cm) { pushInBuffer("\n"+cm.getLine(cm.getCursor().line+yank)); yank++; }), + "'": function(cm) {cm.setOption("keyMap", "vim-prefix-y'"); emptyBuffer();}, + nofallthrough: true, style: "fat-cursor" + }; + + CodeMirror.keyMap["vim-insert"] = { + // TODO: override navigation keys so that Esc will cancel automatic indentation from o, O, i_ + "Esc": function(cm) { + cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1, true); + cm.setOption("keyMap", "vim"); + }, + "Ctrl-N": "autocomplete", + "Ctrl-P": "autocomplete", + fallthrough: ["default"] + }; + + function findMatchedSymbol(cm, cur, symb) { + var line = cur.line; + var symb = symb ? symb : cm.getLine(line)[cur.ch]; + + // Are we at the opening or closing char + var forwards = ['(', '[', '{'].indexOf(symb) != -1; + + var reverseSymb = (function(sym) { + switch (sym) { + case '(' : return ')'; + case '[' : return ']'; + case '{' : return '}'; + case ')' : return '('; + case ']' : return '['; + case '}' : return '{'; + default : return null; + } + })(symb); + + // Couldn't find a matching symbol, abort + if (reverseSymb == null) return cur; + + // Tracking our imbalance in open/closing symbols. An opening symbol wii be + // the first thing we pick up if moving forward, this isn't true moving backwards + var disBal = forwards ? 0 : 1; + + while (true) { + if (line == cur.line) { + // First pass, do some special stuff + var currLine = forwards ? cm.getLine(line).substr(cur.ch).split('') : cm.getLine(line).substr(0,cur.ch).split('').reverse(); + } else { + var currLine = forwards ? cm.getLine(line).split('') : cm.getLine(line).split('').reverse(); + } + + for (var index = 0; index < currLine.length; index++) { + if (currLine[index] == symb) disBal++; + else if (currLine[index] == reverseSymb) disBal--; + + if (disBal == 0) { + if (forwards && cur.line == line) return {line: line, ch: index + cur.ch}; + else if (forwards) return {line: line, ch: index}; + else return {line: line, ch: currLine.length - index - 1 }; + } + } + + if (forwards) line++; + else line--; + } + } + + function selectCompanionObject(cm, revSymb, inclusive) { + var cur = cm.getCursor(); + + var end = findMatchedSymbol(cm, cur, revSymb); + var start = findMatchedSymbol(cm, end); + start.ch += inclusive ? 1 : 0; + end.ch += inclusive ? 0 : 1; + + return {start: start, end: end}; + } + + // These are our motion commands to be used for navigation and selection with + // certian other commands. All should return a cursor object. + var motionList = ['B', 'E', 'J', 'K', 'H', 'L', 'W', 'Shift-W', "'^'", "'$'", "'%'", 'Esc']; + + motions = { + 'B': function(cm, times) { return moveToWord(cm, word, -1, times); }, + 'Shift-B': function(cm, times) { return moveToWord(cm, bigWord, -1, times); }, + 'E': function(cm, times) { return moveToWord(cm, word, 1, times, 'end'); }, + 'Shift-E': function(cm, times) { return moveToWord(cm, bigWord, 1, times, 'end'); }, + 'J': function(cm, times) { + var cur = cm.getCursor(); + return {line: cur.line+times, ch : cur.ch}; + }, + + 'K': function(cm, times) { + var cur = cm.getCursor(); + return {line: cur.line-times, ch: cur.ch}; + }, + + 'H': function(cm, times) { + var cur = cm.getCursor(); + return {line: cur.line, ch: cur.ch-times}; + }, + + 'L': function(cm, times) { + var cur = cm.getCursor(); + return {line: cur.line, ch: cur.ch+times}; + }, + 'W': function(cm, times) { return moveToWord(cm, word, 1, times); }, + 'Shift-W': function(cm, times) { return moveToWord(cm, bigWord, 1, times); }, + "'^'": function(cm, times) { + var cur = cm.getCursor(); + var line = cm.getLine(cur.line).split(''); + + // Empty line :o + if (line.length == 0) return cur; + + for (var index = 0; index < line.length; index++) { + if (line[index].match(/[^\s]/)) return {line: cur.line, ch: index}; + } + }, + "'$'": function(cm) { + var cur = cm.getCursor(); + var line = cm.getLine(cur.line); + return {line: cur.line, ch: line.length}; + }, + "'%'": function(cm) { return findMatchedSymbol(cm, cm.getCursor()); }, + "Esc" : function(cm) { + cm.setOption('vim'); + reptTimes = 0; + + return cm.getCursor(); + } + }; + + // Map our movement actions each operator and non-operational movement + motionList.forEach(function(key, index, array) { + CodeMirror.keyMap['vim-prefix-d'][key] = function(cm) { + // Get our selected range + var start = cm.getCursor(); + var end = motions[key](cm, reptTimes ? reptTimes : 1); + + // Set swap var if range is of negative length + if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true; + + // Take action, switching start and end if swap var is set + pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end)); + cm.replaceRange("", swap ? end : start, swap ? start : end); + + // And clean up + reptTimes = 0; + cm.setOption("keyMap", "vim"); + }; + + CodeMirror.keyMap['vim-prefix-c'][key] = function(cm) { + var start = cm.getCursor(); + var end = motions[key](cm, reptTimes ? reptTimes : 1); + + if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true; + pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end)); + cm.replaceRange("", swap ? end : start, swap ? start : end); + + reptTimes = 0; + cm.setOption('keyMap', 'vim-insert'); + }; + + CodeMirror.keyMap['vim-prefix-y'][key] = function(cm) { + var start = cm.getCursor(); + var end = motions[key](cm, reptTimes ? reptTimes : 1); + + if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true; + pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end)); + + reptTimes = 0; + cm.setOption("keyMap", "vim"); + }; + + CodeMirror.keyMap['vim'][key] = function(cm) { + var cur = motions[key](cm, reptTimes ? reptTimes : 1); + cm.setCursor(cur.line, cur.ch); + + reptTimes = 0; + }; + }); + + var nums = [1,2,3,4,5,6,7,8,9]; + nums.forEach(function(key, index, array) { + CodeMirror.keyMap['vim'][key] = function (cm) { + reptTimes = (reptTimes * 10) + key; + }; + CodeMirror.keyMap['vim-prefix-d'][key] = function (cm) { + reptTimes = (reptTimes * 10) + key; + }; + CodeMirror.keyMap['vim-prefix-y'][key] = function (cm) { + reptTimes = (reptTimes * 10) + key; + }; + CodeMirror.keyMap['vim-prefix-c'][key] = function (cm) { + reptTimes = (reptTimes * 10) + key; + }; + }); + + // Create our keymaps for each operator and make xa and xi where x is an operator + // change to the corrosponding keymap + var operators = ['d', 'y', 'c']; + operators.forEach(function(key, index, array) { + CodeMirror.keyMap['vim-prefix-'+key+'a'] = { + auto: 'vim', nofallthrough: true, style: "fat-cursor" + }; + CodeMirror.keyMap['vim-prefix-'+key+'i'] = { + auto: 'vim', nofallthrough: true, style: "fat-cursor" + }; + + CodeMirror.keyMap['vim-prefix-'+key]['A'] = function(cm) { + reptTimes = 0; + cm.setOption('keyMap', 'vim-prefix-' + key + 'a'); + }; + + CodeMirror.keyMap['vim-prefix-'+key]['I'] = function(cm) { + reptTimes = 0; + cm.setOption('keyMap', 'vim-prefix-' + key + 'i'); + }; + }); + + function regexLastIndexOf(string, pattern, startIndex) { + for (var i = startIndex == null ? string.length : startIndex; i >= 0; --i) + if (pattern.test(string.charAt(i))) return i; + return -1; + } + + // Create our text object functions. They work similar to motions but they + // return a start cursor as well + var textObjectList = ['W', 'Shift-[', 'Shift-9', '[']; + var textObjects = { + 'W': function(cm, inclusive) { + var cur = cm.getCursor(); + var line = cm.getLine(cur.line); + + var line_to_char = new String(line.substring(0, cur.ch)); + var start = regexLastIndexOf(line_to_char, /[^a-zA-Z0-9]/) + 1; + var end = motions["E"](cm, 1) ; + + end.ch += inclusive ? 1 : 0 ; + return {start: {line: cur.line, ch: start}, end: end }; + }, + 'Shift-[': function(cm, inclusive) { return selectCompanionObject(cm, '}', inclusive); }, + 'Shift-9': function(cm, inclusive) { return selectCompanionObject(cm, ')', inclusive); }, + '[': function(cm, inclusive) { return selectCompanionObject(cm, ']', inclusive); } + }; + + // One function to handle all operation upon text objects. Kinda funky but it works + // better than rewriting this code six times + function textObjectManipulation(cm, object, remove, insert, inclusive) { + // Object is the text object, delete object if remove is true, enter insert + // mode if insert is true, inclusive is the difference between a and i + var tmp = textObjects[object](cm, inclusive); + var start = tmp.start; + var end = tmp.end; + + if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true ; + + pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end)); + if (remove) cm.replaceRange("", swap ? end : start, swap ? start : end); + if (insert) cm.setOption('keyMap', 'vim-insert'); + } + + // And finally build the keymaps up from the text objects + for (var i = 0; i < textObjectList.length; ++i) { + var object = textObjectList[i]; + (function(object) { + CodeMirror.keyMap['vim-prefix-di'][object] = function(cm) { textObjectManipulation(cm, object, true, false, false); }; + CodeMirror.keyMap['vim-prefix-da'][object] = function(cm) { textObjectManipulation(cm, object, true, false, true); }; + CodeMirror.keyMap['vim-prefix-yi'][object] = function(cm) { textObjectManipulation(cm, object, false, false, false); }; + CodeMirror.keyMap['vim-prefix-ya'][object] = function(cm) { textObjectManipulation(cm, object, false, false, true); }; + CodeMirror.keyMap['vim-prefix-ci'][object] = function(cm) { textObjectManipulation(cm, object, true, true, false); }; + CodeMirror.keyMap['vim-prefix-ca'][object] = function(cm) { textObjectManipulation(cm, object, true, true, true); }; + })(object) + } +})(); diff --git a/conlite/external/codemirror/lib/codemirror.css b/conlite/external/codemirror/lib/codemirror.css new file mode 100644 index 0000000..fb5b6d5 --- /dev/null +++ b/conlite/external/codemirror/lib/codemirror.css @@ -0,0 +1,169 @@ +.CodeMirror { + line-height: 1em; + font-family: monospace; + + /* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */ + position: relative; + /* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */ + overflow: hidden; +} + +.CodeMirror-scroll { + overflow-x: auto; + overflow-y: hidden; + height: 300px; + /* This is needed to prevent an IE[67] bug where the scrolled content + is visible outside of the scrolling box. */ + position: relative; + outline: none; +} + +/* Vertical scrollbar */ +.CodeMirror-scrollbar { + float: right; + overflow-x: hidden; + overflow-y: scroll; + + /* This corrects for the 1px gap introduced to the left of the scrollbar + by the rule for .CodeMirror-scrollbar-inner. */ + margin-left: -1px; +} +.CodeMirror-scrollbar-inner { + /* This needs to have a nonzero width in order for the scrollbar to appear + in Firefox and IE9. */ + width: 1px; +} +.CodeMirror-scrollbar.cm-sb-overlap { + /* Ensure that the scrollbar appears in Lion, and that it overlaps the content + rather than sitting to the right of it. */ + position: absolute; + z-index: 1; + float: none; + right: 0; + min-width: 12px; +} +.CodeMirror-scrollbar.cm-sb-nonoverlap { + min-width: 12px; +} +.CodeMirror-scrollbar.cm-sb-ie7 { + min-width: 18px; +} + +.CodeMirror-gutter { + position: absolute; left: 0; top: 0; + z-index: 10; + background-color: #f7f7f7; + border-right: 1px solid #eee; + min-width: 2em; + height: 100%; +} +.CodeMirror-gutter-text { + color: #aaa; + text-align: right; + padding: .4em .2em .4em .4em; + white-space: pre !important; + cursor: default; +} +.CodeMirror-lines { + padding: .4em; + white-space: pre; + cursor: text; +} +.CodeMirror-lines * { + /* Necessary for throw-scrolling to decelerate properly on Safari. */ + pointer-events: none; +} + +.CodeMirror pre { + -moz-border-radius: 0; + -webkit-border-radius: 0; + -o-border-radius: 0; + border-radius: 0; + border-width: 0; margin: 0; padding: 0; background: transparent; + font-family: inherit; + font-size: inherit; + padding: 0; margin: 0; + white-space: pre; + word-wrap: normal; + line-height: inherit; + color: inherit; +} + +.CodeMirror-wrap pre { + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; +} +.CodeMirror-wrap .CodeMirror-scroll { + overflow-x: hidden; +} + +.CodeMirror textarea { + outline: none !important; +} + +.CodeMirror pre.CodeMirror-cursor { + z-index: 10; + position: absolute; + visibility: hidden; + border-left: 1px solid black; + border-right: none; + width: 0; +} +.cm-keymap-fat-cursor pre.CodeMirror-cursor { + width: auto; + border: 0; + background: transparent; + background: rgba(0, 200, 0, .4); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800); +} +/* Kludge to turn off filter in ie9+, which also accepts rgba */ +.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) { + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); +} +.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {} +.CodeMirror-focused pre.CodeMirror-cursor { + visibility: visible; +} + +div.CodeMirror-selected { background: #d9d9d9; } +.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; } + +.CodeMirror-searching { + background: #ffa; + background: rgba(255, 255, 0, .4); +} + +/* Default theme */ + +.cm-s-default span.cm-keyword {color: #708;} +.cm-s-default span.cm-atom {color: #219;} +.cm-s-default span.cm-number {color: #164;} +.cm-s-default span.cm-def {color: #00f;} +.cm-s-default span.cm-variable {color: black;} +.cm-s-default span.cm-variable-2 {color: #05a;} +.cm-s-default span.cm-variable-3 {color: #085;} +.cm-s-default span.cm-property {color: black;} +.cm-s-default span.cm-operator {color: black;} +.cm-s-default span.cm-comment {color: #a50;} +.cm-s-default span.cm-string {color: #a11;} +.cm-s-default span.cm-string-2 {color: #f50;} +.cm-s-default span.cm-meta {color: #555;} +.cm-s-default span.cm-error {color: #f00;} +.cm-s-default span.cm-qualifier {color: #555;} +.cm-s-default span.cm-builtin {color: #30a;} +.cm-s-default span.cm-bracket {color: #cc7;} +.cm-s-default span.cm-tag {color: #170;} +.cm-s-default span.cm-attribute {color: #00c;} +.cm-s-default span.cm-header {color: blue;} +.cm-s-default span.cm-quote {color: #090;} +.cm-s-default span.cm-hr {color: #999;} +.cm-s-default span.cm-link {color: #00c;} + +span.cm-header, span.cm-strong {font-weight: bold;} +span.cm-em {font-style: italic;} +span.cm-emstrong {font-style: italic; font-weight: bold;} +span.cm-link {text-decoration: underline;} + +div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} +div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} diff --git a/conlite/external/codemirror/lib/codemirror.js b/conlite/external/codemirror/lib/codemirror.js new file mode 100644 index 0000000..d8650f3 --- /dev/null +++ b/conlite/external/codemirror/lib/codemirror.js @@ -0,0 +1,3232 @@ +// CodeMirror version 2.32 +// +// All functions that need access to the editor's state live inside +// the CodeMirror function. Below that, at the bottom of the file, +// some utilities are defined. + +// CodeMirror is the only global var we claim +var CodeMirror = (function() { + // This is the function that produces an editor instance. Its + // closure is used to store the editor state. + function CodeMirror(place, givenOptions) { + // Determine effective options based on given values and defaults. + var options = {}, defaults = CodeMirror.defaults; + for (var opt in defaults) + if (defaults.hasOwnProperty(opt)) + options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt]; + + // The element in which the editor lives. + var wrapper = document.createElement("div"); + wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : ""); + // This mess creates the base DOM structure for the editor. + wrapper.innerHTML = + '
' + // Wraps and hides input textarea + '
' + + '
' + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself. + '
' + // The empty scrollbar content, used solely for managing the scrollbar thumb. + '
' + // This must be before the scroll area because it's float-right. + '
' + + '
' + // Set to the height of the text, causes scrolling + '
' + // Moved around its parent to cover visible view + '
' + + // Provides positioning relative to (visible) text origin + '
' + + // Used to measure text size + '
' + + '
 
' + // Absolutely positioned blinky cursor + '' + // Used to force a width + '
' + // DIVs containing the selection and the actual code + '
'; + if (place.appendChild) place.appendChild(wrapper); else place(wrapper); + // I've never seen more elegant code in my life. + var inputDiv = wrapper.firstChild, input = inputDiv.firstChild, + scroller = wrapper.lastChild, code = scroller.firstChild, + mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild, + lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild, + cursor = measure.nextSibling, widthForcer = cursor.nextSibling, + selectionDiv = widthForcer.nextSibling, lineDiv = selectionDiv.nextSibling, + scrollbar = inputDiv.nextSibling, scrollbarInner = scrollbar.firstChild; + themeChanged(); keyMapChanged(); + // Needed to hide big blue blinking cursor on Mobile Safari + if (ios) input.style.width = "0px"; + if (!webkit) scroller.draggable = true; + lineSpace.style.outline = "none"; + if (options.tabindex != null) input.tabIndex = options.tabindex; + if (options.autofocus) focusInput(); + if (!options.gutter && !options.lineNumbers) gutter.style.display = "none"; + // Needed to handle Tab key in KHTML + if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute"; + + // Check for OS X >= 10.7. If so, we need to force a width on the scrollbar, and + // make it overlap the content. (But we only do this if the scrollbar doesn't already + // have a natural width. If the mouse is plugged in or the user sets the system pref + // to always show scrollbars, the scrollbar shouldn't overlap.) + if (mac_geLion) { + scrollbar.className += (overlapScrollbars() ? " cm-sb-overlap" : " cm-sb-nonoverlap"); + } else if (ie_lt8) { + // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). + scrollbar.className += " cm-sb-ie7"; + } + + // Check for problem with IE innerHTML not working when we have a + // P (or similar) parent node. + try { stringWidth("x"); } + catch (e) { + if (e.message.match(/runtime/i)) + e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)"); + throw e; + } + + // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval. + var poll = new Delayed(), highlight = new Delayed(), blinker; + + // mode holds a mode API object. doc is the tree of Line objects, + // work an array of lines that should be parsed, and history the + // undo history (instance of History constructor). + var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused; + loadMode(); + // The selection. These are always maintained to point at valid + // positions. Inverted is used to remember that the user is + // selecting bottom-to-top. + var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false}; + // Selection-related flags. shiftSelecting obviously tracks + // whether the user is holding shift. + var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, lastScrollLeft = 0, draggingText, + overwrite = false, suppressEdits = false; + // Variables used by startOperation/endOperation to track what + // happened during the operation. + var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone, + gutterDirty, callbacks; + // Current visible range (may be bigger than the view window). + var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0; + // bracketHighlighted is used to remember that a bracket has been + // marked. + var bracketHighlighted; + // Tracks the maximum line length so that the horizontal scrollbar + // can be kept static when scrolling. + var maxLine = "", updateMaxLine = false, maxLineChanged = true; + var tabCache = {}; + + // Initialize the content. + operation(function(){setValue(options.value || ""); updateInput = false;})(); + var history = new History(); + + // Register our event handlers. + connect(scroller, "mousedown", operation(onMouseDown)); + connect(scroller, "dblclick", operation(onDoubleClick)); + connect(lineSpace, "selectstart", e_preventDefault); + // Gecko browsers fire contextmenu *after* opening the menu, at + // which point we can't mess with it anymore. Context menu is + // handled in onMouseDown for Gecko. + if (!gecko) connect(scroller, "contextmenu", onContextMenu); + connect(scroller, "scroll", onScroll); + connect(scrollbar, "scroll", onScroll); + connect(scrollbar, "mousedown", function() {if (focused) setTimeout(focusInput, 0);}); + connect(scroller, "mousewheel", onMouseWheel); + connect(scroller, "DOMMouseScroll", onMouseWheel); + connect(window, "resize", function() {updateDisplay(true);}); + connect(input, "keyup", operation(onKeyUp)); + connect(input, "input", fastPoll); + connect(input, "keydown", operation(onKeyDown)); + connect(input, "keypress", operation(onKeyPress)); + connect(input, "focus", onFocus); + connect(input, "blur", onBlur); + + if (options.dragDrop) { + connect(scroller, "dragstart", onDragStart); + function drag_(e) { + if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; + e_stop(e); + } + connect(scroller, "dragenter", drag_); + connect(scroller, "dragover", drag_); + connect(scroller, "drop", operation(onDrop)); + } + connect(scroller, "paste", function(){focusInput(); fastPoll();}); + connect(input, "paste", fastPoll); + connect(input, "cut", operation(function(){ + if (!options.readOnly) replaceSelection(""); + })); + + // Needed to handle Tab key in KHTML + if (khtml) connect(code, "mouseup", function() { + if (document.activeElement == input) input.blur(); + focusInput(); + }); + + // IE throws unspecified error in certain cases, when + // trying to access activeElement before onload + var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { } + if (hasFocus || options.autofocus) setTimeout(onFocus, 20); + else onBlur(); + + function isLine(l) {return l >= 0 && l < doc.size;} + // The instance object that we'll return. Mostly calls out to + // local functions in the CodeMirror function. Some do some extra + // range checking and/or clipping. operation is used to wrap the + // call so that changes it makes are tracked, and the display is + // updated afterwards. + var instance = wrapper.CodeMirror = { + getValue: getValue, + setValue: operation(setValue), + getSelection: getSelection, + replaceSelection: operation(replaceSelection), + focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();}, + setOption: function(option, value) { + var oldVal = options[option]; + options[option] = value; + if (option == "mode" || option == "indentUnit") loadMode(); + else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();} + else if (option == "readOnly" && !value) {resetInput(true);} + else if (option == "theme") themeChanged(); + else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)(); + else if (option == "tabSize") updateDisplay(true); + else if (option == "keyMap") keyMapChanged(); + if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") { + gutterChanged(); + updateDisplay(true); + } + }, + getOption: function(option) {return options[option];}, + undo: operation(undo), + redo: operation(redo), + indentLine: operation(function(n, dir) { + if (typeof dir != "string") { + if (dir == null) dir = options.smartIndent ? "smart" : "prev"; + else dir = dir ? "add" : "subtract"; + } + if (isLine(n)) indentLine(n, dir); + }), + indentSelection: operation(indentSelected), + historySize: function() {return {undo: history.done.length, redo: history.undone.length};}, + clearHistory: function() {history = new History();}, + setHistory: function(histData) { + history = new History(); + history.done = histData.done; + history.undone = histData.undone; + }, + getHistory: function() { + history.time = 0; + return {done: history.done.concat([]), undone: history.undone.concat([])}; + }, + matchBrackets: operation(function(){matchBrackets(true);}), + getTokenAt: operation(function(pos) { + pos = clipPos(pos); + return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch); + }), + getStateAfter: function(line) { + line = clipLine(line == null ? doc.size - 1: line); + return getStateBefore(line + 1); + }, + cursorCoords: function(start, mode) { + if (start == null) start = sel.inverted; + return this.charCoords(start ? sel.from : sel.to, mode); + }, + charCoords: function(pos, mode) { + pos = clipPos(pos); + if (mode == "local") return localCoords(pos, false); + if (mode == "div") return localCoords(pos, true); + return pageCoords(pos); + }, + coordsChar: function(coords) { + var off = eltOffset(lineSpace); + return coordsChar(coords.x - off.left, coords.y - off.top); + }, + markText: operation(markText), + setBookmark: setBookmark, + findMarksAt: findMarksAt, + setMarker: operation(addGutterMarker), + clearMarker: operation(removeGutterMarker), + setLineClass: operation(setLineClass), + hideLine: operation(function(h) {return setLineHidden(h, true);}), + showLine: operation(function(h) {return setLineHidden(h, false);}), + onDeleteLine: function(line, f) { + if (typeof line == "number") { + if (!isLine(line)) return null; + line = getLine(line); + } + (line.handlers || (line.handlers = [])).push(f); + return line; + }, + lineInfo: lineInfo, + addWidget: function(pos, node, scroll, vert, horiz) { + pos = localCoords(clipPos(pos)); + var top = pos.yBot, left = pos.x; + node.style.position = "absolute"; + code.appendChild(node); + if (vert == "over") top = pos.y; + else if (vert == "near") { + var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()), + hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft(); + if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight) + top = pos.y - node.offsetHeight; + if (left + node.offsetWidth > hspace) + left = hspace - node.offsetWidth; + } + node.style.top = (top + paddingTop()) + "px"; + node.style.left = node.style.right = ""; + if (horiz == "right") { + left = code.clientWidth - node.offsetWidth; + node.style.right = "0px"; + } else { + if (horiz == "left") left = 0; + else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2; + node.style.left = (left + paddingLeft()) + "px"; + } + if (scroll) + scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight); + }, + + lineCount: function() {return doc.size;}, + clipPos: clipPos, + getCursor: function(start) { + if (start == null) start = sel.inverted; + return copyPos(start ? sel.from : sel.to); + }, + somethingSelected: function() {return !posEq(sel.from, sel.to);}, + setCursor: operation(function(line, ch, user) { + if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user); + else setCursor(line, ch, user); + }), + setSelection: operation(function(from, to, user) { + (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from)); + }), + getLine: function(line) {if (isLine(line)) return getLine(line).text;}, + getLineHandle: function(line) {if (isLine(line)) return getLine(line);}, + setLine: operation(function(line, text) { + if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length}); + }), + removeLine: operation(function(line) { + if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0})); + }), + replaceRange: operation(replaceRange), + getRange: function(from, to, lineSep) {return getRange(clipPos(from), clipPos(to), lineSep);}, + + triggerOnKeyDown: operation(onKeyDown), + execCommand: function(cmd) {return commands[cmd](instance);}, + // Stuff used by commands, probably not much use to outside code. + moveH: operation(moveH), + deleteH: operation(deleteH), + moveV: operation(moveV), + toggleOverwrite: function() { + if(overwrite){ + overwrite = false; + cursor.className = cursor.className.replace(" CodeMirror-overwrite", ""); + } else { + overwrite = true; + cursor.className += " CodeMirror-overwrite"; + } + }, + + posFromIndex: function(off) { + var lineNo = 0, ch; + doc.iter(0, doc.size, function(line) { + var sz = line.text.length + 1; + if (sz > off) { ch = off; return true; } + off -= sz; + ++lineNo; + }); + return clipPos({line: lineNo, ch: ch}); + }, + indexFromPos: function (coords) { + if (coords.line < 0 || coords.ch < 0) return 0; + var index = coords.ch; + doc.iter(0, coords.line, function (line) { + index += line.text.length + 1; + }); + return index; + }, + scrollTo: function(x, y) { + if (x != null) scroller.scrollLeft = x; + if (y != null) scrollbar.scrollTop = y; + updateDisplay([]); + }, + getScrollInfo: function() { + return {x: scroller.scrollLeft, y: scrollbar.scrollTop, + height: scrollbar.scrollHeight, width: scroller.scrollWidth}; + }, + setSize: function(width, height) { + function interpret(val) { + val = String(val); + return /^\d+$/.test(val) ? val + "px" : val; + } + if (width != null) wrapper.style.width = interpret(width); + if (height != null) scroller.style.height = interpret(height); + }, + + operation: function(f){return operation(f)();}, + compoundChange: function(f){return compoundChange(f);}, + refresh: function(){ + updateDisplay(true, null, lastScrollTop); + if (scrollbar.scrollHeight > lastScrollTop) + scrollbar.scrollTop = lastScrollTop; + }, + getInputField: function(){return input;}, + getWrapperElement: function(){return wrapper;}, + getScrollerElement: function(){return scroller;}, + getGutterElement: function(){return gutter;} + }; + + function getLine(n) { return getLineAt(doc, n); } + function updateLineHeight(line, height) { + gutterDirty = true; + var diff = height - line.height; + for (var n = line; n; n = n.parent) n.height += diff; + } + + function setValue(code) { + var top = {line: 0, ch: 0}; + updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length}, + splitLines(code), top, top); + updateInput = true; + } + function getValue(lineSep) { + var text = []; + doc.iter(0, doc.size, function(line) { text.push(line.text); }); + return text.join(lineSep || "\n"); + } + + function onScroll(e) { + if (scroller.scrollTop) { + scrollbar.scrollTop += scroller.scrollTop; + scroller.scrollTop = 0; + } + if (lastScrollTop != scrollbar.scrollTop || lastScrollLeft != scroller.scrollLeft) { + lastScrollTop = scrollbar.scrollTop; + lastScrollLeft = scroller.scrollLeft; + updateDisplay([]); + if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px"; + if (options.onScroll) options.onScroll(instance); + } + } + + function onMouseDown(e) { + setShift(e_prop(e, "shiftKey")); + // Check whether this is a click in a widget + for (var n = e_target(e); n != wrapper; n = n.parentNode) + if (n.parentNode == code && n != mover) return; + + // See if this is a click in the gutter + for (var n = e_target(e); n != wrapper; n = n.parentNode) + if (n.parentNode == gutterText) { + if (options.onGutterClick) + options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e); + return e_preventDefault(e); + } + + var start = posFromMouse(e); + + switch (e_button(e)) { + case 3: + if (gecko) onContextMenu(e); + return; + case 2: + if (start) setCursor(start.line, start.ch, true); + setTimeout(focusInput, 20); + e_preventDefault(e); + return; + } + // For button 1, if it was clicked inside the editor + // (posFromMouse returning non-null), we have to adjust the + // selection. + if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;} + + if (!focused) onFocus(); + + var now = +new Date, type = "single"; + if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) { + type = "triple"; + e_preventDefault(e); + setTimeout(focusInput, 20); + selectLine(start.line); + } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) { + type = "double"; + lastDoubleClick = {time: now, pos: start}; + e_preventDefault(e); + var word = findWordAt(start); + setSelectionUser(word.from, word.to); + } else { lastClick = {time: now, pos: start}; } + + var last = start, going; + if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) && + !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") { + // Let the drag handler handle this. + if (webkit) scroller.draggable = true; + function dragEnd(e2) { + if (webkit) scroller.draggable = false; + draggingText = false; + up(); drop(); + if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { + e_preventDefault(e2); + setCursor(start.line, start.ch, true); + focusInput(); + } + } + var up = connect(document, "mouseup", operation(dragEnd), true); + var drop = connect(scroller, "drop", operation(dragEnd), true); + draggingText = true; + // IE's approach to draggable + if (scroller.dragDrop) scroller.dragDrop(); + return; + } + e_preventDefault(e); + if (type == "single") setCursor(start.line, start.ch, true); + + var startstart = sel.from, startend = sel.to; + + function doSelect(cur) { + if (type == "single") { + setSelectionUser(start, cur); + } else if (type == "double") { + var word = findWordAt(cur); + if (posLess(cur, startstart)) setSelectionUser(word.from, startend); + else setSelectionUser(startstart, word.to); + } else if (type == "triple") { + if (posLess(cur, startstart)) setSelectionUser(startend, clipPos({line: cur.line, ch: 0})); + else setSelectionUser(startstart, clipPos({line: cur.line + 1, ch: 0})); + } + } + + function extend(e) { + var cur = posFromMouse(e, true); + if (cur && !posEq(cur, last)) { + if (!focused) onFocus(); + last = cur; + doSelect(cur); + updateInput = false; + var visible = visibleLines(); + if (cur.line >= visible.to || cur.line < visible.from) + going = setTimeout(operation(function(){extend(e);}), 150); + } + } + + function done(e) { + clearTimeout(going); + var cur = posFromMouse(e); + if (cur) doSelect(cur); + e_preventDefault(e); + focusInput(); + updateInput = true; + move(); up(); + } + var move = connect(document, "mousemove", operation(function(e) { + clearTimeout(going); + e_preventDefault(e); + if (!ie && !e_button(e)) done(e); + else extend(e); + }), true); + var up = connect(document, "mouseup", operation(done), true); + } + function onDoubleClick(e) { + for (var n = e_target(e); n != wrapper; n = n.parentNode) + if (n.parentNode == gutterText) return e_preventDefault(e); + e_preventDefault(e); + } + function onDrop(e) { + if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; + e.preventDefault(); + var pos = posFromMouse(e, true), files = e.dataTransfer.files; + if (!pos || options.readOnly) return; + if (files && files.length && window.FileReader && window.File) { + function loadFile(file, i) { + var reader = new FileReader; + reader.onload = function() { + text[i] = reader.result; + if (++read == n) { + pos = clipPos(pos); + operation(function() { + var end = replaceRange(text.join(""), pos, pos); + setSelectionUser(pos, end); + })(); + } + }; + reader.readAsText(file); + } + var n = files.length, text = Array(n), read = 0; + for (var i = 0; i < n; ++i) loadFile(files[i], i); + } else { + // Don't do a replace if the drop happened inside of the selected text. + if (draggingText && !(posLess(pos, sel.from) || posLess(sel.to, pos))) return; + try { + var text = e.dataTransfer.getData("Text"); + if (text) { + compoundChange(function() { + var curFrom = sel.from, curTo = sel.to; + setSelectionUser(pos, pos); + if (draggingText) replaceRange("", curFrom, curTo); + replaceSelection(text); + focusInput(); + }); + } + } + catch(e){} + } + } + function onDragStart(e) { + var txt = getSelection(); + e.dataTransfer.setData("Text", txt); + + // Use dummy image instead of default browsers image. + if (gecko || chrome || opera) { + var img = document.createElement('img'); + img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image + e.dataTransfer.setDragImage(img, 0, 0); + } + } + + function doHandleBinding(bound, dropShift) { + if (typeof bound == "string") { + bound = commands[bound]; + if (!bound) return false; + } + var prevShift = shiftSelecting; + try { + if (options.readOnly) suppressEdits = true; + if (dropShift) shiftSelecting = null; + bound(instance); + } catch(e) { + if (e != Pass) throw e; + return false; + } finally { + shiftSelecting = prevShift; + suppressEdits = false; + } + return true; + } + function handleKeyBinding(e) { + // Handle auto keymap transitions + var startMap = getKeyMap(options.keyMap), next = startMap.auto; + clearTimeout(maybeTransition); + if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() { + if (getKeyMap(options.keyMap) == startMap) { + options.keyMap = (next.call ? next.call(null, instance) : next); + } + }, 50); + + var name = keyNames[e_prop(e, "keyCode")], handled = false; + if (name == null || e.altGraphKey) return false; + if (e_prop(e, "altKey")) name = "Alt-" + name; + if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name; + if (e_prop(e, "metaKey")) name = "Cmd-" + name; + + var stopped = false; + function stop() { stopped = true; } + + if (e_prop(e, "shiftKey")) { + handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap, + function(b) {return doHandleBinding(b, true);}, stop) + || lookupKey(name, options.extraKeys, options.keyMap, function(b) { + if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b); + }, stop); + } else { + handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop); + } + if (stopped) handled = false; + if (handled) { + e_preventDefault(e); + restartBlink(); + if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; } + } + return handled; + } + function handleCharBinding(e, ch) { + var handled = lookupKey("'" + ch + "'", options.extraKeys, + options.keyMap, function(b) { return doHandleBinding(b, true); }); + if (handled) { + e_preventDefault(e); + restartBlink(); + } + return handled; + } + + var lastStoppedKey = null, maybeTransition; + function onKeyDown(e) { + if (!focused) onFocus(); + if (ie && e.keyCode == 27) { e.returnValue = false; } + if (pollingFast) { if (readInput()) pollingFast = false; } + if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; + var code = e_prop(e, "keyCode"); + // IE does strange things with escape. + setShift(code == 16 || e_prop(e, "shiftKey")); + // First give onKeyEvent option a chance to handle this. + var handled = handleKeyBinding(e); + if (opera) { + lastStoppedKey = handled ? code : null; + // Opera has no cut event... we try to at least catch the key combo + if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey")) + replaceSelection(""); + } + } + function onKeyPress(e) { + if (pollingFast) readInput(); + if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; + var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode"); + if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;} + if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return; + var ch = String.fromCharCode(charCode == null ? keyCode : charCode); + if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) { + if (mode.electricChars.indexOf(ch) > -1) + setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75); + } + if (handleCharBinding(e, ch)) return; + fastPoll(); + } + function onKeyUp(e) { + if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; + if (e_prop(e, "keyCode") == 16) shiftSelecting = null; + } + + function onFocus() { + if (options.readOnly == "nocursor") return; + if (!focused) { + if (options.onFocus) options.onFocus(instance); + focused = true; + if (scroller.className.search(/\bCodeMirror-focused\b/) == -1) + scroller.className += " CodeMirror-focused"; + if (!leaveInputAlone) resetInput(true); + } + slowPoll(); + restartBlink(); + } + function onBlur() { + if (focused) { + if (options.onBlur) options.onBlur(instance); + focused = false; + if (bracketHighlighted) + operation(function(){ + if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; } + })(); + scroller.className = scroller.className.replace(" CodeMirror-focused", ""); + } + clearInterval(blinker); + setTimeout(function() {if (!focused) shiftSelecting = null;}, 150); + } + + function chopDelta(delta) { + // Make sure we always scroll a little bit for any nonzero delta. + if (delta > 0.0 && delta < 1.0) return 1; + else if (delta > -1.0 && delta < 0.0) return -1; + else return Math.round(delta); + } + + function onMouseWheel(e) { + var deltaX = 0, deltaY = 0; + if (e.type == "DOMMouseScroll") { // Firefox + var delta = -e.detail * 8.0; + if (e.axis == e.HORIZONTAL_AXIS) deltaX = delta; + else if (e.axis == e.VERTICAL_AXIS) deltaY = delta; + } else if (e.wheelDeltaX !== undefined && e.wheelDeltaY !== undefined) { // WebKit + deltaX = e.wheelDeltaX / 3.0; + deltaY = e.wheelDeltaY / 3.0; + } else if (e.wheelDelta !== undefined) { // IE or Opera + deltaY = e.wheelDelta / 3.0; + } + + var scrolled = false; + deltaX = chopDelta(deltaX); + deltaY = chopDelta(deltaY); + if ((deltaX > 0 && scroller.scrollLeft > 0) || + (deltaX < 0 && scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth)) { + scroller.scrollLeft -= deltaX; + scrolled = true; + } + if ((deltaY > 0 && scrollbar.scrollTop > 0) || + (deltaY < 0 && scrollbar.scrollTop + scrollbar.clientHeight < scrollbar.scrollHeight)) { + scrollbar.scrollTop -= deltaY; + scrolled = true; + } + if (scrolled) e_stop(e); + } + + // Replace the range from from to to by the strings in newText. + // Afterwards, set the selection to selFrom, selTo. + function updateLines(from, to, newText, selFrom, selTo) { + if (suppressEdits) return; + if (history) { + var old = []; + doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); }); + history.addChange(from.line, newText.length, old); + while (history.done.length > options.undoDepth) history.done.shift(); + } + updateLinesNoUndo(from, to, newText, selFrom, selTo); + } + function unredoHelper(from, to) { + if (!from.length) return; + var set = from.pop(), out = []; + for (var i = set.length - 1; i >= 0; i -= 1) { + var change = set[i]; + var replaced = [], end = change.start + change.added; + doc.iter(change.start, end, function(line) { replaced.push(line.text); }); + out.push({start: change.start, added: change.old.length, old: replaced}); + var pos = {line: change.start + change.old.length - 1, + ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])}; + updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos); + } + updateInput = true; + to.push(out); + } + function undo() {unredoHelper(history.done, history.undone);} + function redo() {unredoHelper(history.undone, history.done);} + + function updateLinesNoUndo(from, to, newText, selFrom, selTo) { + if (suppressEdits) return; + var recomputeMaxLength = false, maxLineLength = maxLine.length; + if (!options.lineWrapping) + doc.iter(from.line, to.line + 1, function(line) { + if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;} + }); + if (from.line != to.line || newText.length > 1) gutterDirty = true; + + var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line); + // First adjust the line structure, taking some care to leave highlighting intact. + if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") { + // This is a whole-line replace. Treated specially to make + // sure line objects move the way they are supposed to. + var added = [], prevLine = null; + if (from.line) { + prevLine = getLine(from.line - 1); + prevLine.fixMarkEnds(lastLine); + } else lastLine.fixMarkStarts(); + for (var i = 0, e = newText.length - 1; i < e; ++i) + added.push(Line.inheritMarks(newText[i], prevLine)); + if (nlines) doc.remove(from.line, nlines, callbacks); + if (added.length) doc.insert(from.line, added); + } else if (firstLine == lastLine) { + if (newText.length == 1) + firstLine.replace(from.ch, to.ch, newText[0]); + else { + lastLine = firstLine.split(to.ch, newText[newText.length-1]); + firstLine.replace(from.ch, null, newText[0]); + firstLine.fixMarkEnds(lastLine); + var added = []; + for (var i = 1, e = newText.length - 1; i < e; ++i) + added.push(Line.inheritMarks(newText[i], firstLine)); + added.push(lastLine); + doc.insert(from.line + 1, added); + } + } else if (newText.length == 1) { + firstLine.replace(from.ch, null, newText[0]); + lastLine.replace(null, to.ch, ""); + firstLine.append(lastLine); + doc.remove(from.line + 1, nlines, callbacks); + } else { + var added = []; + firstLine.replace(from.ch, null, newText[0]); + lastLine.replace(null, to.ch, newText[newText.length-1]); + firstLine.fixMarkEnds(lastLine); + for (var i = 1, e = newText.length - 1; i < e; ++i) + added.push(Line.inheritMarks(newText[i], firstLine)); + if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks); + doc.insert(from.line + 1, added); + } + if (options.lineWrapping) { + var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3); + doc.iter(from.line, from.line + newText.length, function(line) { + if (line.hidden) return; + var guess = Math.ceil(line.text.length / perLine) || 1; + if (guess != line.height) updateLineHeight(line, guess); + }); + } else { + doc.iter(from.line, from.line + newText.length, function(line) { + var l = line.text; + if (!line.hidden && l.length > maxLineLength) { + maxLine = l; maxLineLength = l.length; maxLineChanged = true; + recomputeMaxLength = false; + } + }); + if (recomputeMaxLength) updateMaxLine = true; + } + + // Add these lines to the work array, so that they will be + // highlighted. Adjust work lines if lines were added/removed. + var newWork = [], lendiff = newText.length - nlines - 1; + for (var i = 0, l = work.length; i < l; ++i) { + var task = work[i]; + if (task < from.line) newWork.push(task); + else if (task > to.line) newWork.push(task + lendiff); + } + var hlEnd = from.line + Math.min(newText.length, 500); + highlightLines(from.line, hlEnd); + newWork.push(hlEnd); + work = newWork; + startWorker(100); + // Remember that these lines changed, for updating the display + changes.push({from: from.line, to: to.line + 1, diff: lendiff}); + var changeObj = {from: from, to: to, text: newText}; + if (textChanged) { + for (var cur = textChanged; cur.next; cur = cur.next) {} + cur.next = changeObj; + } else textChanged = changeObj; + + // Update the selection + function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;} + setSelection(clipPos(selFrom), clipPos(selTo), + updateLine(sel.from.line), updateLine(sel.to.line)); + } + + function needsScrollbar() { + var realHeight = doc.height * textHeight() + 2 * paddingTop(); + return realHeight - 1 > scroller.offsetHeight ? realHeight : false; + } + + function updateVerticalScroll(scrollTop) { + var scrollHeight = needsScrollbar(); + scrollbar.style.display = scrollHeight ? "block" : "none"; + if (scrollHeight) { + scrollbarInner.style.height = scrollHeight + "px"; + scrollbar.style.height = scroller.offsetHeight + "px"; + if (scrollTop != null) scrollbar.scrollTop = scrollTop; + } + // Position the mover div to align with the current virtual scroll position + mover.style.top = (displayOffset * textHeight() - scrollbar.scrollTop) + "px"; + } + + // On Mac OS X Lion and up, detect whether the mouse is plugged in by measuring + // the width of a div with a scrollbar in it. If the width is <= 1, then + // the mouse isn't plugged in and scrollbars should overlap the content. + function overlapScrollbars() { + var tmpSb = document.createElement('div'), + tmpSbInner = document.createElement('div'); + tmpSb.className = "CodeMirror-scrollbar"; + tmpSb.style.cssText = "position: absolute; left: -9999px; height: 100px;"; + tmpSbInner.className = "CodeMirror-scrollbar-inner"; + tmpSbInner.style.height = "200px"; + tmpSb.appendChild(tmpSbInner); + + document.body.appendChild(tmpSb); + var result = (tmpSb.offsetWidth <= 1); + document.body.removeChild(tmpSb); + return result; + } + + function computeMaxLength() { + var maxLineLength = 0; + maxLine = ""; maxLineChanged = true; + doc.iter(0, doc.size, function(line) { + var l = line.text; + if (!line.hidden && l.length > maxLineLength) { + maxLineLength = l.length; maxLine = l; + } + }); + updateMaxLine = false; + } + + function replaceRange(code, from, to) { + from = clipPos(from); + if (!to) to = from; else to = clipPos(to); + code = splitLines(code); + function adjustPos(pos) { + if (posLess(pos, from)) return pos; + if (!posLess(to, pos)) return end; + var line = pos.line + code.length - (to.line - from.line) - 1; + var ch = pos.ch; + if (pos.line == to.line) + ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0)); + return {line: line, ch: ch}; + } + var end; + replaceRange1(code, from, to, function(end1) { + end = end1; + return {from: adjustPos(sel.from), to: adjustPos(sel.to)}; + }); + return end; + } + function replaceSelection(code, collapse) { + replaceRange1(splitLines(code), sel.from, sel.to, function(end) { + if (collapse == "end") return {from: end, to: end}; + else if (collapse == "start") return {from: sel.from, to: sel.from}; + else return {from: sel.from, to: end}; + }); + } + function replaceRange1(code, from, to, computeSel) { + var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length; + var newSel = computeSel({line: from.line + code.length - 1, ch: endch}); + updateLines(from, to, code, newSel.from, newSel.to); + } + + function getRange(from, to, lineSep) { + var l1 = from.line, l2 = to.line; + if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch); + var code = [getLine(l1).text.slice(from.ch)]; + doc.iter(l1 + 1, l2, function(line) { code.push(line.text); }); + code.push(getLine(l2).text.slice(0, to.ch)); + return code.join(lineSep || "\n"); + } + function getSelection(lineSep) { + return getRange(sel.from, sel.to, lineSep); + } + + var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll + function slowPoll() { + if (pollingFast) return; + poll.set(options.pollInterval, function() { + startOperation(); + readInput(); + if (focused) slowPoll(); + endOperation(); + }); + } + function fastPoll() { + var missed = false; + pollingFast = true; + function p() { + startOperation(); + var changed = readInput(); + if (!changed && !missed) {missed = true; poll.set(60, p);} + else {pollingFast = false; slowPoll();} + endOperation(); + } + poll.set(20, p); + } + + // Previnput is a hack to work with IME. If we reset the textarea + // on every change, that breaks IME. So we look for changes + // compared to the previous content instead. (Modern browsers have + // events that indicate IME taking place, but these are not widely + // supported or compatible enough yet to rely on.) + var prevInput = ""; + function readInput() { + if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false; + var text = input.value; + if (text == prevInput) return false; + shiftSelecting = null; + var same = 0, l = Math.min(prevInput.length, text.length); + while (same < l && prevInput[same] == text[same]) ++same; + if (same < prevInput.length) + sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)}; + else if (overwrite && posEq(sel.from, sel.to)) + sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))}; + replaceSelection(text.slice(same), "end"); + if (text.length > 1000) { input.value = prevInput = ""; } + else prevInput = text; + return true; + } + function resetInput(user) { + if (!posEq(sel.from, sel.to)) { + prevInput = ""; + input.value = getSelection(); + selectInput(input); + } else if (user) prevInput = input.value = ""; + } + + function focusInput() { + if (options.readOnly != "nocursor") input.focus(); + } + + function scrollEditorIntoView() { + var rect = cursor.getBoundingClientRect(); + // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden + if (ie && rect.top == rect.bottom) return; + var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); + if (rect.top < 0 || rect.bottom > winH) scrollCursorIntoView(); + } + function scrollCursorIntoView() { + var coords = calculateCursorCoords(); + return scrollIntoView(coords.x, coords.y, coords.x, coords.yBot); + } + function calculateCursorCoords() { + var cursor = localCoords(sel.inverted ? sel.from : sel.to); + var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x; + return {x: x, y: cursor.y, yBot: cursor.yBot}; + } + function scrollIntoView(x1, y1, x2, y2) { + var scrollPos = calculateScrollPos(x1, y1, x2, y2), scrolled = false; + if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft; scrolled = true;} + if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scrollPos.scrollTop; scrolled = true;} + if (scrolled && options.onScroll) options.onScroll(instance); + } + function calculateScrollPos(x1, y1, x2, y2) { + var pl = paddingLeft(), pt = paddingTop(); + y1 += pt; y2 += pt; x1 += pl; x2 += pl; + var screen = scroller.clientHeight, screentop = scrollbar.scrollTop, result = {}; + var docBottom = scroller.scrollHeight; + var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;; + if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1); + else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen; + + var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft; + var gutterw = options.fixedGutter ? gutter.clientWidth : 0; + var atLeft = x1 < gutterw + pl + 10; + if (x1 < screenleft + gutterw || atLeft) { + if (atLeft) x1 = 0; + result.scrollLeft = Math.max(0, x1 - 10 - gutterw); + } else if (x2 > screenw + screenleft - 3) { + result.scrollLeft = x2 + 10 - screenw; + } + return result; + } + + function visibleLines(scrollTop) { + var lh = textHeight(), top = (scrollTop != null ? scrollTop : scrollbar.scrollTop) - paddingTop(); + var fromHeight = Math.max(0, Math.floor(top / lh)); + var toHeight = Math.ceil((top + scroller.clientHeight) / lh); + return {from: lineAtHeight(doc, fromHeight), + to: lineAtHeight(doc, toHeight)}; + } + // Uses a set of changes plus the current scroll position to + // determine which DOM updates have to be made, and makes the + // updates. + function updateDisplay(changes, suppressCallback, scrollTop) { + if (!scroller.clientWidth) { + showingFrom = showingTo = displayOffset = 0; + return; + } + // Compute the new visible window + // If scrollTop is specified, use that to determine which lines + // to render instead of the current scrollbar position. + var visible = visibleLines(scrollTop); + // Bail out if the visible area is already rendered and nothing changed. + if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) { + updateVerticalScroll(scrollTop); + return; + } + var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100); + if (showingFrom < from && from - showingFrom < 20) from = showingFrom; + if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo); + + // Create a range of theoretically intact lines, and punch holes + // in that using the change info. + var intact = changes === true ? [] : + computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes); + // Clip off the parts that won't be visible + var intactLines = 0; + for (var i = 0; i < intact.length; ++i) { + var range = intact[i]; + if (range.from < from) {range.domStart += (from - range.from); range.from = from;} + if (range.to > to) range.to = to; + if (range.from >= range.to) intact.splice(i--, 1); + else intactLines += range.to - range.from; + } + if (intactLines == to - from && from == showingFrom && to == showingTo) { + updateVerticalScroll(scrollTop); + return; + } + intact.sort(function(a, b) {return a.domStart - b.domStart;}); + + var th = textHeight(), gutterDisplay = gutter.style.display; + lineDiv.style.display = "none"; + patchDisplay(from, to, intact); + lineDiv.style.display = gutter.style.display = ""; + + var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th; + // This is just a bogus formula that detects when the editor is + // resized or the font size changes. + if (different) lastSizeC = scroller.clientHeight + th; + showingFrom = from; showingTo = to; + displayOffset = heightAtLine(doc, from); + + // Since this is all rather error prone, it is honoured with the + // only assertion in the whole file. + if (lineDiv.childNodes.length != showingTo - showingFrom) + throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) + + " nodes=" + lineDiv.childNodes.length); + + function checkHeights() { + var curNode = lineDiv.firstChild, heightChanged = false; + doc.iter(showingFrom, showingTo, function(line) { + if (!line.hidden) { + var height = Math.round(curNode.offsetHeight / th) || 1; + if (line.height != height) { + updateLineHeight(line, height); + gutterDirty = heightChanged = true; + } + } + curNode = curNode.nextSibling; + }); + return heightChanged; + } + + if (options.lineWrapping) { + checkHeights(); + var scrollHeight = needsScrollbar(); + var shouldHaveScrollbar = scrollHeight ? "block" : "none"; + if (scrollbar.style.display != shouldHaveScrollbar) { + scrollbar.style.display = shouldHaveScrollbar; + if (scrollHeight) scrollbarInner.style.height = scrollHeight + "px"; + checkHeights(); + } + } + + gutter.style.display = gutterDisplay; + if (different || gutterDirty) { + // If the gutter grew in size, re-check heights. If those changed, re-draw gutter. + updateGutter() && options.lineWrapping && checkHeights() && updateGutter(); + } + updateVerticalScroll(scrollTop); + updateSelection(); + if (!suppressCallback && options.onUpdate) options.onUpdate(instance); + return true; + } + + function computeIntact(intact, changes) { + for (var i = 0, l = changes.length || 0; i < l; ++i) { + var change = changes[i], intact2 = [], diff = change.diff || 0; + for (var j = 0, l2 = intact.length; j < l2; ++j) { + var range = intact[j]; + if (change.to <= range.from && change.diff) + intact2.push({from: range.from + diff, to: range.to + diff, + domStart: range.domStart}); + else if (change.to <= range.from || change.from >= range.to) + intact2.push(range); + else { + if (change.from > range.from) + intact2.push({from: range.from, to: change.from, domStart: range.domStart}); + if (change.to < range.to) + intact2.push({from: change.to + diff, to: range.to + diff, + domStart: range.domStart + (change.to - range.from)}); + } + } + intact = intact2; + } + return intact; + } + + function patchDisplay(from, to, intact) { + // The first pass removes the DOM nodes that aren't intact. + if (!intact.length) lineDiv.innerHTML = ""; + else { + function killNode(node) { + var tmp = node.nextSibling; + node.parentNode.removeChild(node); + return tmp; + } + var domPos = 0, curNode = lineDiv.firstChild, n; + for (var i = 0; i < intact.length; ++i) { + var cur = intact[i]; + while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;} + for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;} + } + while (curNode) curNode = killNode(curNode); + } + // This pass fills in the lines that actually changed. + var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from; + var scratch = document.createElement("div"); + doc.iter(from, to, function(line) { + if (nextIntact && nextIntact.to == j) nextIntact = intact.shift(); + if (!nextIntact || nextIntact.from > j) { + if (line.hidden) var html = scratch.innerHTML = "
";
+          else {
+            var html = ''
+              + line.getHTML(makeTab) + '';
+            // Kludge to make sure the styled element lies behind the selection (by z-index)
+            if (line.bgClassName)
+              html = '
 
' + html + "
"; + } + scratch.innerHTML = html; + lineDiv.insertBefore(scratch.firstChild, curNode); + } else { + curNode = curNode.nextSibling; + } + ++j; + }); + } + + function updateGutter() { + if (!options.gutter && !options.lineNumbers) return; + var hText = mover.offsetHeight, hEditor = scroller.clientHeight; + gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px"; + var html = [], i = showingFrom, normalNode; + doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) { + if (line.hidden) { + html.push("
");
+        } else {
+          var marker = line.gutterMarker;
+          var text = options.lineNumbers ? options.lineNumberFormatter(i + options.firstLineNumber) : null;
+          if (marker && marker.text)
+            text = marker.text.replace("%N%", text != null ? text : "");
+          else if (text == null)
+            text = "\u00a0";
+          html.push((marker && marker.style ? '
' : "
"), text);
+          for (var j = 1; j < line.height; ++j) html.push("
 "); + html.push("
"); + if (!marker) normalNode = i; + } + ++i; + }); + gutter.style.display = "none"; + gutterText.innerHTML = html.join(""); + // Make sure scrolling doesn't cause number gutter size to pop + if (normalNode != null && options.lineNumbers) { + var node = gutterText.childNodes[normalNode - showingFrom]; + var minwidth = String(doc.size).length, val = eltText(node.firstChild), pad = ""; + while (val.length + pad.length < minwidth) pad += "\u00a0"; + if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild); + } + gutter.style.display = ""; + var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2; + lineSpace.style.marginLeft = gutter.offsetWidth + "px"; + gutterDirty = false; + return resized; + } + function updateSelection() { + var collapsed = posEq(sel.from, sel.to); + var fromPos = localCoords(sel.from, true); + var toPos = collapsed ? fromPos : localCoords(sel.to, true); + var headPos = sel.inverted ? fromPos : toPos, th = textHeight(); + var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv); + inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px"; + inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px"; + if (collapsed) { + cursor.style.top = headPos.y + "px"; + cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px"; + cursor.style.display = ""; + selectionDiv.style.display = "none"; + } else { + var sameLine = fromPos.y == toPos.y, html = ""; + var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth; + var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight; + function add(left, top, right, height) { + var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px" + : "right: " + right + "px"; + html += '
'; + } + if (sel.from.ch && fromPos.y >= 0) { + var right = sameLine ? clientWidth - toPos.x : 0; + add(fromPos.x, fromPos.y, right, th); + } + var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0)); + var middleHeight = Math.min(toPos.y, clientHeight) - middleStart; + if (middleHeight > 0.2 * th) + add(0, middleStart, 0, middleHeight); + if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th) + add(0, toPos.y, clientWidth - toPos.x, th); + selectionDiv.innerHTML = html; + cursor.style.display = "none"; + selectionDiv.style.display = ""; + } + } + + function setShift(val) { + if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from); + else shiftSelecting = null; + } + function setSelectionUser(from, to) { + var sh = shiftSelecting && clipPos(shiftSelecting); + if (sh) { + if (posLess(sh, from)) from = sh; + else if (posLess(to, sh)) to = sh; + } + setSelection(from, to); + userSelChange = true; + } + // Update the selection. Last two args are only used by + // updateLines, since they have to be expressed in the line + // numbers before the update. + function setSelection(from, to, oldFrom, oldTo) { + goalColumn = null; + if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;} + if (posEq(sel.from, from) && posEq(sel.to, to)) return; + if (posLess(to, from)) {var tmp = to; to = from; from = tmp;} + + // Skip over hidden lines. + if (from.line != oldFrom) { + var from1 = skipHidden(from, oldFrom, sel.from.ch); + // If there is no non-hidden line left, force visibility on current line + if (!from1) setLineHidden(from.line, false); + else from = from1; + } + if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch); + + if (posEq(from, to)) sel.inverted = false; + else if (posEq(from, sel.to)) sel.inverted = false; + else if (posEq(to, sel.from)) sel.inverted = true; + + if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) { + var head = sel.inverted ? from : to; + if (head.line != sel.from.line && sel.from.line < doc.size) { + var oldLine = getLine(sel.from.line); + if (/^\s+$/.test(oldLine.text)) + setTimeout(operation(function() { + if (oldLine.parent && /^\s+$/.test(oldLine.text)) { + var no = lineNo(oldLine); + replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length}); + } + }, 10)); + } + } + + sel.from = from; sel.to = to; + selectionChanged = true; + } + function skipHidden(pos, oldLine, oldCh) { + function getNonHidden(dir) { + var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1; + while (lNo != end) { + var line = getLine(lNo); + if (!line.hidden) { + var ch = pos.ch; + if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length; + return {line: lNo, ch: ch}; + } + lNo += dir; + } + } + var line = getLine(pos.line); + var toEnd = pos.ch == line.text.length && pos.ch != oldCh; + if (!line.hidden) return pos; + if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1); + else return getNonHidden(-1) || getNonHidden(1); + } + function setCursor(line, ch, user) { + var pos = clipPos({line: line, ch: ch || 0}); + (user ? setSelectionUser : setSelection)(pos, pos); + } + + function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));} + function clipPos(pos) { + if (pos.line < 0) return {line: 0, ch: 0}; + if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length}; + var ch = pos.ch, linelen = getLine(pos.line).text.length; + if (ch == null || ch > linelen) return {line: pos.line, ch: linelen}; + else if (ch < 0) return {line: pos.line, ch: 0}; + else return pos; + } + + function findPosH(dir, unit) { + var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch; + var lineObj = getLine(line); + function findNextLine() { + for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) { + var lo = getLine(l); + if (!lo.hidden) { line = l; lineObj = lo; return true; } + } + } + function moveOnce(boundToLine) { + if (ch == (dir < 0 ? 0 : lineObj.text.length)) { + if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0; + else return false; + } else ch += dir; + return true; + } + if (unit == "char") moveOnce(); + else if (unit == "column") moveOnce(true); + else if (unit == "word") { + var sawWord = false; + for (;;) { + if (dir < 0) if (!moveOnce()) break; + if (isWordChar(lineObj.text.charAt(ch))) sawWord = true; + else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;} + if (dir > 0) if (!moveOnce()) break; + } + } + return {line: line, ch: ch}; + } + function moveH(dir, unit) { + var pos = dir < 0 ? sel.from : sel.to; + if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit); + setCursor(pos.line, pos.ch, true); + } + function deleteH(dir, unit) { + if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to); + else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to); + else replaceRange("", sel.from, findPosH(dir, unit)); + userSelChange = true; + } + var goalColumn = null; + function moveV(dir, unit) { + var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true); + if (goalColumn != null) pos.x = goalColumn; + if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight); + else if (unit == "line") dist = textHeight(); + var target = coordsChar(pos.x, pos.y + dist * dir + 2); + if (unit == "page") scrollbar.scrollTop += localCoords(target, true).y - pos.y; + setCursor(target.line, target.ch, true); + goalColumn = pos.x; + } + + function findWordAt(pos) { + var line = getLine(pos.line).text; + var start = pos.ch, end = pos.ch; + var check = isWordChar(line.charAt(start < line.length ? start : start - 1)) ? + isWordChar : function(ch) {return !isWordChar(ch);}; + while (start > 0 && check(line.charAt(start - 1))) --start; + while (end < line.length && check(line.charAt(end))) ++end; + return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}}; + } + function selectLine(line) { + setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0})); + } + function indentSelected(mode) { + if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode); + var e = sel.to.line - (sel.to.ch ? 0 : 1); + for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode); + } + + function indentLine(n, how) { + if (!how) how = "add"; + if (how == "smart") { + if (!mode.indent) how = "prev"; + else var state = getStateBefore(n); + } + + var line = getLine(n), curSpace = line.indentation(options.tabSize), + curSpaceString = line.text.match(/^\s*/)[0], indentation; + if (how == "smart") { + indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text); + if (indentation == Pass) how = "prev"; + } + if (how == "prev") { + if (n) indentation = getLine(n-1).indentation(options.tabSize); + else indentation = 0; + } + else if (how == "add") indentation = curSpace + options.indentUnit; + else if (how == "subtract") indentation = curSpace - options.indentUnit; + indentation = Math.max(0, indentation); + var diff = indentation - curSpace; + + var indentString = "", pos = 0; + if (options.indentWithTabs) + for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";} + while (pos < indentation) {++pos; indentString += " ";} + + replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}); + } + + function loadMode() { + mode = CodeMirror.getMode(options, options.mode); + doc.iter(0, doc.size, function(line) { line.stateAfter = null; }); + work = [0]; + startWorker(); + } + function gutterChanged() { + var visible = options.gutter || options.lineNumbers; + gutter.style.display = visible ? "" : "none"; + if (visible) gutterDirty = true; + else lineDiv.parentNode.style.marginLeft = 0; + } + function wrappingChanged(from, to) { + if (options.lineWrapping) { + wrapper.className += " CodeMirror-wrap"; + var perLine = scroller.clientWidth / charWidth() - 3; + doc.iter(0, doc.size, function(line) { + if (line.hidden) return; + var guess = Math.ceil(line.text.length / perLine) || 1; + if (guess != 1) updateLineHeight(line, guess); + }); + lineSpace.style.width = code.style.width = ""; + widthForcer.style.left = ""; + } else { + wrapper.className = wrapper.className.replace(" CodeMirror-wrap", ""); + maxLine = ""; maxLineChanged = true; + doc.iter(0, doc.size, function(line) { + if (line.height != 1 && !line.hidden) updateLineHeight(line, 1); + if (line.text.length > maxLine.length) maxLine = line.text; + }); + } + changes.push({from: 0, to: doc.size}); + } + function makeTab(col) { + var w = options.tabSize - col % options.tabSize, cached = tabCache[w]; + if (cached) return cached; + for (var str = '', i = 0; i < w; ++i) str += " "; + return (tabCache[w] = {html: str + "", width: w}); + } + function themeChanged() { + scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") + + options.theme.replace(/(^|\s)\s*/g, " cm-s-"); + } + function keyMapChanged() { + var style = keyMap[options.keyMap].style; + wrapper.className = wrapper.className.replace(/\s*cm-keymap-\S+/g, "") + + (style ? " cm-keymap-" + style : ""); + } + + function TextMarker() { this.set = []; } + TextMarker.prototype.clear = operation(function() { + var min = Infinity, max = -Infinity; + for (var i = 0, e = this.set.length; i < e; ++i) { + var line = this.set[i], mk = line.marked; + if (!mk || !line.parent) continue; + var lineN = lineNo(line); + min = Math.min(min, lineN); max = Math.max(max, lineN); + for (var j = 0; j < mk.length; ++j) + if (mk[j].marker == this) mk.splice(j--, 1); + } + if (min != Infinity) + changes.push({from: min, to: max + 1}); + }); + TextMarker.prototype.find = function() { + var from, to; + for (var i = 0, e = this.set.length; i < e; ++i) { + var line = this.set[i], mk = line.marked; + for (var j = 0; j < mk.length; ++j) { + var mark = mk[j]; + if (mark.marker == this) { + if (mark.from != null || mark.to != null) { + var found = lineNo(line); + if (found != null) { + if (mark.from != null) from = {line: found, ch: mark.from}; + if (mark.to != null) to = {line: found, ch: mark.to}; + } + } + } + } + } + return {from: from, to: to}; + }; + + function markText(from, to, className) { + from = clipPos(from); to = clipPos(to); + var tm = new TextMarker(); + if (!posLess(from, to)) return tm; + function add(line, from, to, className) { + getLine(line).addMark(new MarkedText(from, to, className, tm)); + } + if (from.line == to.line) add(from.line, from.ch, to.ch, className); + else { + add(from.line, from.ch, null, className); + for (var i = from.line + 1, e = to.line; i < e; ++i) + add(i, null, null, className); + add(to.line, null, to.ch, className); + } + changes.push({from: from.line, to: to.line + 1}); + return tm; + } + + function setBookmark(pos) { + pos = clipPos(pos); + var bm = new Bookmark(pos.ch); + getLine(pos.line).addMark(bm); + return bm; + } + + function findMarksAt(pos) { + pos = clipPos(pos); + var markers = [], marked = getLine(pos.line).marked; + if (!marked) return markers; + for (var i = 0, e = marked.length; i < e; ++i) { + var m = marked[i]; + if ((m.from == null || m.from <= pos.ch) && + (m.to == null || m.to >= pos.ch)) + markers.push(m.marker || m); + } + return markers; + } + + function addGutterMarker(line, text, className) { + if (typeof line == "number") line = getLine(clipLine(line)); + line.gutterMarker = {text: text, style: className}; + gutterDirty = true; + return line; + } + function removeGutterMarker(line) { + if (typeof line == "number") line = getLine(clipLine(line)); + line.gutterMarker = null; + gutterDirty = true; + } + + function changeLine(handle, op) { + var no = handle, line = handle; + if (typeof handle == "number") line = getLine(clipLine(handle)); + else no = lineNo(handle); + if (no == null) return null; + if (op(line, no)) changes.push({from: no, to: no + 1}); + else return null; + return line; + } + function setLineClass(handle, className, bgClassName) { + return changeLine(handle, function(line) { + if (line.className != className || line.bgClassName != bgClassName) { + line.className = className; + line.bgClassName = bgClassName; + return true; + } + }); + } + function setLineHidden(handle, hidden) { + return changeLine(handle, function(line, no) { + if (line.hidden != hidden) { + line.hidden = hidden; + if (!options.lineWrapping) { + var l = line.text; + if (hidden && l.length == maxLine.length) { + updateMaxLine = true; + } else if (!hidden && l.length > maxLine.length) { + maxLine = l; updateMaxLine = false; + } + } + updateLineHeight(line, hidden ? 0 : 1); + var fline = sel.from.line, tline = sel.to.line; + if (hidden && (fline == no || tline == no)) { + var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from; + var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to; + // Can't hide the last visible line, we'd have no place to put the cursor + if (!to) return; + setSelection(from, to); + } + return (gutterDirty = true); + } + }); + } + + function lineInfo(line) { + if (typeof line == "number") { + if (!isLine(line)) return null; + var n = line; + line = getLine(line); + if (!line) return null; + } else { + var n = lineNo(line); + if (n == null) return null; + } + var marker = line.gutterMarker; + return {line: n, handle: line, text: line.text, markerText: marker && marker.text, + markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName}; + } + + function stringWidth(str) { + measure.innerHTML = "
x
"; + measure.firstChild.firstChild.firstChild.nodeValue = str; + return measure.firstChild.firstChild.offsetWidth || 10; + } + // These are used to go from pixel positions to character + // positions, taking varying character widths into account. + function charFromX(line, x) { + if (x <= 0) return 0; + var lineObj = getLine(line), text = lineObj.text; + function getX(len) { + return measureLine(lineObj, len).left; + } + var from = 0, fromX = 0, to = text.length, toX; + // Guess a suitable upper bound for our search. + var estimated = Math.min(to, Math.ceil(x / charWidth())); + for (;;) { + var estX = getX(estimated); + if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2)); + else {toX = estX; to = estimated; break;} + } + if (x > toX) return to; + // Try to guess a suitable lower bound as well. + estimated = Math.floor(to * 0.8); estX = getX(estimated); + if (estX < x) {from = estimated; fromX = estX;} + // Do a binary search between these bounds. + for (;;) { + if (to - from <= 1) return (toX - x > x - fromX) ? from : to; + var middle = Math.ceil((from + to) / 2), middleX = getX(middle); + if (middleX > x) {to = middle; toX = middleX;} + else {from = middle; fromX = middleX;} + } + } + + var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16); + function measureLine(line, ch) { + if (ch == 0) return {top: 0, left: 0}; + var wbr = options.lineWrapping && ch < line.text.length && + spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1)); + measure.innerHTML = "
" + line.getHTML(makeTab, ch, tempId, wbr) + "
"; + var elt = document.getElementById(tempId); + var top = elt.offsetTop, left = elt.offsetLeft; + // Older IEs report zero offsets for spans directly after a wrap + if (ie && top == 0 && left == 0) { + var backup = document.createElement("span"); + backup.innerHTML = "x"; + elt.parentNode.insertBefore(backup, elt.nextSibling); + top = backup.offsetTop; + } + return {top: top, left: left}; + } + function localCoords(pos, inLineWrap) { + var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0)); + if (pos.ch == 0) x = 0; + else { + var sp = measureLine(getLine(pos.line), pos.ch); + x = sp.left; + if (options.lineWrapping) y += Math.max(0, sp.top); + } + return {x: x, y: y, yBot: y + lh}; + } + // Coords must be lineSpace-local + function coordsChar(x, y) { + if (y < 0) y = 0; + var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th); + var lineNo = lineAtHeight(doc, heightPos); + if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length}; + var lineObj = getLine(lineNo), text = lineObj.text; + var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0; + if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0}; + function getX(len) { + var sp = measureLine(lineObj, len); + if (tw) { + var off = Math.round(sp.top / th); + return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth); + } + return sp.left; + } + var from = 0, fromX = 0, to = text.length, toX; + // Guess a suitable upper bound for our search. + var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw)); + for (;;) { + var estX = getX(estimated); + if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2)); + else {toX = estX; to = estimated; break;} + } + if (x > toX) return {line: lineNo, ch: to}; + // Try to guess a suitable lower bound as well. + estimated = Math.floor(to * 0.8); estX = getX(estimated); + if (estX < x) {from = estimated; fromX = estX;} + // Do a binary search between these bounds. + for (;;) { + if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to}; + var middle = Math.ceil((from + to) / 2), middleX = getX(middle); + if (middleX > x) {to = middle; toX = middleX;} + else {from = middle; fromX = middleX;} + } + } + function pageCoords(pos) { + var local = localCoords(pos, true), off = eltOffset(lineSpace); + return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot}; + } + + var cachedHeight, cachedHeightFor, measureText; + function textHeight() { + if (measureText == null) { + measureText = "
";
+        for (var i = 0; i < 49; ++i) measureText += "x
"; + measureText += "x
"; + } + var offsetHeight = lineDiv.clientHeight; + if (offsetHeight == cachedHeightFor) return cachedHeight; + cachedHeightFor = offsetHeight; + measure.innerHTML = measureText; + cachedHeight = measure.firstChild.offsetHeight / 50 || 1; + measure.innerHTML = ""; + return cachedHeight; + } + var cachedWidth, cachedWidthFor = 0; + function charWidth() { + if (scroller.clientWidth == cachedWidthFor) return cachedWidth; + cachedWidthFor = scroller.clientWidth; + return (cachedWidth = stringWidth("x")); + } + function paddingTop() {return lineSpace.offsetTop;} + function paddingLeft() {return lineSpace.offsetLeft;} + + function posFromMouse(e, liberal) { + var offW = eltOffset(scroller, true), x, y; + // Fails unpredictably on IE[67] when mouse is dragged around quickly. + try { x = e.clientX; y = e.clientY; } catch (e) { return null; } + // This is a mess of a heuristic to try and determine whether a + // scroll-bar was clicked or not, and to return null if one was + // (and !liberal). + if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight)) + return null; + var offL = eltOffset(lineSpace, true); + return coordsChar(x - offL.left, y - offL.top); + } + function onContextMenu(e) { + var pos = posFromMouse(e), scrollPos = scrollbar.scrollTop; + if (!pos || opera) return; // Opera is difficult. + if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to)) + operation(setCursor)(pos.line, pos.ch); + + var oldCSS = input.style.cssText; + inputDiv.style.position = "absolute"; + input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + + "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " + + "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; + leaveInputAlone = true; + var val = input.value = getSelection(); + focusInput(); + selectInput(input); + function rehide() { + var newVal = splitLines(input.value).join("\n"); + if (newVal != val && !options.readOnly) operation(replaceSelection)(newVal, "end"); + inputDiv.style.position = "relative"; + input.style.cssText = oldCSS; + if (ie_lt9) scrollbar.scrollTop = scrollPos; + leaveInputAlone = false; + resetInput(true); + slowPoll(); + } + + if (gecko) { + e_stop(e); + var mouseup = connect(window, "mouseup", function() { + mouseup(); + setTimeout(rehide, 20); + }, true); + } else { + setTimeout(rehide, 50); + } + } + + // Cursor-blinking + function restartBlink() { + clearInterval(blinker); + var on = true; + cursor.style.visibility = ""; + blinker = setInterval(function() { + cursor.style.visibility = (on = !on) ? "" : "hidden"; + }, 650); + } + + var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; + function matchBrackets(autoclear) { + var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1; + var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; + if (!match) return; + var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles; + for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2) + if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;} + + var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; + function scan(line, from, to) { + if (!line.text) return; + var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur; + for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) { + var text = st[i]; + if (st[i+1] != style) {pos += d * text.length; continue;} + for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) { + if (pos >= from && pos < to && re.test(cur = text.charAt(j))) { + var match = matching[cur]; + if (match.charAt(1) == ">" == forward) stack.push(cur); + else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; + else if (!stack.length) return {pos: pos, match: true}; + } + } + } + } + for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) { + var line = getLine(i), first = i == head.line; + var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length); + if (found) break; + } + if (!found) found = {pos: null, match: false}; + var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; + var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style), + two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style); + var clear = operation(function(){one.clear(); two && two.clear();}); + if (autoclear) setTimeout(clear, 800); + else bracketHighlighted = clear; + } + + // Finds the line to start with when starting a parse. Tries to + // find a line with a stateAfter, so that it can start with a + // valid state. If that fails, it returns the line with the + // smallest indentation, which tends to need the least context to + // parse correctly. + function findStartLine(n) { + var minindent, minline; + for (var search = n, lim = n - 40; search > lim; --search) { + if (search == 0) return 0; + var line = getLine(search-1); + if (line.stateAfter) return search; + var indented = line.indentation(options.tabSize); + if (minline == null || minindent > indented) { + minline = search - 1; + minindent = indented; + } + } + return minline; + } + function getStateBefore(n) { + var start = findStartLine(n), state = start && getLine(start-1).stateAfter; + if (!state) state = startState(mode); + else state = copyState(mode, state); + doc.iter(start, n, function(line) { + line.highlight(mode, state, options.tabSize); + line.stateAfter = copyState(mode, state); + }); + if (start < n) changes.push({from: start, to: n}); + if (n < doc.size && !getLine(n).stateAfter) work.push(n); + return state; + } + function highlightLines(start, end) { + var state = getStateBefore(start); + doc.iter(start, end, function(line) { + line.highlight(mode, state, options.tabSize); + line.stateAfter = copyState(mode, state); + }); + } + function highlightWorker() { + var end = +new Date + options.workTime; + var foundWork = work.length; + while (work.length) { + if (!getLine(showingFrom).stateAfter) var task = showingFrom; + else var task = work.pop(); + if (task >= doc.size) continue; + var start = findStartLine(task), state = start && getLine(start-1).stateAfter; + if (state) state = copyState(mode, state); + else state = startState(mode); + + var unchanged = 0, compare = mode.compareStates, realChange = false, + i = start, bail = false; + doc.iter(i, doc.size, function(line) { + var hadState = line.stateAfter; + if (+new Date > end) { + work.push(i); + startWorker(options.workDelay); + if (realChange) changes.push({from: task, to: i + 1}); + return (bail = true); + } + var changed = line.highlight(mode, state, options.tabSize); + if (changed) realChange = true; + line.stateAfter = copyState(mode, state); + var done = null; + if (compare) { + var same = hadState && compare(hadState, state); + if (same != Pass) done = !!same; + } + if (done == null) { + if (changed !== false || !hadState) unchanged = 0; + else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, ""))) + done = true; + } + if (done) return true; + ++i; + }); + if (bail) return; + if (realChange) changes.push({from: task, to: i + 1}); + } + if (foundWork && options.onHighlightComplete) + options.onHighlightComplete(instance); + } + function startWorker(time) { + if (!work.length) return; + highlight.set(time, operation(highlightWorker)); + } + + // Operations are used to wrap changes in such a way that each + // change won't have to update the cursor and display (which would + // be awkward, slow, and error-prone), but instead updates are + // batched and then all combined and executed at once. + function startOperation() { + updateInput = userSelChange = textChanged = null; + changes = []; selectionChanged = false; callbacks = []; + } + function endOperation() { + if (updateMaxLine) computeMaxLength(); + if (maxLineChanged && !options.lineWrapping) { + var cursorWidth = widthForcer.offsetWidth, left = stringWidth(maxLine); + widthForcer.style.left = left + "px"; + lineSpace.style.minWidth = (left + cursorWidth) + "px"; + maxLineChanged = false; + } + var newScrollPos, updated; + if (selectionChanged) { + var coords = calculateCursorCoords(); + newScrollPos = calculateScrollPos(coords.x, coords.y, coords.x, coords.yBot); + } + if (changes.length) updated = updateDisplay(changes, true, (newScrollPos ? newScrollPos.scrollTop : null)); + else { + if (selectionChanged) updateSelection(); + if (gutterDirty) updateGutter(); + } + if (newScrollPos) scrollCursorIntoView(); + if (selectionChanged) {scrollEditorIntoView(); restartBlink();} + + if (focused && !leaveInputAlone && + (updateInput === true || (updateInput !== false && selectionChanged))) + resetInput(userSelChange); + + if (selectionChanged && options.matchBrackets) + setTimeout(operation(function() { + if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;} + if (posEq(sel.from, sel.to)) matchBrackets(false); + }), 20); + var sc = selectionChanged, cbs = callbacks; // these can be reset by callbacks + if (textChanged && options.onChange && instance) + options.onChange(instance, textChanged); + if (sc && options.onCursorActivity) + options.onCursorActivity(instance); + for (var i = 0; i < cbs.length; ++i) cbs[i](instance); + if (updated && options.onUpdate) options.onUpdate(instance); + } + var nestedOperation = 0; + function operation(f) { + return function() { + if (!nestedOperation++) startOperation(); + try {var result = f.apply(this, arguments);} + finally {if (!--nestedOperation) endOperation();} + return result; + }; + } + + function compoundChange(f) { + history.startCompound(); + try { return f(); } finally { history.endCompound(); } + } + + for (var ext in extensions) + if (extensions.propertyIsEnumerable(ext) && + !instance.propertyIsEnumerable(ext)) + instance[ext] = extensions[ext]; + return instance; + } // (end of function CodeMirror) + + // The default configuration options. + CodeMirror.defaults = { + value: "", + mode: null, + theme: "default", + indentUnit: 2, + indentWithTabs: false, + smartIndent: true, + tabSize: 4, + keyMap: "default", + extraKeys: null, + electricChars: true, + autoClearEmptyLines: false, + onKeyEvent: null, + onDragEvent: null, + lineWrapping: false, + lineNumbers: false, + gutter: false, + fixedGutter: false, + firstLineNumber: 1, + readOnly: false, + dragDrop: true, + onChange: null, + onCursorActivity: null, + onGutterClick: null, + onHighlightComplete: null, + onUpdate: null, + onFocus: null, onBlur: null, onScroll: null, + matchBrackets: false, + workTime: 100, + workDelay: 200, + pollInterval: 100, + undoDepth: 40, + tabindex: null, + autofocus: null, + lineNumberFormatter: function(integer) { return integer; } + }; + + var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent); + var mac = ios || /Mac/.test(navigator.platform); + var win = /Win/.test(navigator.platform); + + // Known modes, by name and by MIME + var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; + CodeMirror.defineMode = function(name, mode) { + if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; + if (arguments.length > 2) { + mode.dependencies = []; + for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]); + } + modes[name] = mode; + }; + CodeMirror.defineMIME = function(mime, spec) { + mimeModes[mime] = spec; + }; + CodeMirror.resolveMode = function(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) + spec = mimeModes[spec]; + else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) + return CodeMirror.resolveMode("application/xml"); + if (typeof spec == "string") return {name: spec}; + else return spec || {name: "null"}; + }; + CodeMirror.getMode = function(options, spec) { + var spec = CodeMirror.resolveMode(spec); + var mfactory = modes[spec.name]; + if (!mfactory) return CodeMirror.getMode(options, "text/plain"); + return mfactory(options, spec); + }; + CodeMirror.listModes = function() { + var list = []; + for (var m in modes) + if (modes.propertyIsEnumerable(m)) list.push(m); + return list; + }; + CodeMirror.listMIMEs = function() { + var list = []; + for (var m in mimeModes) + if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]}); + return list; + }; + + var extensions = CodeMirror.extensions = {}; + CodeMirror.defineExtension = function(name, func) { + extensions[name] = func; + }; + + var commands = CodeMirror.commands = { + selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});}, + killLine: function(cm) { + var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to); + if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, {line: from.line + 1, ch: 0}); + else cm.replaceRange("", from, sel ? to : {line: from.line}); + }, + deleteLine: function(cm) {var l = cm.getCursor().line; cm.replaceRange("", {line: l, ch: 0}, {line: l});}, + undo: function(cm) {cm.undo();}, + redo: function(cm) {cm.redo();}, + goDocStart: function(cm) {cm.setCursor(0, 0, true);}, + goDocEnd: function(cm) {cm.setSelection({line: cm.lineCount() - 1}, null, true);}, + goLineStart: function(cm) {cm.setCursor(cm.getCursor().line, 0, true);}, + goLineStartSmart: function(cm) { + var cur = cm.getCursor(); + var text = cm.getLine(cur.line), firstNonWS = Math.max(0, text.search(/\S/)); + cm.setCursor(cur.line, cur.ch <= firstNonWS && cur.ch ? 0 : firstNonWS, true); + }, + goLineEnd: function(cm) {cm.setSelection({line: cm.getCursor().line}, null, true);}, + goLineUp: function(cm) {cm.moveV(-1, "line");}, + goLineDown: function(cm) {cm.moveV(1, "line");}, + goPageUp: function(cm) {cm.moveV(-1, "page");}, + goPageDown: function(cm) {cm.moveV(1, "page");}, + goCharLeft: function(cm) {cm.moveH(-1, "char");}, + goCharRight: function(cm) {cm.moveH(1, "char");}, + goColumnLeft: function(cm) {cm.moveH(-1, "column");}, + goColumnRight: function(cm) {cm.moveH(1, "column");}, + goWordLeft: function(cm) {cm.moveH(-1, "word");}, + goWordRight: function(cm) {cm.moveH(1, "word");}, + delCharLeft: function(cm) {cm.deleteH(-1, "char");}, + delCharRight: function(cm) {cm.deleteH(1, "char");}, + delWordLeft: function(cm) {cm.deleteH(-1, "word");}, + delWordRight: function(cm) {cm.deleteH(1, "word");}, + indentAuto: function(cm) {cm.indentSelection("smart");}, + indentMore: function(cm) {cm.indentSelection("add");}, + indentLess: function(cm) {cm.indentSelection("subtract");}, + insertTab: function(cm) {cm.replaceSelection("\t", "end");}, + defaultTab: function(cm) { + if (cm.somethingSelected()) cm.indentSelection("add"); + else cm.replaceSelection("\t", "end"); + }, + transposeChars: function(cm) { + var cur = cm.getCursor(), line = cm.getLine(cur.line); + if (cur.ch > 0 && cur.ch < line.length - 1) + cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1), + {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1}); + }, + newlineAndIndent: function(cm) { + cm.replaceSelection("\n", "end"); + cm.indentLine(cm.getCursor().line); + }, + toggleOverwrite: function(cm) {cm.toggleOverwrite();} + }; + + var keyMap = CodeMirror.keyMap = {}; + keyMap.basic = { + "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", + "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", + "Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "defaultTab", "Shift-Tab": "indentAuto", + "Enter": "newlineAndIndent", "Insert": "toggleOverwrite" + }; + // Note that the save and find-related commands aren't defined by + // default. Unknown commands are simply ignored. + keyMap.pcDefault = { + "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", + "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd", + "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", + "Ctrl-Backspace": "delWordLeft", "Ctrl-Delete": "delWordRight", "Ctrl-S": "save", "Ctrl-F": "find", + "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", + "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", + fallthrough: "basic" + }; + keyMap.macDefault = { + "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", + "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft", + "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordLeft", + "Ctrl-Alt-Backspace": "delWordRight", "Alt-Delete": "delWordRight", "Cmd-S": "save", "Cmd-F": "find", + "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", + "Cmd-[": "indentLess", "Cmd-]": "indentMore", + fallthrough: ["basic", "emacsy"] + }; + keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; + keyMap.emacsy = { + "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", + "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", + "Ctrl-V": "goPageUp", "Shift-Ctrl-V": "goPageDown", "Ctrl-D": "delCharRight", "Ctrl-H": "delCharLeft", + "Alt-D": "delWordRight", "Alt-Backspace": "delWordLeft", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars" + }; + + function getKeyMap(val) { + if (typeof val == "string") return keyMap[val]; + else return val; + } + function lookupKey(name, extraMap, map, handle, stop) { + function lookup(map) { + map = getKeyMap(map); + var found = map[name]; + if (found != null && handle(found)) return true; + if (map.nofallthrough) { + if (stop) stop(); + return true; + } + var fallthrough = map.fallthrough; + if (fallthrough == null) return false; + if (Object.prototype.toString.call(fallthrough) != "[object Array]") + return lookup(fallthrough); + for (var i = 0, e = fallthrough.length; i < e; ++i) { + if (lookup(fallthrough[i])) return true; + } + return false; + } + if (extraMap && lookup(extraMap)) return true; + return lookup(map); + } + function isModifierKey(event) { + var name = keyNames[e_prop(event, "keyCode")]; + return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; + } + + CodeMirror.fromTextArea = function(textarea, options) { + if (!textarea) return; + if (!options) options = {}; + options.value = textarea.value; + if (!options.tabindex && textarea.tabindex) + options.tabindex = textarea.tabindex; + if (options.autofocus == null && textarea.getAttribute("autofocus") != null) + options.autofocus = true; + + function save() {textarea.value = instance.getValue();} + if (textarea.form) { + // Deplorable hack to make the submit method do the right thing. + var rmSubmit = connect(textarea.form, "submit", save, true); + if (typeof textarea.form.submit == "function") { + var realSubmit = textarea.form.submit; + function wrappedSubmit() { + save(); + textarea.form.submit = realSubmit; + textarea.form.submit(); + textarea.form.submit = wrappedSubmit; + } + textarea.form.submit = wrappedSubmit; + } + } + + textarea.style.display = "none"; + var instance = CodeMirror(function(node) { + textarea.parentNode.insertBefore(node, textarea.nextSibling); + }, options); + instance.save = save; + instance.getTextArea = function() { return textarea; }; + instance.toTextArea = function() { + save(); + textarea.parentNode.removeChild(instance.getWrapperElement()); + textarea.style.display = ""; + if (textarea.form) { + rmSubmit(); + if (typeof textarea.form.submit == "function") + textarea.form.submit = realSubmit; + } + }; + return instance; + }; + + // Utility functions for working with state. Exported because modes + // sometimes need to do this. + function copyState(mode, state) { + if (state === true) return state; + if (mode.copyState) return mode.copyState(state); + var nstate = {}; + for (var n in state) { + var val = state[n]; + if (val instanceof Array) val = val.concat([]); + nstate[n] = val; + } + return nstate; + } + CodeMirror.copyState = copyState; + function startState(mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true; + } + CodeMirror.startState = startState; + + // The character stream used by a mode's parser. + function StringStream(string, tabSize) { + this.pos = this.start = 0; + this.string = string; + this.tabSize = tabSize || 8; + } + StringStream.prototype = { + eol: function() {return this.pos >= this.string.length;}, + sol: function() {return this.pos == 0;}, + peek: function() {return this.string.charAt(this.pos);}, + next: function() { + if (this.pos < this.string.length) + return this.string.charAt(this.pos++); + }, + eat: function(match) { + var ch = this.string.charAt(this.pos); + if (typeof match == "string") var ok = ch == match; + else var ok = ch && (match.test ? match.test(ch) : match(ch)); + if (ok) {++this.pos; return ch;} + }, + eatWhile: function(match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start; + }, + eatSpace: function() { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; + return this.pos > start; + }, + skipToEnd: function() {this.pos = this.string.length;}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true;} + }, + backUp: function(n) {this.pos -= n;}, + column: function() {return countColumn(this.string, this.start, this.tabSize);}, + indentation: function() {return countColumn(this.string, null, this.tabSize);}, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} + if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) { + if (consume !== false) this.pos += pattern.length; + return true; + } + } else { + var match = this.string.slice(this.pos).match(pattern); + if (match && consume !== false) this.pos += match[0].length; + return match; + } + }, + current: function(){return this.string.slice(this.start, this.pos);} + }; + CodeMirror.StringStream = StringStream; + + function MarkedText(from, to, className, marker) { + this.from = from; this.to = to; this.style = className; this.marker = marker; + } + MarkedText.prototype = { + attach: function(line) { this.marker.set.push(line); }, + detach: function(line) { + var ix = indexOf(this.marker.set, line); + if (ix > -1) this.marker.set.splice(ix, 1); + }, + split: function(pos, lenBefore) { + if (this.to <= pos && this.to != null) return null; + var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore; + var to = this.to == null ? null : this.to - pos + lenBefore; + return new MarkedText(from, to, this.style, this.marker); + }, + dup: function() { return new MarkedText(null, null, this.style, this.marker); }, + clipTo: function(fromOpen, from, toOpen, to, diff) { + if (fromOpen && to > this.from && (to < this.to || this.to == null)) + this.from = null; + else if (this.from != null && this.from >= from) + this.from = Math.max(to, this.from) + diff; + if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null)) + this.to = null; + else if (this.to != null && this.to > from) + this.to = to < this.to ? this.to + diff : from; + }, + isDead: function() { return this.from != null && this.to != null && this.from >= this.to; }, + sameSet: function(x) { return this.marker == x.marker; } + }; + + function Bookmark(pos) { + this.from = pos; this.to = pos; this.line = null; + } + Bookmark.prototype = { + attach: function(line) { this.line = line; }, + detach: function(line) { if (this.line == line) this.line = null; }, + split: function(pos, lenBefore) { + if (pos < this.from) { + this.from = this.to = (this.from - pos) + lenBefore; + return this; + } + }, + isDead: function() { return this.from > this.to; }, + clipTo: function(fromOpen, from, toOpen, to, diff) { + if ((fromOpen || from < this.from) && (toOpen || to > this.to)) { + this.from = 0; this.to = -1; + } else if (this.from > from) { + this.from = this.to = Math.max(to, this.from) + diff; + } + }, + sameSet: function(x) { return false; }, + find: function() { + if (!this.line || !this.line.parent) return null; + return {line: lineNo(this.line), ch: this.from}; + }, + clear: function() { + if (this.line) { + var found = indexOf(this.line.marked, this); + if (found != -1) this.line.marked.splice(found, 1); + this.line = null; + } + } + }; + + // Line objects. These hold state related to a line, including + // highlighting info (the styles array). + function Line(text, styles) { + this.styles = styles || [text, null]; + this.text = text; + this.height = 1; + this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null; + this.stateAfter = this.parent = this.hidden = null; + } + Line.inheritMarks = function(text, orig) { + var ln = new Line(text), mk = orig && orig.marked; + if (mk) { + for (var i = 0; i < mk.length; ++i) { + if (mk[i].to == null && mk[i].style) { + var newmk = ln.marked || (ln.marked = []), mark = mk[i]; + var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln); + } + } + } + return ln; + } + Line.prototype = { + // Replace a piece of a line, keeping the styles around it intact. + replace: function(from, to_, text) { + var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_; + copyStyles(0, from, this.styles, st); + if (text) st.push(text, null); + copyStyles(to, this.text.length, this.styles, st); + this.styles = st; + this.text = this.text.slice(0, from) + text + this.text.slice(to); + this.stateAfter = null; + if (mk) { + var diff = text.length - (to - from); + for (var i = 0; i < mk.length; ++i) { + var mark = mk[i]; + mark.clipTo(from == null, from || 0, to_ == null, to, diff); + if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);} + } + } + }, + // Split a part off a line, keeping styles and markers intact. + split: function(pos, textBefore) { + var st = [textBefore, null], mk = this.marked; + copyStyles(pos, this.text.length, this.styles, st); + var taken = new Line(textBefore + this.text.slice(pos), st); + if (mk) { + for (var i = 0; i < mk.length; ++i) { + var mark = mk[i]; + var newmark = mark.split(pos, textBefore.length); + if (newmark) { + if (!taken.marked) taken.marked = []; + taken.marked.push(newmark); newmark.attach(taken); + if (newmark == mark) mk.splice(i--, 1); + } + } + } + return taken; + }, + append: function(line) { + var mylen = this.text.length, mk = line.marked, mymk = this.marked; + this.text += line.text; + copyStyles(0, line.text.length, line.styles, this.styles); + if (mymk) { + for (var i = 0; i < mymk.length; ++i) + if (mymk[i].to == null) mymk[i].to = mylen; + } + if (mk && mk.length) { + if (!mymk) this.marked = mymk = []; + outer: for (var i = 0; i < mk.length; ++i) { + var mark = mk[i]; + if (!mark.from) { + for (var j = 0; j < mymk.length; ++j) { + var mymark = mymk[j]; + if (mymark.to == mylen && mymark.sameSet(mark)) { + mymark.to = mark.to == null ? null : mark.to + mylen; + if (mymark.isDead()) { + mymark.detach(this); + mk.splice(i--, 1); + } + continue outer; + } + } + } + mymk.push(mark); + mark.attach(this); + mark.from += mylen; + if (mark.to != null) mark.to += mylen; + } + } + }, + fixMarkEnds: function(other) { + var mk = this.marked, omk = other.marked; + if (!mk) return; + outer: for (var i = 0; i < mk.length; ++i) { + var mark = mk[i], close = mark.to == null; + if (close && omk) { + for (var j = 0; j < omk.length; ++j) { + var om = omk[j]; + if (!om.sameSet(mark) || om.from != null) continue + if (mark.from == this.text.length && om.to == 0) { + omk.splice(j, 1); + mk.splice(i--, 1); + continue outer; + } else { + close = false; break; + } + } + } + if (close) mark.to = this.text.length; + } + }, + fixMarkStarts: function() { + var mk = this.marked; + if (!mk) return; + for (var i = 0; i < mk.length; ++i) + if (mk[i].from == null) mk[i].from = 0; + }, + addMark: function(mark) { + mark.attach(this); + if (this.marked == null) this.marked = []; + this.marked.push(mark); + this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);}); + }, + // Run the given mode's parser over a line, update the styles + // array, which contains alternating fragments of text and CSS + // classes. + highlight: function(mode, state, tabSize) { + var stream = new StringStream(this.text, tabSize), st = this.styles, pos = 0; + var changed = false, curWord = st[0], prevWord; + if (this.text == "" && mode.blankLine) mode.blankLine(state); + while (!stream.eol()) { + var style = mode.token(stream, state); + var substr = this.text.slice(stream.start, stream.pos); + stream.start = stream.pos; + if (pos && st[pos-1] == style) + st[pos-2] += substr; + else if (substr) { + if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true; + st[pos++] = substr; st[pos++] = style; + prevWord = curWord; curWord = st[pos]; + } + // Give up when line is ridiculously long + if (stream.pos > 5000) { + st[pos++] = this.text.slice(stream.pos); st[pos++] = null; + break; + } + } + if (st.length != pos) {st.length = pos; changed = true;} + if (pos && st[pos-2] != prevWord) changed = true; + // Short lines with simple highlights return null, and are + // counted as changed by the driver because they are likely to + // highlight the same way in various contexts. + return changed || (st.length < 5 && this.text.length < 10 ? null : false); + }, + // Fetch the parser token for a given character. Useful for hacks + // that want to inspect the mode state (say, for completion). + getTokenAt: function(mode, state, ch) { + var txt = this.text, stream = new StringStream(txt); + while (stream.pos < ch && !stream.eol()) { + stream.start = stream.pos; + var style = mode.token(stream, state); + } + return {start: stream.start, + end: stream.pos, + string: stream.current(), + className: style || null, + state: state}; + }, + indentation: function(tabSize) {return countColumn(this.text, null, tabSize);}, + // Produces an HTML fragment for the line, taking selection, + // marking, and highlighting into account. + getHTML: function(makeTab, wrapAt, wrapId, wrapWBR) { + var html = [], first = true, col = 0; + function span_(text, style) { + if (!text) return; + // Work around a bug where, in some compat modes, IE ignores leading spaces + if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1); + first = false; + if (text.indexOf("\t") == -1) { + col += text.length; + var escaped = htmlEscape(text); + } else { + var escaped = ""; + for (var pos = 0;;) { + var idx = text.indexOf("\t", pos); + if (idx == -1) { + escaped += htmlEscape(text.slice(pos)); + col += text.length - pos; + break; + } else { + col += idx - pos; + var tab = makeTab(col); + escaped += htmlEscape(text.slice(pos, idx)) + tab.html; + col += tab.width; + pos = idx + 1; + } + } + } + if (style) html.push('', escaped, ""); + else html.push(escaped); + } + var span = span_; + if (wrapAt != null) { + var outPos = 0, open = ""; + span = function(text, style) { + var l = text.length; + if (wrapAt >= outPos && wrapAt < outPos + l) { + if (wrapAt > outPos) { + span_(text.slice(0, wrapAt - outPos), style); + // See comment at the definition of spanAffectsWrapping + if (wrapWBR) html.push(""); + } + html.push(open); + var cut = wrapAt - outPos; + span_(opera ? text.slice(cut, cut + 1) : text.slice(cut), style); + html.push(""); + if (opera) span_(text.slice(cut + 1), style); + wrapAt--; + outPos += l; + } else { + outPos += l; + span_(text, style); + // Output empty wrapper when at end of line + // (Gecko and IE8+ do strange wrapping when adding a space + // to the end of the line. Other browsers don't react well + // to zero-width spaces. So we do hideous browser sniffing + // to determine which to use.) + if (outPos == wrapAt && outPos == len) + html.push(open + (gecko || (ie && !ie_lt8) ? "​" : " ") + ""); + // Stop outputting HTML when gone sufficiently far beyond measure + else if (outPos > wrapAt + 10 && /\s/.test(text)) span = function(){}; + } + } + } + + var st = this.styles, allText = this.text, marked = this.marked; + var len = allText.length; + function styleToClass(style) { + if (!style) return null; + return "cm-" + style.replace(/ +/g, " cm-"); + } + + if (!allText && wrapAt == null) { + span(" "); + } else if (!marked || !marked.length) { + for (var i = 0, ch = 0; ch < len; i+=2) { + var str = st[i], style = st[i+1], l = str.length; + if (ch + l > len) str = str.slice(0, len - ch); + ch += l; + span(str, styleToClass(style)); + } + } else { + var pos = 0, i = 0, text = "", style, sg = 0; + var nextChange = marked[0].from || 0, marks = [], markpos = 0; + function advanceMarks() { + var m; + while (markpos < marked.length && + ((m = marked[markpos]).from == pos || m.from == null)) { + if (m.style != null) marks.push(m); + ++markpos; + } + nextChange = markpos < marked.length ? marked[markpos].from : Infinity; + for (var i = 0; i < marks.length; ++i) { + var to = marks[i].to; + if (to == null) to = Infinity; + if (to == pos) marks.splice(i--, 1); + else nextChange = Math.min(to, nextChange); + } + } + var m = 0; + while (pos < len) { + if (nextChange == pos) advanceMarks(); + var upto = Math.min(len, nextChange); + while (true) { + if (text) { + var end = pos + text.length; + var appliedStyle = style; + for (var j = 0; j < marks.length; ++j) + appliedStyle = (appliedStyle ? appliedStyle + " " : "") + marks[j].style; + span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle); + if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} + pos = end; + } + text = st[i++]; style = styleToClass(st[i++]); + } + } + } + return html.join(""); + }, + cleanUp: function() { + this.parent = null; + if (this.marked) + for (var i = 0, e = this.marked.length; i < e; ++i) this.marked[i].detach(this); + } + }; + // Utility used by replace and split above + function copyStyles(from, to, source, dest) { + for (var i = 0, pos = 0, state = 0; pos < to; i+=2) { + var part = source[i], end = pos + part.length; + if (state == 0) { + if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]); + if (end >= from) state = 1; + } else if (state == 1) { + if (end > to) dest.push(part.slice(0, to - pos), source[i+1]); + else dest.push(part, source[i+1]); + } + pos = end; + } + } + + // Data structure that holds the sequence of lines. + function LeafChunk(lines) { + this.lines = lines; + this.parent = null; + for (var i = 0, e = lines.length, height = 0; i < e; ++i) { + lines[i].parent = this; + height += lines[i].height; + } + this.height = height; + } + LeafChunk.prototype = { + chunkSize: function() { return this.lines.length; }, + remove: function(at, n, callbacks) { + for (var i = at, e = at + n; i < e; ++i) { + var line = this.lines[i]; + this.height -= line.height; + line.cleanUp(); + if (line.handlers) + for (var j = 0; j < line.handlers.length; ++j) callbacks.push(line.handlers[j]); + } + this.lines.splice(at, n); + }, + collapse: function(lines) { + lines.splice.apply(lines, [lines.length, 0].concat(this.lines)); + }, + insertHeight: function(at, lines, height) { + this.height += height; + this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); + for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this; + }, + iterN: function(at, n, op) { + for (var e = at + n; at < e; ++at) + if (op(this.lines[at])) return true; + } + }; + function BranchChunk(children) { + this.children = children; + var size = 0, height = 0; + for (var i = 0, e = children.length; i < e; ++i) { + var ch = children[i]; + size += ch.chunkSize(); height += ch.height; + ch.parent = this; + } + this.size = size; + this.height = height; + this.parent = null; + } + BranchChunk.prototype = { + chunkSize: function() { return this.size; }, + remove: function(at, n, callbacks) { + this.size -= n; + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var rm = Math.min(n, sz - at), oldHeight = child.height; + child.remove(at, rm, callbacks); + this.height -= oldHeight - child.height; + if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } + if ((n -= rm) == 0) break; + at = 0; + } else at -= sz; + } + if (this.size - n < 25) { + var lines = []; + this.collapse(lines); + this.children = [new LeafChunk(lines)]; + this.children[0].parent = this; + } + }, + collapse: function(lines) { + for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines); + }, + insert: function(at, lines) { + var height = 0; + for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height; + this.insertHeight(at, lines, height); + }, + insertHeight: function(at, lines, height) { + this.size += lines.length; + this.height += height; + for (var i = 0, e = this.children.length; i < e; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at <= sz) { + child.insertHeight(at, lines, height); + if (child.lines && child.lines.length > 50) { + while (child.lines.length > 50) { + var spilled = child.lines.splice(child.lines.length - 25, 25); + var newleaf = new LeafChunk(spilled); + child.height -= newleaf.height; + this.children.splice(i + 1, 0, newleaf); + newleaf.parent = this; + } + this.maybeSpill(); + } + break; + } + at -= sz; + } + }, + maybeSpill: function() { + if (this.children.length <= 10) return; + var me = this; + do { + var spilled = me.children.splice(me.children.length - 5, 5); + var sibling = new BranchChunk(spilled); + if (!me.parent) { // Become the parent node + var copy = new BranchChunk(me.children); + copy.parent = me; + me.children = [copy, sibling]; + me = copy; + } else { + me.size -= sibling.size; + me.height -= sibling.height; + var myIndex = indexOf(me.parent.children, me); + me.parent.children.splice(myIndex + 1, 0, sibling); + } + sibling.parent = me.parent; + } while (me.children.length > 10); + me.parent.maybeSpill(); + }, + iter: function(from, to, op) { this.iterN(from, to - from, op); }, + iterN: function(at, n, op) { + for (var i = 0, e = this.children.length; i < e; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var used = Math.min(n, sz - at); + if (child.iterN(at, used, op)) return true; + if ((n -= used) == 0) break; + at = 0; + } else at -= sz; + } + } + }; + + function getLineAt(chunk, n) { + while (!chunk.lines) { + for (var i = 0;; ++i) { + var child = chunk.children[i], sz = child.chunkSize(); + if (n < sz) { chunk = child; break; } + n -= sz; + } + } + return chunk.lines[n]; + } + function lineNo(line) { + if (line.parent == null) return null; + var cur = line.parent, no = indexOf(cur.lines, line); + for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { + for (var i = 0, e = chunk.children.length; ; ++i) { + if (chunk.children[i] == cur) break; + no += chunk.children[i].chunkSize(); + } + } + return no; + } + function lineAtHeight(chunk, h) { + var n = 0; + outer: do { + for (var i = 0, e = chunk.children.length; i < e; ++i) { + var child = chunk.children[i], ch = child.height; + if (h < ch) { chunk = child; continue outer; } + h -= ch; + n += child.chunkSize(); + } + return n; + } while (!chunk.lines); + for (var i = 0, e = chunk.lines.length; i < e; ++i) { + var line = chunk.lines[i], lh = line.height; + if (h < lh) break; + h -= lh; + } + return n + i; + } + function heightAtLine(chunk, n) { + var h = 0; + outer: do { + for (var i = 0, e = chunk.children.length; i < e; ++i) { + var child = chunk.children[i], sz = child.chunkSize(); + if (n < sz) { chunk = child; continue outer; } + n -= sz; + h += child.height; + } + return h; + } while (!chunk.lines); + for (var i = 0; i < n; ++i) h += chunk.lines[i].height; + return h; + } + + // The history object 'chunks' changes that are made close together + // and at almost the same time into bigger undoable units. + function History() { + this.time = 0; + this.done = []; this.undone = []; + this.compound = 0; + this.closed = false; + } + History.prototype = { + addChange: function(start, added, old) { + this.undone.length = 0; + var time = +new Date, cur = this.done[this.done.length - 1], last = cur && cur[cur.length - 1]; + var dtime = time - this.time; + + if (this.compound && cur && !this.closed) { + cur.push({start: start, added: added, old: old}); + } else if (dtime > 400 || !last || this.closed || + last.start > start + old.length || last.start + last.added < start) { + this.done.push([{start: start, added: added, old: old}]); + this.closed = false; + } else { + var startBefore = Math.max(0, last.start - start), + endAfter = Math.max(0, (start + old.length) - (last.start + last.added)); + for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]); + for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]); + if (startBefore) last.start = start; + last.added += added - (old.length - startBefore - endAfter); + } + this.time = time; + }, + startCompound: function() { + if (!this.compound++) this.closed = true; + }, + endCompound: function() { + if (!--this.compound) this.closed = true; + } + }; + + function stopMethod() {e_stop(this);} + // Ensure an event has a stop method. + function addStop(event) { + if (!event.stop) event.stop = stopMethod; + return event; + } + + function e_preventDefault(e) { + if (e.preventDefault) e.preventDefault(); + else e.returnValue = false; + } + function e_stopPropagation(e) { + if (e.stopPropagation) e.stopPropagation(); + else e.cancelBubble = true; + } + function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);} + CodeMirror.e_stop = e_stop; + CodeMirror.e_preventDefault = e_preventDefault; + CodeMirror.e_stopPropagation = e_stopPropagation; + + function e_target(e) {return e.target || e.srcElement;} + function e_button(e) { + var b = e.which; + if (b == null) { + if (e.button & 1) b = 1; + else if (e.button & 2) b = 3; + else if (e.button & 4) b = 2; + } + if (mac && e.ctrlKey && b == 1) b = 3; + return b; + } + + // Allow 3rd-party code to override event properties by adding an override + // object to an event object. + function e_prop(e, prop) { + var overridden = e.override && e.override.hasOwnProperty(prop); + return overridden ? e.override[prop] : e[prop]; + } + + // Event handler registration. If disconnect is true, it'll return a + // function that unregisters the handler. + function connect(node, type, handler, disconnect) { + if (typeof node.addEventListener == "function") { + node.addEventListener(type, handler, false); + if (disconnect) return function() {node.removeEventListener(type, handler, false);}; + } else { + var wrapHandler = function(event) {handler(event || window.event);}; + node.attachEvent("on" + type, wrapHandler); + if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);}; + } + } + CodeMirror.connect = connect; + + function Delayed() {this.id = null;} + Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}}; + + var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; + + var gecko = /gecko\/\d{7}/i.test(navigator.userAgent); + var ie = /MSIE \d/.test(navigator.userAgent); + var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent); + var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent); + var quirksMode = ie && document.documentMode == 5; + var webkit = /WebKit\//.test(navigator.userAgent); + var chrome = /Chrome\//.test(navigator.userAgent); + var opera = /Opera\//.test(navigator.userAgent); + var safari = /Apple Computer/.test(navigator.vendor); + var khtml = /KHTML\//.test(navigator.userAgent); + var mac_geLion = /Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent); + + // Detect drag-and-drop + var dragAndDrop = function() { + // There is *some* kind of drag-and-drop support in IE6-8, but I + // couldn't get it to work yet. + if (ie_lt9) return false; + var div = document.createElement('div'); + return "draggable" in div || "dragDrop" in div; + }(); + + // Feature-detect whether newlines in textareas are converted to \r\n + var lineSep = function () { + var te = document.createElement("textarea"); + te.value = "foo\nbar"; + if (te.value.indexOf("\r") > -1) return "\r\n"; + return "\n"; + }(); + + // For a reason I have yet to figure out, some browsers disallow + // word wrapping between certain characters *only* if a new inline + // element is started between them. This makes it hard to reliably + // measure the position of things, since that requires inserting an + // extra span. This terribly fragile set of regexps matches the + // character combinations that suffer from this phenomenon on the + // various browsers. + var spanAffectsWrapping = /^$/; // Won't match any two-character string + if (gecko) spanAffectsWrapping = /$'/; + else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/; + else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/; + + // Counts the column offset in a string, taking tabs into account. + // Used mostly to find indentation. + function countColumn(string, end, tabSize) { + if (end == null) { + end = string.search(/[^\s\u00a0]/); + if (end == -1) end = string.length; + } + for (var i = 0, n = 0; i < end; ++i) { + if (string.charAt(i) == "\t") n += tabSize - (n % tabSize); + else ++n; + } + return n; + } + + function computedStyle(elt) { + if (elt.currentStyle) return elt.currentStyle; + return window.getComputedStyle(elt, null); + } + + function eltOffset(node, screen) { + // Take the parts of bounding client rect that we are interested in so we are able to edit if need be, + // since the returned value cannot be changed externally (they are kept in sync as the element moves within the page) + try { var box = node.getBoundingClientRect(); box = { top: box.top, left: box.left }; } + catch(e) { box = {top: 0, left: 0}; } + if (!screen) { + // Get the toplevel scroll, working around browser differences. + if (window.pageYOffset == null) { + var t = document.documentElement || document.body.parentNode; + if (t.scrollTop == null) t = document.body; + box.top += t.scrollTop; box.left += t.scrollLeft; + } else { + box.top += window.pageYOffset; box.left += window.pageXOffset; + } + } + return box; + } + + // Get a node's text content. + function eltText(node) { + return node.textContent || node.innerText || node.nodeValue || ""; + } + function selectInput(node) { + if (ios) { // Mobile Safari apparently has a bug where select() is broken. + node.selectionStart = 0; + node.selectionEnd = node.value.length; + } else node.select(); + } + + // Operations on {line, ch} objects. + function posEq(a, b) {return a.line == b.line && a.ch == b.ch;} + function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);} + function copyPos(x) {return {line: x.line, ch: x.ch};} + + var escapeElement = document.createElement("pre"); + function htmlEscape(str) { + escapeElement.textContent = str; + return escapeElement.innerHTML; + } + // Recent (late 2011) Opera betas insert bogus newlines at the start + // of the textContent, so we strip those. + if (htmlEscape("a") == "\na") { + htmlEscape = function(str) { + escapeElement.textContent = str; + return escapeElement.innerHTML.slice(1); + }; + // Some IEs don't preserve tabs through innerHTML + } else if (htmlEscape("\t") != "\t") { + htmlEscape = function(str) { + escapeElement.innerHTML = ""; + escapeElement.appendChild(document.createTextNode(str)); + return escapeElement.innerHTML; + }; + } + CodeMirror.htmlEscape = htmlEscape; + + // Used to position the cursor after an undo/redo by finding the + // last edited character. + function editEnd(from, to) { + if (!to) return 0; + if (!from) return to.length; + for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j) + if (from.charAt(i) != to.charAt(j)) break; + return j + 1; + } + + function indexOf(collection, elt) { + if (collection.indexOf) return collection.indexOf(elt); + for (var i = 0, e = collection.length; i < e; ++i) + if (collection[i] == elt) return i; + return -1; + } + function isWordChar(ch) { + return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase(); + } + + // See if "".split is the broken IE version, if so, provide an + // alternative way to split lines. + var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) { + var pos = 0, result = [], l = string.length; + while (pos <= l) { + var nl = string.indexOf("\n", pos); + if (nl == -1) nl = string.length; + var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); + var rt = line.indexOf("\r"); + if (rt != -1) { + result.push(line.slice(0, rt)); + pos += rt + 1; + } else { + result.push(line); + pos = nl + 1; + } + } + return result; + } : function(string){return string.split(/\r\n?|\n/);}; + CodeMirror.splitLines = splitLines; + + var hasSelection = window.getSelection ? function(te) { + try { return te.selectionStart != te.selectionEnd; } + catch(e) { return false; } + } : function(te) { + try {var range = te.ownerDocument.selection.createRange();} + catch(e) {} + if (!range || range.parentElement() != te) return false; + return range.compareEndPoints("StartToEnd", range) != 0; + }; + + CodeMirror.defineMode("null", function() { + return {token: function(stream) {stream.skipToEnd();}}; + }); + CodeMirror.defineMIME("text/plain", "null"); + + var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", + 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", + 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", + 46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete", + 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", + 221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home", + 63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"}; + CodeMirror.keyNames = keyNames; + (function() { + // Number keys + for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i); + // Alphabetic keys + for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i); + // Function keys + for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; + })(); + + return CodeMirror; +})(); diff --git a/conlite/external/codemirror/lib/contenido_integration.css b/conlite/external/codemirror/lib/contenido_integration.css new file mode 100644 index 0000000..3375994 --- /dev/null +++ b/conlite/external/codemirror/lib/contenido_integration.css @@ -0,0 +1,25 @@ +/** + * CONTENIDO CodeMirror integration styles + * + * @package TODO + * @subpackage TODO + * @author Murat Purc + * @copyright four for business AG + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + */ + +/* @TODO: Display the editor in real full screen mode! */ +/* +.con-CodeMirror-fullscreen { + background: #fff; + display: block; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 9999; +} +*/ \ No newline at end of file diff --git a/conlite/external/codemirror/lib/contenido_integration.js b/conlite/external/codemirror/lib/contenido_integration.js new file mode 100644 index 0000000..963b79d --- /dev/null +++ b/conlite/external/codemirror/lib/contenido_integration.js @@ -0,0 +1,111 @@ +/** + * CONTENIDO CodeMirror integration helper module + * + * @package TODO + * @subpackage TODO + * @requires jQuery + * @author Unknown + * @author Murat Purc + * @copyright four for business AG + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + */ + + +(function(Con, $) { + "use strict"; + + // Some variables to store editor elements + var _cmEditor = [], + _cmDiv = [], + _cmFullscreen = []; + + /** + * CodeMirror integration helper class + * @class CodeMirrorHelper + * @namespace Con + * @static + */ + Con.CodeMirrorHelper = { + + /** + * Initializes an element as a CodeMirror editor. + * @param {String} textAreaId + * @param {Object} properties + */ + init: function(textAreaId, properties) { + var $textArea = $('#' + textAreaId); + if (!$textArea[0]) { + Con.log("init: Failed to get textarea with id " + textAreaId, "contenido_integration.js", "warn"); + return; + } + + _cmEditor[textAreaId] = CodeMirror.fromTextArea($textArea[0], properties); + _cmDiv[textAreaId] = $('div.cm-s-' + textAreaId + '.CodeMirror-scroll'); + _cmFullscreen[textAreaId] = { + height: $(_cmEditor[textAreaId].getWrapperElement()).height(), + width: $(_cmEditor[textAreaId].getWrapperElement()).width() + }; + var codeWidth = $(_cmEditor[textAreaId].getWrapperElement()).width(); + + $textArea.next().resizable({ + resize: function() { + var minWidth = _cmFullscreen[textAreaId].width; + var newWidth = ($(this).width() < minWidth) ? minWidth : $(this).width(); + _cmEditor[textAreaId].setSize(newWidth, $(this).height()); + _cmEditor[textAreaId].refresh(); + } + }); + }, + + /** + * Toggles the fullscreen state of a specific editor element + * @param {String} editorId + */ + toggleFullscreenEditor: function(editorId) { + if (!_cmDiv[editorId]) { + Con.log("toggleFullscreenEditor: Missing editor element with id " + editorId, "contenido_integration.js", "warn"); + return; + } + + var editorElement = $(_cmEditor[editorId].getWrapperElement()); + // @TODO: Display the editor in real full screen mode! + // @TODO 1: Remove the line above + // @TODO 2: Move styles to CSS, it's enough to set a CSS class attribute + if (!_cmDiv[editorId].hasClass('con-CodeMirror-fullscreen')) { + _cmDiv[editorId].addClass('con-CodeMirror-fullscreen'); + editorElement.css("position", "absolute"); + editorElement.css("top", "0"); + editorElement.css("left", "0"); + editorElement.css("width", "100%"); + editorElement.css("height", window.innerHeight + "px"); + editorElement.css("background-color", "white"); + editorElement.css("z-index", "3000"); + editorElement.resizable('destroy'); + + } else { + _cmDiv[editorId].removeClass('con-CodeMirror-fullscreen'); + editorElement.css("position", ""); + editorElement.css("top", "0"); + editorElement.css("left", "0"); + editorElement.css("width", _cmFullscreen[editorId].width + 'px'); + editorElement.css("height", _cmFullscreen[editorId].height + 'px'); + editorElement.css("background-color", ""); + editorElement.css("z-index", "0"); + editorElement.resizable({ + resize: function() { + var minWidth = _cmFullscreen[editorId].width; + var newWidth = ($(this).width() < minWidth) ? minWidth : $(this).width(); + _cmEditor[editorId].setSize(newWidth, $(this).height()); + _cmEditor[editorId].refresh(); + } + }); + } + + _cmEditor[editorId].setSize(editorElement.width(), editorElement.height()); + _cmEditor[editorId].refresh(); + } + + }; +})(Con, Con.$); diff --git a/conlite/external/codemirror/lib/lang/de.js b/conlite/external/codemirror/lib/lang/de.js new file mode 100644 index 0000000..0754009 --- /dev/null +++ b/conlite/external/codemirror/lib/lang/de.js @@ -0,0 +1,10 @@ +var codeMirrorTranslation = new Array(); +codeMirrorTranslation['search'] = 'Suchen'; +codeMirrorTranslation['search_for'] = 'Suchen nach'; +codeMirrorTranslation['replace'] = 'Ersetzen'; +codeMirrorTranslation['replace_with'] = 'Ersetzen mit'; +codeMirrorTranslation['with'] = 'Mit'; +codeMirrorTranslation['yes'] = 'Ja'; +codeMirrorTranslation['no'] = 'Nein'; +codeMirrorTranslation['stop'] = 'Stop'; +codeMirrorTranslation['regex_info'] = 'Nutze /re/ Syntax für Suche mit regulären Ausdruck'; \ No newline at end of file diff --git a/conlite/external/codemirror/lib/lang/en.js b/conlite/external/codemirror/lib/lang/en.js new file mode 100644 index 0000000..b97b355 --- /dev/null +++ b/conlite/external/codemirror/lib/lang/en.js @@ -0,0 +1,10 @@ +var codeMirrorTranslation = new Array(); +codeMirrorTranslation['search'] = 'Search'; +codeMirrorTranslation['search_for'] = 'Search for'; +codeMirrorTranslation['replace'] = 'Replace'; +codeMirrorTranslation['replace_with'] = 'Replace with'; +codeMirrorTranslation['with'] = 'With'; +codeMirrorTranslation['yes'] = 'Yes'; +codeMirrorTranslation['no'] = 'No'; +codeMirrorTranslation['stop'] = 'Stop'; +codeMirrorTranslation['regex_info'] = 'Use /re/ syntax for regexp search'; \ No newline at end of file diff --git a/conlite/external/codemirror/lib/util/closetag.js b/conlite/external/codemirror/lib/util/closetag.js new file mode 100644 index 0000000..656e93c --- /dev/null +++ b/conlite/external/codemirror/lib/util/closetag.js @@ -0,0 +1,164 @@ +/** + * Tag-closer extension for CodeMirror. + * + * This extension adds a "closeTag" utility function that can be used with key bindings to + * insert a matching end tag after the ">" character of a start tag has been typed. It can + * also complete " + * Contributed under the same license terms as CodeMirror. + */ +(function() { + /** Option that allows tag closing behavior to be toggled. Default is true. */ + CodeMirror.defaults['closeTagEnabled'] = true; + + /** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */ + CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul']; + + /** Array of tag names where an end tag is forbidden. */ + CodeMirror.defaults['closeTagVoid'] = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; + + /** + * Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass. + * - cm: The editor instance. + * - ch: The character being processed. + * - indent: Optional. An array of tag names to indent when closing. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option. + * Pass false to disable indentation. Pass an array to override the default list of tag names. + * - vd: Optional. An array of tag names that should not be closed. Omit to use the default void (end tag forbidden) tag list defined in the 'closeTagVoid' option. Ignored in xml mode. + */ + CodeMirror.defineExtension("closeTag", function(cm, ch, indent, vd) { + if (!cm.getOption('closeTagEnabled')) { + throw CodeMirror.Pass; + } + + var mode = cm.getOption('mode'); + + if (mode == 'text/html' || mode == 'xml') { + + /* + * Relevant structure of token: + * + * htmlmixed + * className + * state + * htmlState + * type + * tagName + * context + * tagName + * mode + * + * xml + * className + * state + * tagName + * type + */ + + var pos = cm.getCursor(); + var tok = cm.getTokenAt(pos); + var state = tok.state; + + if (state.mode && state.mode != 'html') { + throw CodeMirror.Pass; // With htmlmixed, we only care about the html sub-mode. + } + + if (ch == '>') { + var type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml + + if (tok.className == 'tag' && type == 'closeTag') { + throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag. + } + + cm.replaceSelection('>'); // Mode state won't update until we finish the tag. + pos = {line: pos.line, ch: pos.ch + 1}; + cm.setCursor(pos); + + tok = cm.getTokenAt(cm.getCursor()); + state = tok.state; + type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml + + if (tok.className == 'tag' && type != 'selfcloseTag') { + var tagName = state.htmlState ? state.htmlState.tagName : state.tagName; // htmlmixed : xml + if (tagName.length > 0 && shouldClose(cm, vd, tagName)) { + insertEndTag(cm, indent, pos, tagName); + } + return; + } + + // Undo the '>' insert and allow cm to handle the key instead. + cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos); + cm.replaceSelection(""); + + } else if (ch == '/') { + if (tok.className == 'tag' && tok.string == '<') { + var tagName = state.htmlState ? (state.htmlState.context ? state.htmlState.context.tagName : '') : (state.context ? state.context.tagName : ''); // htmlmixed : xml + if (tagName.length > 0) { + completeEndTag(cm, pos, tagName); + return; + } + } + } + + } + + throw CodeMirror.Pass; // Bubble if not handled + }); + + function insertEndTag(cm, indent, pos, tagName) { + if (shouldIndent(cm, indent, tagName)) { + cm.replaceSelection('\n\n', 'end'); + cm.indentLine(pos.line + 1); + cm.indentLine(pos.line + 2); + cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length}); + } else { + cm.replaceSelection(''); + cm.setCursor(pos); + } + } + + function shouldIndent(cm, indent, tagName) { + if (typeof indent == 'undefined' || indent == null || indent == true) { + indent = cm.getOption('closeTagIndent'); + } + if (!indent) { + indent = []; + } + return indexOf(indent, tagName.toLowerCase()) != -1; + } + + function shouldClose(cm, vd, tagName) { + if (cm.getOption('mode') == 'xml') { + return true; // always close xml tags + } + if (typeof vd == 'undefined' || vd == null) { + vd = cm.getOption('closeTagVoid'); + } + if (!vd) { + vd = []; + } + return indexOf(vd, tagName.toLowerCase()) == -1; + } + + // C&P from codemirror.js...would be nice if this were visible to utilities. + function indexOf(collection, elt) { + if (collection.indexOf) return collection.indexOf(elt); + for (var i = 0, e = collection.length; i < e; ++i) + if (collection[i] == elt) return i; + return -1; + } + + function completeEndTag(cm, pos, tagName) { + cm.replaceSelection('/' + tagName + '>'); + cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 }); + } + +})(); diff --git a/conlite/external/codemirror/lib/util/dialog.css b/conlite/external/codemirror/lib/util/dialog.css new file mode 100644 index 0000000..8c4f847 --- /dev/null +++ b/conlite/external/codemirror/lib/util/dialog.css @@ -0,0 +1,27 @@ +.CodeMirror-dialog { + position: relative; +} + +.CodeMirror-dialog > div { + position: absolute; + top: 0; left: 0; right: 0; + background: white; + border-bottom: 1px solid #eee; + z-index: 15; + padding: .1em .8em; + overflow: hidden; + color: #333; +} + +.CodeMirror-dialog input { + border: none; + outline: none; + background: transparent; + width: 20em; + color: inherit; + font-family: monospace; +} + +.CodeMirror-dialog button { + font-size: 70%; +} \ No newline at end of file diff --git a/conlite/external/codemirror/lib/util/dialog.js b/conlite/external/codemirror/lib/util/dialog.js new file mode 100644 index 0000000..36ea10f --- /dev/null +++ b/conlite/external/codemirror/lib/util/dialog.js @@ -0,0 +1,67 @@ +// Open simple dialogs on top of an editor. Relies on dialog.css. + +(function() { + function dialogDiv(cm, template) { + var wrap = cm.getWrapperElement(); + var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild); + dialog.className = "CodeMirror-dialog"; + dialog.innerHTML = '
' + template + '
'; + return dialog; + } + + CodeMirror.defineExtension("openDialog", function(template, callback) { + var dialog = dialogDiv(this, template); + var closed = false, me = this; + function close() { + if (closed) return; + closed = true; + dialog.parentNode.removeChild(dialog); + } + var inp = dialog.getElementsByTagName("input")[0], button; + if (inp) { + CodeMirror.connect(inp, "keydown", function(e) { + if (e.keyCode == 13 || e.keyCode == 27) { + CodeMirror.e_stop(e); + close(); + me.focus(); + if (e.keyCode == 13) callback(inp.value); + } + }); + inp.focus(); + CodeMirror.connect(inp, "blur", close); + } else if (button = dialog.getElementsByTagName("button")[0]) { + CodeMirror.connect(button, "click", close); + button.focus(); + CodeMirror.connect(button, "blur", close); + } + return close; + }); + + CodeMirror.defineExtension("openConfirm", function(template, callbacks) { + var dialog = dialogDiv(this, template); + var buttons = dialog.getElementsByTagName("button"); + var closed = false, me = this, blurring = 1; + function close() { + if (closed) return; + closed = true; + dialog.parentNode.removeChild(dialog); + me.focus(); + } + buttons[0].focus(); + for (var i = 0; i < buttons.length; ++i) { + var b = buttons[i]; + (function(callback) { + CodeMirror.connect(b, "click", function(e) { + CodeMirror.e_preventDefault(e); + close(); + if (callback) callback(me); + }); + })(callbacks[i]); + CodeMirror.connect(b, "blur", function() { + --blurring; + setTimeout(function() { if (blurring <= 0) close(); }, 200); + }); + CodeMirror.connect(b, "focus", function() { ++blurring; }); + } + }); +})(); \ No newline at end of file diff --git a/conlite/external/codemirror/lib/util/foldcode.js b/conlite/external/codemirror/lib/util/foldcode.js new file mode 100644 index 0000000..02cfb50 --- /dev/null +++ b/conlite/external/codemirror/lib/util/foldcode.js @@ -0,0 +1,196 @@ +// the tagRangeFinder function is +// Copyright (C) 2011 by Daniel Glazman +// released under the MIT license (../../LICENSE) like the rest of CodeMirror +CodeMirror.tagRangeFinder = function(cm, line, hideEnd) { + var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; + var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; + var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*"); + + var lineText = cm.getLine(line); + var found = false; + var tag = null; + var pos = 0; + while (!found) { + pos = lineText.indexOf("<", pos); + if (-1 == pos) // no tag on line + return; + if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag + pos++; + continue; + } + // ok we weem to have a start tag + if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name... + pos++; + continue; + } + var gtPos = lineText.indexOf(">", pos + 1); + if (-1 == gtPos) { // end of start tag not in line + var l = line + 1; + var foundGt = false; + var lastLine = cm.lineCount(); + while (l < lastLine && !foundGt) { + var lt = cm.getLine(l); + var gt = lt.indexOf(">"); + if (-1 != gt) { // found a > + foundGt = true; + var slash = lt.lastIndexOf("/", gt); + if (-1 != slash && slash < gt) { + var str = lineText.substr(slash, gt - slash + 1); + if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag + if (hideEnd === true) l++; + return l; + } + } + } + l++; + } + found = true; + } + else { + var slashPos = lineText.lastIndexOf("/", gtPos); + if (-1 == slashPos) { // cannot be empty tag + found = true; + // don't continue + } + else { // empty tag? + // check if really empty tag + var str = lineText.substr(slashPos, gtPos - slashPos + 1); + if (!str.match( /\/\s*\>/ )) { // finally not empty + found = true; + // don't continue + } + } + } + if (found) { + var subLine = lineText.substr(pos + 1); + tag = subLine.match(xmlNAMERegExp); + if (tag) { + // we have an element name, wooohooo ! + tag = tag[0]; + // do we have the close tag on same line ??? + if (-1 != lineText.indexOf("", pos)) // yep + { + found = false; + } + // we don't, so we have a candidate... + } + else + found = false; + } + if (!found) + pos++; + } + + if (found) { + var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)"; + var startTagRegExp = new RegExp(startTag, "g"); + var endTag = ""; + var depth = 1; + var l = line + 1; + var lastLine = cm.lineCount(); + while (l < lastLine) { + lineText = cm.getLine(l); + var match = lineText.match(startTagRegExp); + if (match) { + for (var i = 0; i < match.length; i++) { + if (match[i] == endTag) + depth--; + else + depth++; + if (!depth) { + if (hideEnd === true) l++; + return l; + } + } + } + l++; + } + return; + } +}; + +CodeMirror.braceRangeFinder = function(cm, line, hideEnd) { + var lineText = cm.getLine(line), at = lineText.length, startChar, tokenType; + for (;;) { + var found = lineText.lastIndexOf("{", at); + if (found < 0) break; + tokenType = cm.getTokenAt({line: line, ch: found}).className; + if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; } + at = found - 1; + } + if (startChar == null || lineText.lastIndexOf("}") > startChar) return; + var count = 1, lastLine = cm.lineCount(), end; + outer: for (var i = line + 1; i < lastLine; ++i) { + var text = cm.getLine(i), pos = 0; + for (;;) { + var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos); + if (nextOpen < 0) nextOpen = text.length; + if (nextClose < 0) nextClose = text.length; + pos = Math.min(nextOpen, nextClose); + if (pos == text.length) break; + if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) { + if (pos == nextOpen) ++count; + else if (!--count) { end = i; break outer; } + } + ++pos; + } + } + if (end == null || end == line + 1) return; + if (hideEnd === true) end++; + return end; +}; + +CodeMirror.indentRangeFinder = function(cm, line) { + var tabSize = cm.getOption("tabSize"); + var myIndent = cm.getLineHandle(line).indentation(tabSize), last; + for (var i = line + 1, end = cm.lineCount(); i < end; ++i) { + var handle = cm.getLineHandle(i); + if (!/^\s*$/.test(handle.text)) { + if (handle.indentation(tabSize) <= myIndent) break; + last = i; + } + } + if (!last) return null; + return last + 1; +}; + +CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) { + var folded = []; + if (markText == null) markText = '
%N%'; + + function isFolded(cm, n) { + for (var i = 0; i < folded.length; ++i) { + var start = cm.lineInfo(folded[i].start); + if (!start) folded.splice(i--, 1); + else if (start.line == n) return {pos: i, region: folded[i]}; + } + } + + function expand(cm, region) { + cm.clearMarker(region.start); + for (var i = 0; i < region.hidden.length; ++i) + cm.showLine(region.hidden[i]); + } + + return function(cm, line) { + cm.operation(function() { + var known = isFolded(cm, line); + if (known) { + folded.splice(known.pos, 1); + expand(cm, known.region); + } else { + var end = rangeFinder(cm, line, hideEnd); + if (end == null) return; + var hidden = []; + for (var i = line + 1; i < end; ++i) { + var handle = cm.hideLine(i); + if (handle) hidden.push(handle); + } + var first = cm.setMarker(line, markText); + var region = {start: first, hidden: hidden}; + cm.onDeleteLine(first, function() { expand(cm, region); }); + folded.push(region); + } + }); + }; +}; diff --git a/conlite/external/codemirror/lib/util/formatting.js b/conlite/external/codemirror/lib/util/formatting.js new file mode 100644 index 0000000..ccac9b1 --- /dev/null +++ b/conlite/external/codemirror/lib/util/formatting.js @@ -0,0 +1,299 @@ +// ============== Formatting extensions ============================ +// A common storage for all mode-specific formatting features +if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {}; + +// Returns the extension of the editor's current mode +CodeMirror.defineExtension("getModeExt", function () { + var mname = CodeMirror.resolveMode(this.getOption("mode")).name; + var ext = CodeMirror.modeExtensions[mname]; + if (!ext) throw new Error("No extensions found for mode " + mname); + return ext; +}); + +// If the current mode is 'htmlmixed', returns the extension of a mode located at +// the specified position (can be htmlmixed, css or javascript). Otherwise, simply +// returns the extension of the editor's current mode. +CodeMirror.defineExtension("getModeExtAtPos", function (pos) { + var token = this.getTokenAt(pos); + if (token && token.state && token.state.mode) + return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode]; + else + return this.getModeExt(); +}); + +// Comment/uncomment the specified range +CodeMirror.defineExtension("commentRange", function (isComment, from, to) { + var curMode = this.getModeExtAtPos(this.getCursor()); + if (isComment) { // Comment range + var commentedText = this.getRange(from, to); + this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd + , from, to); + if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside + this.setCursor(from.line, from.ch + curMode.commentStart.length); + } + } + else { // Uncomment range + var selText = this.getRange(from, to); + var startIndex = selText.indexOf(curMode.commentStart); + var endIndex = selText.lastIndexOf(curMode.commentEnd); + if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) { + // Take string till comment start + selText = selText.substr(0, startIndex) + // From comment start till comment end + + selText.substring(startIndex + curMode.commentStart.length, endIndex) + // From comment end till string end + + selText.substr(endIndex + curMode.commentEnd.length); + } + this.replaceRange(selText, from, to); + } +}); + +// Applies automatic mode-aware indentation to the specified range +CodeMirror.defineExtension("autoIndentRange", function (from, to) { + var cmInstance = this; + this.operation(function () { + for (var i = from.line; i <= to.line; i++) { + cmInstance.indentLine(i, "smart"); + } + }); +}); + +// Applies automatic formatting to the specified range +CodeMirror.defineExtension("autoFormatRange", function (from, to) { + var absStart = this.indexFromPos(from); + var absEnd = this.indexFromPos(to); + // Insert additional line breaks where necessary according to the + // mode's syntax + var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd); + var cmInstance = this; + + // Replace and auto-indent the range + this.operation(function () { + cmInstance.replaceRange(res, from, to); + var startLine = cmInstance.posFromIndex(absStart).line; + var endLine = cmInstance.posFromIndex(absStart + res.length).line; + for (var i = startLine; i <= endLine; i++) { + cmInstance.indentLine(i, "smart"); + } + }); +}); + +// Define extensions for a few modes + +CodeMirror.modeExtensions["css"] = { + commentStart: "/*", + commentEnd: "*/", + wordWrapChars: [";", "\\{", "\\}"], + autoFormatLineBreaks: function (text, startPos, endPos) { + text = text.substring(startPos, endPos); + return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2"); + } +}; + +CodeMirror.modeExtensions["javascript"] = { + commentStart: "/*", + commentEnd: "*/", + wordWrapChars: [";", "\\{", "\\}"], + + getNonBreakableBlocks: function (text) { + var nonBreakableRegexes = [ + new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"), + new RegExp("\\\\\"([\\s\\S]*?)(\\\\\"|$)"), + new RegExp("\\\\\'([\\s\\S]*?)(\\\\\'|$)"), + new RegExp("'([\\s\\S]*?)('|$)"), + new RegExp("\"([\\s\\S]*?)(\"|$)"), + new RegExp("//.*([\r\n]|$)") + ]; + var nonBreakableBlocks = new Array(); + for (var i = 0; i < nonBreakableRegexes.length; i++) { + var curPos = 0; + while (curPos < text.length) { + var m = text.substr(curPos).match(nonBreakableRegexes[i]); + if (m != null) { + nonBreakableBlocks.push({ + start: curPos + m.index, + end: curPos + m.index + m[0].length + }); + curPos += m.index + Math.max(1, m[0].length); + } + else { // No more matches + break; + } + } + } + nonBreakableBlocks.sort(function (a, b) { + return a.start - b.start; + }); + + return nonBreakableBlocks; + }, + + autoFormatLineBreaks: function (text, startPos, endPos) { + text = text.substring(startPos, endPos); + var curPos = 0; + var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g"); + var nonBreakableBlocks = this.getNonBreakableBlocks(text); + if (nonBreakableBlocks != null) { + var res = ""; + for (var i = 0; i < nonBreakableBlocks.length; i++) { + if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block + res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2"); + curPos = nonBreakableBlocks[i].start; + } + if (nonBreakableBlocks[i].start <= curPos + && nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block + res += text.substring(curPos, nonBreakableBlocks[i].end); + curPos = nonBreakableBlocks[i].end; + } + } + if (curPos < text.length - 1) { + res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2"); + } + return res; + } + else { + return text.replace(reLinesSplitter, "$1\n$2"); + } + } +}; + +CodeMirror.modeExtensions["xml"] = { + commentStart: "", + wordWrapChars: [">"], + + autoFormatLineBreaks: function (text, startPos, endPos) { + text = text.substring(startPos, endPos); + var lines = text.split("\n"); + var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)"); + var reOpenBrackets = new RegExp("<", "g"); + var reCloseBrackets = new RegExp("(>)([^\r\n])", "g"); + for (var i = 0; i < lines.length; i++) { + var mToProcess = lines[i].match(reProcessedPortion); + if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces + lines[i] = mToProcess[1] + + mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2") + + mToProcess[3]; + continue; + } + } + + return lines.join("\n"); + } +}; + +CodeMirror.modeExtensions["htmlmixed"] = { + commentStart: "", + wordWrapChars: [">", ";", "\\{", "\\}"], + + getModeInfos: function (text, absPos) { + var modeInfos = new Array(); + modeInfos[0] = + { + pos: 0, + modeExt: CodeMirror.modeExtensions["xml"], + modeName: "xml" + }; + + var modeMatchers = new Array(); + modeMatchers[0] = + { + regex: new RegExp("]*>([\\s\\S]*?)(]*>|$)", "i"), + modeExt: CodeMirror.modeExtensions["css"], + modeName: "css" + }; + modeMatchers[1] = + { + regex: new RegExp("]*>([\\s\\S]*?)(]*>|$)", "i"), + modeExt: CodeMirror.modeExtensions["javascript"], + modeName: "javascript" + }; + + var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1); + // Detect modes for the entire text + for (var i = 0; i < modeMatchers.length; i++) { + var curPos = 0; + while (curPos <= lastCharPos) { + var m = text.substr(curPos).match(modeMatchers[i].regex); + if (m != null) { + if (m.length > 1 && m[1].length > 0) { + // Push block begin pos + var blockBegin = curPos + m.index + m[0].indexOf(m[1]); + modeInfos.push( + { + pos: blockBegin, + modeExt: modeMatchers[i].modeExt, + modeName: modeMatchers[i].modeName + }); + // Push block end pos + modeInfos.push( + { + pos: blockBegin + m[1].length, + modeExt: modeInfos[0].modeExt, + modeName: modeInfos[0].modeName + }); + curPos += m.index + m[0].length; + continue; + } + else { + curPos += m.index + Math.max(m[0].length, 1); + } + } + else { // No more matches + break; + } + } + } + // Sort mode infos + modeInfos.sort(function sortModeInfo(a, b) { + return a.pos - b.pos; + }); + + return modeInfos; + }, + + autoFormatLineBreaks: function (text, startPos, endPos) { + var modeInfos = this.getModeInfos(text); + var reBlockStartsWithNewline = new RegExp("^\\s*?\n"); + var reBlockEndsWithNewline = new RegExp("\n\\s*?$"); + var res = ""; + // Use modes info to break lines correspondingly + if (modeInfos.length > 1) { // Deal with multi-mode text + for (var i = 1; i <= modeInfos.length; i++) { + var selStart = modeInfos[i - 1].pos; + var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos); + + if (selStart >= endPos) { // The block starts later than the needed fragment + break; + } + if (selStart < startPos) { + if (selEnd <= startPos) { // The block starts earlier than the needed fragment + continue; + } + selStart = startPos; + } + if (selEnd > endPos) { + selEnd = endPos; + } + var textPortion = text.substring(selStart, selEnd); + if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block + if (!reBlockStartsWithNewline.test(textPortion) + && selStart > 0) { // The block does not start with a line break + textPortion = "\n" + textPortion; + } + if (!reBlockEndsWithNewline.test(textPortion) + && selEnd < text.length - 1) { // The block does not end with a line break + textPortion += "\n"; + } + } + res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion); + } + } + else { // Single-mode text + res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos)); + } + + return res; + } +}; diff --git a/conlite/external/codemirror/lib/util/javascript-hint.js b/conlite/external/codemirror/lib/util/javascript-hint.js new file mode 100644 index 0000000..2117e5a --- /dev/null +++ b/conlite/external/codemirror/lib/util/javascript-hint.js @@ -0,0 +1,134 @@ +(function () { + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; + // If it's not a 'word-style' token, ignore the token. + if (!/^[\w$_]*$/.test(token.string)) { + token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state, + className: token.string == "." ? "property" : null}; + } + // If it is a property, find out what it is a property of. + while (tprop.className == "property") { + tprop = getToken(editor, {line: cur.line, ch: tprop.start}); + if (tprop.string != ".") return; + tprop = getToken(editor, {line: cur.line, ch: tprop.start}); + if (tprop.string == ')') { + var level = 1; + do { + tprop = getToken(editor, {line: cur.line, ch: tprop.start}); + switch (tprop.string) { + case ')': level++; break; + case '(': level--; break; + default: break; + } + } while (level > 0) + tprop = getToken(editor, {line: cur.line, ch: tprop.start}); + if (tprop.className == 'variable') + tprop.className = 'function'; + else return; // no clue + } + if (!context) var context = []; + context.push(tprop); + } + return {list: getCompletions(token, context, keywords), + from: {line: cur.line, ch: token.start}, + to: {line: cur.line, ch: token.end}}; + } + + CodeMirror.javascriptHint = function(editor) { + return scriptHint(editor, javascriptKeywords, + function (e, cur) {return e.getTokenAt(cur);}); + } + + function getCoffeeScriptToken(editor, cur) { + // This getToken, it is for coffeescript, imitates the behavior of + // getTokenAt method in javascript.js, that is, returning "property" + // type and treat "." as indepenent token. + var token = editor.getTokenAt(cur); + if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') { + token.end = token.start; + token.string = '.'; + token.className = "property"; + } + else if (/^\.[\w$_]*$/.test(token.string)) { + token.className = "property"; + token.start++; + token.string = token.string.replace(/\./, ''); + } + return token; + } + + CodeMirror.coffeescriptHint = function(editor) { + return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken); + } + + var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " + + "toUpperCase toLowerCase split concat match replace search").split(" "); + var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " + + "lastIndexOf every some filter forEach map reduce reduceRight ").split(" "); + var funcProps = "prototype apply call bind".split(" "); + var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " + + "if in instanceof new null return switch throw true try typeof var void while with").split(" "); + var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " + + "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" "); + + function getCompletions(token, context, keywords) { + var found = [], start = token.string; + function maybeAdd(str) { + if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str); + } + function gatherCompletions(obj) { + if (typeof obj == "string") forEach(stringProps, maybeAdd); + else if (obj instanceof Array) forEach(arrayProps, maybeAdd); + else if (obj instanceof Function) forEach(funcProps, maybeAdd); + for (var name in obj) maybeAdd(name); + } + + if (context) { + // If this is a property, see if it belongs to some object we can + // find in the current environment. + var obj = context.pop(), base; + if (obj.className == "variable") + base = window[obj.string]; + else if (obj.className == "string") + base = ""; + else if (obj.className == "atom") + base = 1; + else if (obj.className == "function") { + if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') && + (typeof window.jQuery == 'function')) + base = window.jQuery(); + else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function')) + base = window._(); + } + while (base != null && context.length) + base = base[context.pop().string]; + if (base != null) gatherCompletions(base); + } + else { + // If not, just look in the window object and any local scope + // (reading into JS mode internals to get at the local variables) + for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name); + gatherCompletions(window); + forEach(keywords, maybeAdd); + } + return found; + } +})(); diff --git a/conlite/external/codemirror/lib/util/loadmode.js b/conlite/external/codemirror/lib/util/loadmode.js new file mode 100644 index 0000000..48d5a7a --- /dev/null +++ b/conlite/external/codemirror/lib/util/loadmode.js @@ -0,0 +1,51 @@ +(function() { + if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; + + var loading = {}; + function splitCallback(cont, n) { + var countDown = n; + return function() { if (--countDown == 0) cont(); } + } + function ensureDeps(mode, cont) { + var deps = CodeMirror.modes[mode].dependencies; + if (!deps) return cont(); + var missing = []; + for (var i = 0; i < deps.length; ++i) { + if (!CodeMirror.modes.hasOwnProperty(deps[i])) + missing.push(deps[i]); + } + if (!missing.length) return cont(); + var split = splitCallback(cont, missing.length); + for (var i = 0; i < missing.length; ++i) + CodeMirror.requireMode(missing[i], split); + } + + CodeMirror.requireMode = function(mode, cont) { + if (typeof mode != "string") mode = mode.name; + if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); + if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); + + var script = document.createElement("script"); + script.src = CodeMirror.modeURL.replace(/%N/g, mode); + var others = document.getElementsByTagName("script")[0]; + others.parentNode.insertBefore(script, others); + var list = loading[mode] = [cont]; + var count = 0, poll = setInterval(function() { + if (++count > 100) return clearInterval(poll); + if (CodeMirror.modes.hasOwnProperty(mode)) { + clearInterval(poll); + loading[mode] = null; + ensureDeps(mode, function() { + for (var i = 0; i < list.length; ++i) list[i](); + }); + } + }, 200); + }; + + CodeMirror.autoLoadMode = function(instance, mode) { + if (!CodeMirror.modes.hasOwnProperty(mode)) + CodeMirror.requireMode(mode, function() { + instance.setOption("mode", instance.getOption("mode")); + }); + }; +}()); diff --git a/conlite/external/codemirror/lib/util/match-highlighter.js b/conlite/external/codemirror/lib/util/match-highlighter.js new file mode 100644 index 0000000..59098ff --- /dev/null +++ b/conlite/external/codemirror/lib/util/match-highlighter.js @@ -0,0 +1,44 @@ +// Define match-highlighter commands. Depends on searchcursor.js +// Use by attaching the following function call to the onCursorActivity event: + //myCodeMirror.matchHighlight(minChars); +// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html) + +(function() { + var DEFAULT_MIN_CHARS = 2; + + function MatchHighlightState() { + this.marked = []; + } + function getMatchHighlightState(cm) { + return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState()); + } + + function clearMarks(cm) { + var state = getMatchHighlightState(cm); + for (var i = 0; i < state.marked.length; ++i) + state.marked[i].clear(); + state.marked = []; + } + + function markDocument(cm, className, minChars) { + clearMarks(cm); + minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS); + if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) { + var state = getMatchHighlightState(cm); + var query = cm.getSelection(); + cm.operation(function() { + if (cm.lineCount() < 2000) { // This is too expensive on big documents. + for (var cursor = cm.getSearchCursor(query); cursor.findNext();) { + //Only apply matchhighlight to the matches other than the one actually selected + if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch)) + state.marked.push(cm.markText(cursor.from(), cursor.to(), className)); + } + } + }); + } + } + + CodeMirror.defineExtension("matchHighlight", function(className, minChars) { + markDocument(this, className, minChars); + }); +})(); diff --git a/conlite/external/codemirror/lib/util/multiplex.js b/conlite/external/codemirror/lib/util/multiplex.js new file mode 100644 index 0000000..c8bb1e9 --- /dev/null +++ b/conlite/external/codemirror/lib/util/multiplex.js @@ -0,0 +1,81 @@ +CodeMirror.multiplexingMode = function(outer /*, others */) { + // Others should be {open, close, mode [, delimStyle]} objects + var others = Array.prototype.slice.call(arguments, 1); + var n_others = others.length; + + function indexOf(string, pattern, from) { + if (typeof pattern == "string") return string.indexOf(pattern, from); + var m = pattern.exec(from ? string.slice(from) : string); + return m ? m.index + from : -1; + } + + return { + startState: function() { + return { + outer: CodeMirror.startState(outer), + innerActive: null, + inner: null + }; + }, + + copyState: function(state) { + return { + outer: CodeMirror.copyState(outer, state.outer), + innerActive: state.innerActive, + inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) + }; + }, + + token: function(stream, state) { + if (!state.innerActive) { + var cutOff = Infinity, oldContent = stream.string; + for (var i = 0; i < n_others; ++i) { + var other = others[i]; + var found = indexOf(oldContent, other.open, stream.pos); + if (found == stream.pos) { + stream.match(other.open); + state.innerActive = other; + state.inner = CodeMirror.startState(other.mode, outer.indent(state.outer, "")); + return other.delimStyle; + } else if (found != -1 && found < cutOff) { + cutOff = found; + } + } + if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff); + var outerToken = outer.token(stream, state.outer); + if (cutOff != Infinity) stream.string = oldContent; + return outerToken; + } else { + var curInner = state.innerActive, oldContent = stream.string; + var found = indexOf(oldContent, curInner.close, stream.pos); + if (found == stream.pos) { + stream.match(curInner.close); + state.innerActive = state.inner = null; + return curInner.delimStyle; + } + if (found > -1) stream.string = oldContent.slice(0, found); + var innerToken = curInner.mode.token(stream, state.inner); + if (found > -1) stream.string = oldContent; + var cur = stream.current(), found = cur.indexOf(curInner.close); + if (found > -1) stream.backUp(cur.length - found); + return innerToken; + } + }, + + indent: function(state, textAfter) { + var mode = state.innerActive ? state.innerActive.mode : outer; + if (!mode.indent) return CodeMirror.Pass; + return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); + }, + + compareStates: function(a, b) { + if (a.innerActive != b.innerActive) return false; + var mode = a.innerActive || outer; + if (!mode.compareStates) return CodeMirror.Pass; + return mode.compareStates(a.innerActive ? a.inner : a.outer, + b.innerActive ? b.inner : b.outer); + }, + + electricChars: outer.electricChars + }; +}; diff --git a/conlite/external/codemirror/lib/util/overlay.js b/conlite/external/codemirror/lib/util/overlay.js new file mode 100644 index 0000000..1d5df6c --- /dev/null +++ b/conlite/external/codemirror/lib/util/overlay.js @@ -0,0 +1,52 @@ +// Utility function that allows modes to be combined. The mode given +// as the base argument takes care of most of the normal mode +// functionality, but a second (typically simple) mode is used, which +// can override the style of text. Both modes get to parse all of the +// text, but when both assign a non-null style to a piece of code, the +// overlay wins, unless the combine argument was true, in which case +// the styles are combined. + +// overlayParser is the old, deprecated name +CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) { + return { + startState: function() { + return { + base: CodeMirror.startState(base), + overlay: CodeMirror.startState(overlay), + basePos: 0, baseCur: null, + overlayPos: 0, overlayCur: null + }; + }, + copyState: function(state) { + return { + base: CodeMirror.copyState(base, state.base), + overlay: CodeMirror.copyState(overlay, state.overlay), + basePos: state.basePos, baseCur: null, + overlayPos: state.overlayPos, overlayCur: null + }; + }, + + token: function(stream, state) { + if (stream.start == state.basePos) { + state.baseCur = base.token(stream, state.base); + state.basePos = stream.pos; + } + if (stream.start == state.overlayPos) { + stream.pos = stream.start; + state.overlayCur = overlay.token(stream, state.overlay); + state.overlayPos = stream.pos; + } + stream.pos = Math.min(state.basePos, state.overlayPos); + if (stream.eol()) state.basePos = state.overlayPos = 0; + + if (state.overlayCur == null) return state.baseCur; + if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; + else return state.overlayCur; + }, + + indent: base.indent && function(state, textAfter) { + return base.indent(state.base, textAfter); + }, + electricChars: base.electricChars + }; +}; diff --git a/conlite/external/codemirror/lib/util/pig-hint.js b/conlite/external/codemirror/lib/util/pig-hint.js new file mode 100644 index 0000000..d696c3a --- /dev/null +++ b/conlite/external/codemirror/lib/util/pig-hint.js @@ -0,0 +1,123 @@ +(function () { + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; + // If it's not a 'word-style' token, ignore the token. + + if (!/^[\w$_]*$/.test(token.string)) { + token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state, + className: token.string == ":" ? "pig-type" : null}; + } + + if (!context) var context = []; + context.push(tprop); + + var completionList = getCompletions(token, context); + completionList = completionList.sort(); + //prevent autocomplete for last word, instead show dropdown with one word + if(completionList.length == 1) { + completionList.push(" "); + } + + return {list: completionList, + from: {line: cur.line, ch: token.start}, + to: {line: cur.line, ch: token.end}}; + } + + CodeMirror.pigHint = function(editor) { + return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);}); + } + + function toTitleCase(str) { + return str.replace(/(?:^|\s)\w/g, function(match) { + return match.toUpperCase(); + }); + } + + var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " + + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " + + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " + + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " + + "NEQ MATCHES TRUE FALSE"; + var pigKeywordsU = pigKeywords.split(" "); + var pigKeywordsL = pigKeywords.toLowerCase().split(" "); + + var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP"; + var pigTypesU = pigTypes.split(" "); + var pigTypesL = pigTypes.toLowerCase().split(" "); + + var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " + + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " + + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " + + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " + + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " + + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " + + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " + + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " + + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " + + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER"; + var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" "); + var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" "); + var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs " + + "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax " + + "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum " + + "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker " + + "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize " + + "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax " + + "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" "); + + function getCompletions(token, context) { + var found = [], start = token.string; + function maybeAdd(str) { + if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str); + } + + function gatherCompletions(obj) { + if(obj == ":") { + forEach(pigTypesL, maybeAdd); + } + else { + forEach(pigBuiltinsU, maybeAdd); + forEach(pigBuiltinsL, maybeAdd); + forEach(pigBuiltinsC, maybeAdd); + forEach(pigTypesU, maybeAdd); + forEach(pigTypesL, maybeAdd); + forEach(pigKeywordsU, maybeAdd); + forEach(pigKeywordsL, maybeAdd); + } + } + + if (context) { + // If this is a property, see if it belongs to some object we can + // find in the current environment. + var obj = context.pop(), base; + + if (obj.className == "pig-word") + base = obj.string; + else if(obj.className == "pig-type") + base = ":" + obj.string; + + while (base != null && context.length) + base = base[context.pop().string]; + if (base != null) gatherCompletions(base); + } + return found; + } +})(); diff --git a/conlite/external/codemirror/lib/util/runmode.js b/conlite/external/codemirror/lib/util/runmode.js new file mode 100644 index 0000000..fc58d85 --- /dev/null +++ b/conlite/external/codemirror/lib/util/runmode.js @@ -0,0 +1,49 @@ +CodeMirror.runMode = function(string, modespec, callback, options) { + var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); + var isNode = callback.nodeType == 1; + var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; + if (isNode) { + var node = callback, accum = [], col = 0; + callback = function(text, style) { + if (text == "\n") { + accum.push("
"); + col = 0; + return; + } + var escaped = ""; + // HTML-escape and replace tabs + for (var pos = 0;;) { + var idx = text.indexOf("\t", pos); + if (idx == -1) { + escaped += CodeMirror.htmlEscape(text.slice(pos)); + col += text.length - pos; + break; + } else { + col += idx - pos; + escaped += CodeMirror.htmlEscape(text.slice(pos, idx)); + var size = tabSize - col % tabSize; + col += size; + for (var i = 0; i < size; ++i) escaped += " "; + pos = idx + 1; + } + } + + if (style) + accum.push("" + escaped + ""); + else + accum.push(escaped); + } + } + var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); + for (var i = 0, e = lines.length; i < e; ++i) { + if (i) callback("\n"); + var stream = new CodeMirror.StringStream(lines[i]); + while (!stream.eol()) { + var style = mode.token(stream, state); + callback(stream.current(), style, i, stream.start); + stream.start = stream.pos; + } + } + if (isNode) + node.innerHTML = accum.join(""); +}; diff --git a/conlite/external/codemirror/lib/util/search.js b/conlite/external/codemirror/lib/util/search.js new file mode 100644 index 0000000..9869505 --- /dev/null +++ b/conlite/external/codemirror/lib/util/search.js @@ -0,0 +1,118 @@ +// Define search commands. Depends on dialog.js or another +// implementation of the openDialog method. + +// Replace works a little oddly -- it will do the replace on the next +// Ctrl-G (or whatever is bound to findNext) press. You prevent a +// replace by making sure the match is no longer selected when hitting +// Ctrl-G. + +(function() { + function SearchState() { + this.posFrom = this.posTo = this.query = null; + this.marked = []; + } + function getSearchState(cm) { + return cm._searchState || (cm._searchState = new SearchState()); + } + function getSearchCursor(cm, query, pos) { + // Heuristic: if the query string is all lowercase, do a case insensitive search. + return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase()); + } + function dialog(cm, text, shortText, f) { + if (cm.openDialog) cm.openDialog(text, f); + else f(prompt(shortText, "")); + } + function confirmDialog(cm, text, shortText, fs) { + if (cm.openConfirm) cm.openConfirm(text, fs); + else if (confirm(shortText)) fs[0](); + } + function parseQuery(query) { + var isRE = query.match(/^\/(.*)\/([a-z]*)$/); + return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query; + } + var queryDialog = + codeMirrorTranslation['search'] + ': (' + codeMirrorTranslation['regex_info'] + ')'; + function doSearch(cm, rev) { + var state = getSearchState(cm); + if (state.query) return findNext(cm, rev); + dialog(cm, queryDialog, codeMirrorTranslation['search_for'] + ":", function(query) { + cm.operation(function() { + if (!query || state.query) return; + state.query = parseQuery(query); + if (cm.lineCount() < 2000) { // This is too expensive on big documents. + for (var cursor = getSearchCursor(cm, query); cursor.findNext();) + state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching")); + } + state.posFrom = state.posTo = cm.getCursor(); + findNext(cm, rev); + }); + }); + } + function findNext(cm, rev) {cm.operation(function() { + var state = getSearchState(cm); + var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); + if (!cursor.find(rev)) { + cursor = getSearchCursor(cm, state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0}); + if (!cursor.find(rev)) return; + } + cm.setSelection(cursor.from(), cursor.to()); + state.posFrom = cursor.from(); state.posTo = cursor.to(); + })} + function clearSearch(cm) {cm.operation(function() { + var state = getSearchState(cm); + if (!state.query) return; + state.query = null; + for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear(); + state.marked.length = 0; + })} + + var replaceQueryDialog = + codeMirrorTranslation['replace'] + ': (' + codeMirrorTranslation['regex_info'] + ')'; + var replacementQueryDialog = codeMirrorTranslation['with'] + ': '; + var doReplaceConfirm = codeMirrorTranslation['replace'] + "? "; + function replace(cm, all) { + dialog(cm, replaceQueryDialog, codeMirrorTranslation['replace'] + ":", function(query) { + if (!query) return; + query = parseQuery(query); + dialog(cm, replacementQueryDialog, codeMirrorTranslation['replace_with'] + ":", function(text) { + if (all) { + cm.compoundChange(function() { cm.operation(function() { + for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { + if (typeof query != "string") { + var match = cm.getRange(cursor.from(), cursor.to()).match(query); + cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];})); + } else cursor.replace(text); + } + })}); + } else { + clearSearch(cm); + var cursor = getSearchCursor(cm, query, cm.getCursor()); + function advance() { + var start = cursor.from(), match; + if (!(match = cursor.findNext())) { + cursor = getSearchCursor(cm, query); + if (!(match = cursor.findNext()) || + (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return; + } + cm.setSelection(cursor.from(), cursor.to()); + confirmDialog(cm, doReplaceConfirm, codeMirrorTranslation['replace'] + "?", + [function() {doReplace(match);}, advance]); + } + function doReplace(match) { + cursor.replace(typeof query == "string" ? text : + text.replace(/\$(\d)/, function(w, i) {return match[i];})); + advance(); + } + advance(); + } + }); + }); + } + + CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);}; + CodeMirror.commands.findNext = doSearch; + CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);}; + CodeMirror.commands.clearSearch = clearSearch; + CodeMirror.commands.replace = replace; + CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);}; +})(); diff --git a/conlite/external/codemirror/lib/util/searchcursor.js b/conlite/external/codemirror/lib/util/searchcursor.js new file mode 100644 index 0000000..ec3f73c --- /dev/null +++ b/conlite/external/codemirror/lib/util/searchcursor.js @@ -0,0 +1,117 @@ +(function(){ + function SearchCursor(cm, query, pos, caseFold) { + this.atOccurrence = false; this.cm = cm; + if (caseFold == null && typeof query == "string") caseFold = false; + + pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0}; + this.pos = {from: pos, to: pos}; + + // The matches method is filled in based on the type of query. + // It takes a position and a direction, and returns an object + // describing the next occurrence of the query, or null if no + // more matches were found. + if (typeof query != "string") // Regexp match + this.matches = function(reverse, pos) { + if (reverse) { + var line = cm.getLine(pos.line).slice(0, pos.ch), match = line.match(query), start = 0; + while (match) { + var ind = line.indexOf(match[0]); + start += ind; + line = line.slice(ind + 1); + var newmatch = line.match(query); + if (newmatch) match = newmatch; + else break; + start++; + } + } + else { + var line = cm.getLine(pos.line).slice(pos.ch), match = line.match(query), + start = match && pos.ch + line.indexOf(match[0]); + } + if (match) + return {from: {line: pos.line, ch: start}, + to: {line: pos.line, ch: start + match[0].length}, + match: match}; + }; + else { // String query + if (caseFold) query = query.toLowerCase(); + var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;}; + var target = query.split("\n"); + // Different methods for single-line and multi-line queries + if (target.length == 1) + this.matches = function(reverse, pos) { + var line = fold(cm.getLine(pos.line)), len = query.length, match; + if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1) + : (match = line.indexOf(query, pos.ch)) != -1) + return {from: {line: pos.line, ch: match}, + to: {line: pos.line, ch: match + len}}; + }; + else + this.matches = function(reverse, pos) { + var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln)); + var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match)); + if (reverse ? offsetA >= pos.ch || offsetA != match.length + : offsetA <= pos.ch || offsetA != line.length - match.length) + return; + for (;;) { + if (reverse ? !ln : ln == cm.lineCount() - 1) return; + line = fold(cm.getLine(ln += reverse ? -1 : 1)); + match = target[reverse ? --idx : ++idx]; + if (idx > 0 && idx < target.length - 1) { + if (line != match) return; + else continue; + } + var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length); + if (reverse ? offsetB != line.length - match.length : offsetB != match.length) + return; + var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB}; + return {from: reverse ? end : start, to: reverse ? start : end}; + } + }; + } + } + + SearchCursor.prototype = { + findNext: function() {return this.find(false);}, + findPrevious: function() {return this.find(true);}, + + find: function(reverse) { + var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to); + function savePosAndFail(line) { + var pos = {line: line, ch: 0}; + self.pos = {from: pos, to: pos}; + self.atOccurrence = false; + return false; + } + + for (;;) { + if (this.pos = this.matches(reverse, pos)) { + this.atOccurrence = true; + return this.pos.match || true; + } + if (reverse) { + if (!pos.line) return savePosAndFail(0); + pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length}; + } + else { + var maxLine = this.cm.lineCount(); + if (pos.line == maxLine - 1) return savePosAndFail(maxLine); + pos = {line: pos.line+1, ch: 0}; + } + } + }, + + from: function() {if (this.atOccurrence) return this.pos.from;}, + to: function() {if (this.atOccurrence) return this.pos.to;}, + + replace: function(newText) { + var self = this; + if (this.atOccurrence) + self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to); + } + }; + + CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { + return new SearchCursor(this, query, pos, caseFold); + }); +})(); diff --git a/conlite/external/codemirror/lib/util/simple-hint.css b/conlite/external/codemirror/lib/util/simple-hint.css new file mode 100644 index 0000000..4387cb9 --- /dev/null +++ b/conlite/external/codemirror/lib/util/simple-hint.css @@ -0,0 +1,16 @@ +.CodeMirror-completions { + position: absolute; + z-index: 10; + overflow: hidden; + -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0,0,0,.2); +} +.CodeMirror-completions select { + background: #fafafa; + outline: none; + border: none; + padding: 0; + margin: 0; + font-family: monospace; +} diff --git a/conlite/external/codemirror/lib/util/simple-hint.js b/conlite/external/codemirror/lib/util/simple-hint.js new file mode 100644 index 0000000..7eef32c --- /dev/null +++ b/conlite/external/codemirror/lib/util/simple-hint.js @@ -0,0 +1,76 @@ +(function() { + CodeMirror.simpleHint = function(editor, getHints) { + // We want a single cursor position. + if (editor.somethingSelected()) return; + //don't show completion if the token is empty + var tempToken = editor.getTokenAt(editor.getCursor()); + if(!(/[\S]/gi.test(tempToken.string))) return; + + var result = getHints(editor); + if (!result || !result.list.length) return; + var completions = result.list; + function insert(str) { + editor.replaceRange(str, result.from, result.to); + } + // When there is only one completion, use it directly. + if (completions.length == 1) {insert(completions[0]); return true;} + + // Build the select widget + var complete = document.createElement("div"); + complete.className = "CodeMirror-completions"; + var sel = complete.appendChild(document.createElement("select")); + // Opera doesn't move the selection when pressing up/down in a + // multi-select, but it does properly support the size property on + // single-selects, so no multi-select is necessary. + if (!window.opera) sel.multiple = true; + for (var i = 0; i < completions.length; ++i) { + var opt = sel.appendChild(document.createElement("option")); + opt.appendChild(document.createTextNode(completions[i])); + } + sel.firstChild.selected = true; + sel.size = Math.min(10, completions.length); + var pos = editor.cursorCoords(); + complete.style.left = pos.x + "px"; + complete.style.top = pos.yBot + "px"; + document.body.appendChild(complete); + // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor. + var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth); + if(winW - pos.x < sel.clientWidth) + complete.style.left = (pos.x - sel.clientWidth) + "px"; + // Hack to hide the scrollbar. + if (completions.length <= 10) + complete.style.width = (sel.clientWidth - 1) + "px"; + + var done = false; + function close() { + if (done) return; + done = true; + complete.parentNode.removeChild(complete); + } + function pick() { + insert(completions[sel.selectedIndex]); + close(); + setTimeout(function(){editor.focus();}, 50); + } + CodeMirror.connect(sel, "blur", close); + CodeMirror.connect(sel, "keydown", function(event) { + var code = event.keyCode; + // Enter + if (code == 13) {CodeMirror.e_stop(event); pick();} + // Escape + else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();} + else if (code != 38 && code != 40) { + close(); editor.focus(); + // Pass the event to the CodeMirror instance so that it can handle things like backspace properly. + editor.triggerOnKeyDown(event); + setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50); + } + }); + CodeMirror.connect(sel, "dblclick", pick); + + sel.focus(); + // Opera sometimes ignores focusing a freshly created node + if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100); + return true; + }; +})(); diff --git a/conlite/external/codemirror/lib/util/xml-hint.js b/conlite/external/codemirror/lib/util/xml-hint.js new file mode 100644 index 0000000..677661a --- /dev/null +++ b/conlite/external/codemirror/lib/util/xml-hint.js @@ -0,0 +1,137 @@ + +(function() { + + CodeMirror.xmlHints = []; + + CodeMirror.xmlHint = function(cm, simbol) { + + if(simbol.length > 0) { + var cursor = cm.getCursor(); + cm.replaceSelection(simbol); + cursor = {line: cursor.line, ch: cursor.ch + 1}; + cm.setCursor(cursor); + } + + // dirty hack for simple-hint to receive getHint event on space + var getTokenAt = editor.getTokenAt; + + editor.getTokenAt = function() { return 'disabled'; } + CodeMirror.simpleHint(cm, getHint); + + editor.getTokenAt = getTokenAt; + }; + + var getHint = function(cm) { + + var cursor = cm.getCursor(); + + if (cursor.ch > 0) { + + var text = cm.getRange({line: 0, ch: 0}, cursor); + var typed = ''; + var simbol = ''; + for(var i = text.length - 1; i >= 0; i--) { + if(text[i] == ' ' || text[i] == '<') { + simbol = text[i]; + break; + } + else { + typed = text[i] + typed; + } + } + + text = text.substr(0, text.length - typed.length); + + var path = getActiveElement(cm, text) + simbol; + var hints = CodeMirror.xmlHints[path]; + + if(typeof hints === 'undefined') + hints = ['']; + else { + hints = hints.slice(0); + for (var i = hints.length - 1; i >= 0; i--) { + if(hints[i].indexOf(typed) != 0) + hints.splice(i, 1); + } + } + + return { + list: hints, + from: { line: cursor.line, ch: cursor.ch - typed.length }, + to: cursor, + }; + }; + } + + var getActiveElement = function(codeMirror, text) { + + var element = ''; + + if(text.length >= 0) { + + var regex = new RegExp('<([^!?][^\\s/>]*).*?>', 'g'); + + var matches = []; + var match; + while ((match = regex.exec(text)) != null) { + matches.push({ + tag: match[1], + selfclose: (match[0].substr(-1) === '/>') + }); + } + + for (var i = matches.length - 1, skip = 0; i >= 0; i--) { + + var item = matches[i]; + + if (item.tag[0] == '/') + { + skip++; + } + else if (item.selfclose == false) + { + if (skip > 0) + { + skip--; + } + else + { + element = '<' + item.tag + '>' + element; + } + } + } + + element += getOpenTag(text); + } + + return element; + }; + + var getOpenTag = function(text) { + + var open = text.lastIndexOf('<'); + var close = text.lastIndexOf('>'); + + if (close < open) + { + text = text.substr(open); + + if(text != '<') { + + var space = text.indexOf(' '); + if(space < 0) + space = text.indexOf('\t'); + if(space < 0) + space = text.indexOf('\n'); + + if (space < 0) + space = text.length; + + return text.substr(0, space); + } + } + + return ''; + }; + +})(); diff --git a/conlite/external/codemirror/mode/clike/clike.js b/conlite/external/codemirror/mode/clike/clike.js new file mode 100644 index 0000000..e0c7d18 --- /dev/null +++ b/conlite/external/codemirror/mode/clike/clike.js @@ -0,0 +1,280 @@ +CodeMirror.defineMode("clike", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords || {}, + builtin = parserConfig.builtin || {}, + blockKeywords = parserConfig.blockKeywords || {}, + atoms = parserConfig.atoms || {}, + hooks = parserConfig.hooks || {}, + multiLineStrings = parserConfig.multiLineStrings; + var isOperatorChar = /[+\-*&%=<>!?|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (hooks[ch]) { + var result = hooks[ch](stream, state); + if (result !== false) return result; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "keyword"; + } + if (builtin.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "builtin"; + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = null; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) + pushContext(state, stream.column(), "statement"); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + var closing = firstChar == ctx.type; + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}" + }; +}); + +(function() { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var cKeywords = "auto if break int case long char register continue return default short do sizeof " + + "double static else struct entry switch extern typedef float union for unsigned " + + "goto while enum void const signed volatile"; + + function cppHook(stream, state) { + if (!state.startOfLine) return false; + stream.skipToEnd(); + return "meta"; + } + + // C#-style strings where "" escapes a quote. + function tokenAtString(stream, state) { + var next; + while ((next = stream.next()) != null) { + if (next == '"' && !stream.eat('"')) { + state.tokenize = null; + break; + } + } + return "string"; + } + + CodeMirror.defineMIME("text/x-csrc", { + name: "clike", + keywords: words(cKeywords), + blockKeywords: words("case do else for if switch while struct"), + atoms: words("null"), + hooks: {"#": cppHook} + }); + CodeMirror.defineMIME("text/x-c++src", { + name: "clike", + keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " + + "static_cast typeid catch operator template typename class friend private " + + "this using const_cast inline public throw virtual delete mutable protected " + + "wchar_t"), + blockKeywords: words("catch class do else finally for if struct switch try while"), + atoms: words("true false null"), + hooks: {"#": cppHook} + }); + CodeMirror.defineMIME("text/x-java", { + name: "clike", + keywords: words("abstract assert boolean break byte case catch char class const continue default " + + "do double else enum extends final finally float for goto if implements import " + + "instanceof int interface long native new package private protected public " + + "return short static strictfp super switch synchronized this throw throws transient " + + "try void volatile while"), + blockKeywords: words("catch class do else finally for if switch try while"), + atoms: words("true false null"), + hooks: { + "@": function(stream, state) { + stream.eatWhile(/[\w\$_]/); + return "meta"; + } + } + }); + CodeMirror.defineMIME("text/x-csharp", { + name: "clike", + keywords: words("abstract as base break case catch checked class const continue" + + " default delegate do else enum event explicit extern finally fixed for" + + " foreach goto if implicit in interface internal is lock namespace new" + + " operator out override params private protected public readonly ref return sealed" + + " sizeof stackalloc static struct switch this throw try typeof unchecked" + + " unsafe using virtual void volatile while add alias ascending descending dynamic from get" + + " global group into join let orderby partial remove select set value var yield"), + blockKeywords: words("catch class do else finally for foreach if struct switch try while"), + builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" + + " Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" + + " UInt64 bool byte char decimal double short int long object" + + " sbyte float string ushort uint ulong"), + atoms: words("true false null"), + hooks: { + "@": function(stream, state) { + if (stream.eat('"')) { + state.tokenize = tokenAtString; + return tokenAtString(stream, state); + } + stream.eatWhile(/[\w\$_]/); + return "meta"; + } + } + }); + CodeMirror.defineMIME("text/x-scala", { + name: "clike", + keywords: words( + + /* scala */ + "abstract case catch class def do else extends false final finally for forSome if " + + "implicit import lazy match new null object override package private protected return " + + "sealed super this throw trait try trye type val var while with yield _ : = => <- <: " + + "<% >: # @ " + + + /* package scala */ + "assert assume require print println printf readLine readBoolean readByte readShort " + + "readChar readInt readLong readFloat readDouble " + + + "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " + + "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " + + "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " + + "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " + + "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " + + + /* package java.lang */ + "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " + + "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " + + "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " + + "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void" + + + ), + blockKeywords: words("catch class do else finally for forSome if match switch try while"), + atoms: words("true false null"), + hooks: { + "@": function(stream, state) { + stream.eatWhile(/[\w\$_]/); + return "meta"; + } + } + }); +}()); diff --git a/conlite/external/codemirror/mode/clike/index.html b/conlite/external/codemirror/mode/clike/index.html new file mode 100644 index 0000000..64d02f1 --- /dev/null +++ b/conlite/external/codemirror/mode/clike/index.html @@ -0,0 +1,101 @@ + + + + CodeMirror: C-like mode + + + + + + + +

CodeMirror: C-like mode

+ +
+ + + +

Simple mode that tries to handle C-like languages as well as it + can. Takes two configuration parameters: keywords, an + object whose property names are the keywords in the language, + and useCPP, which determines whether C preprocessor + directives are recognized.

+ +

MIME types defined: text/x-csrc + (C code), text/x-c++src (C++ + code), text/x-java (Java + code), text/x-csharp (C#).

+ + diff --git a/conlite/external/codemirror/mode/clike/scala.html b/conlite/external/codemirror/mode/clike/scala.html new file mode 100644 index 0000000..5fdd84e --- /dev/null +++ b/conlite/external/codemirror/mode/clike/scala.html @@ -0,0 +1,765 @@ + + + + CodeMirror: C-like mode + + + + + + + + +
+ +
+ + + + diff --git a/conlite/external/codemirror/mode/clojure/clojure.js b/conlite/external/codemirror/mode/clojure/clojure.js new file mode 100644 index 0000000..c683641 --- /dev/null +++ b/conlite/external/codemirror/mode/clojure/clojure.js @@ -0,0 +1,207 @@ +/** + * Author: Hans Engel + * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun) + */ +CodeMirror.defineMode("clojure", function (config, mode) { + var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", TAG = "tag", + ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword"; + var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1; + + function makeKeywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var atoms = makeKeywords("true false nil"); + + var keywords = makeKeywords( + "defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"); + + var builtins = makeKeywords( + "* *1 *2 *3 *agent* *allow-unresolved-vars* *assert *clojure-version* *command-line-args* *compile-files* *compile-path* *e *err* *file* *flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *use-context-classloader* *warn-on-reflection* + - / < <= = == > >= accessor aclone agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defstruct delay delay? deliver deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall doc dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq eval even? every? extend extend-protocol extend-type extends? extenders false? ffirst file-seq filter find find-doc find-ns find-var first float float-array float? floats flush fn fn? fnext for force format future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map? mapcat max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod name namespace neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-doc print-dup print-method print-namespace-doc print-simple print-special-doc print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string reify reduce ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure release-pending-sends rem remove remove-method remove-ns repeat repeatedly replace replicate require reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-validator! set? short short-array shorts shutdown-agents slurp some sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-form-anchor special-symbol? split-at split-with str stream? string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test the-ns time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision xml-seq"); + + var indentKeys = makeKeywords( + // Built-ins + "ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch " + + + // Binding forms + "let letfn binding loop for doseq dotimes when-let if-let " + + + // Data structures + "defstruct struct-map assoc " + + + // clojure.test + "testing deftest " + + + // contrib + "handler-case handle dotrace deftrace"); + + var tests = { + digit: /\d/, + digit_or_colon: /[\d:]/, + hex: /[0-9a-fA-F]/, + sign: /[+-]/, + exponent: /[eE]/, + keyword_char: /[^\s\(\[\;\)\]]/, + basic: /[\w\$_\-]/, + lang_keyword: /[\w*+!\-_?:\/]/ + }; + + function stateStack(indent, type, prev) { // represents a state stack object + this.indent = indent; + this.type = type; + this.prev = prev; + } + + function pushStack(state, indent, type) { + state.indentStack = new stateStack(indent, type, state.indentStack); + } + + function popStack(state) { + state.indentStack = state.indentStack.prev; + } + + function isNumber(ch, stream){ + // hex + if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) { + stream.eat('x'); + stream.eatWhile(tests.hex); + return true; + } + + // leading sign + if ( ch == '+' || ch == '-' ) { + stream.eat(tests.sign); + ch = stream.next(); + } + + if ( tests.digit.test(ch) ) { + stream.eat(ch); + stream.eatWhile(tests.digit); + + if ( '.' == stream.peek() ) { + stream.eat('.'); + stream.eatWhile(tests.digit); + } + + if ( 'e' == stream.peek().toLowerCase() ) { + stream.eat(tests.exponent); + stream.eat(tests.sign); + stream.eatWhile(tests.digit); + } + + return true; + } + + return false; + } + + return { + startState: function () { + return { + indentStack: null, + indentation: 0, + mode: false + }; + }, + + token: function (stream, state) { + if (state.indentStack == null && stream.sol()) { + // update indentation, but only if indentStack is empty + state.indentation = stream.indentation(); + } + + // skip spaces + if (stream.eatSpace()) { + return null; + } + var returnType = null; + + switch(state.mode){ + case "string": // multi-line string parsing mode + var next, escaped = false; + while ((next = stream.next()) != null) { + if (next == "\"" && !escaped) { + + state.mode = false; + break; + } + escaped = !escaped && next == "\\"; + } + returnType = STRING; // continue on in string mode + break; + default: // default parsing mode + var ch = stream.next(); + + if (ch == "\"") { + state.mode = "string"; + returnType = STRING; + } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) { + returnType = ATOM; + } else if (ch == ";") { // comment + stream.skipToEnd(); // rest of the line is a comment + returnType = COMMENT; + } else if (isNumber(ch,stream)){ + returnType = NUMBER; + } else if (ch == "(" || ch == "[") { + var keyWord = ''; var indentTemp = stream.column(); + /** + Either + (indent-word .. + (non-indent-word .. + (;something else, bracket, etc. + */ + + if (ch == "(") while ((letter = stream.eat(tests.keyword_char)) != null) { + keyWord += letter; + } + + if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word + pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); + } else { // non-indent word + // we continue eating the spaces + stream.eatSpace(); + if (stream.eol() || stream.peek() == ";") { + // nothing significant after + // we restart indentation 1 space after + pushStack(state, indentTemp + 1, ch); + } else { + pushStack(state, indentTemp + stream.current().length, ch); // else we match + } + } + stream.backUp(stream.current().length - 1); // undo all the eating + + returnType = BRACKET; + } else if (ch == ")" || ch == "]") { + returnType = BRACKET; + if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) { + popStack(state); + } + } else if ( ch == ":" ) { + stream.eatWhile(tests.lang_keyword); + return ATOM; + } else { + stream.eatWhile(tests.basic); + + if (keywords && keywords.propertyIsEnumerable(stream.current())) { + returnType = KEYWORD; + } else if (builtins && builtins.propertyIsEnumerable(stream.current())) { + returnType = BUILTIN; + } else if (atoms && atoms.propertyIsEnumerable(stream.current())) { + returnType = ATOM; + } else returnType = null; + } + } + + return returnType; + }, + + indent: function (state, textAfter) { + if (state.indentStack == null) return state.indentation; + return state.indentStack.indent; + } + }; +}); + +CodeMirror.defineMIME("text/x-clojure", "clojure"); diff --git a/conlite/external/codemirror/mode/clojure/index.html b/conlite/external/codemirror/mode/clojure/index.html new file mode 100644 index 0000000..9762d58 --- /dev/null +++ b/conlite/external/codemirror/mode/clojure/index.html @@ -0,0 +1,66 @@ + + + + CodeMirror: Clojure mode + + + + + + + +

CodeMirror: Clojure mode

+
+ + +

MIME types defined: text/x-clojure.

+ + + diff --git a/conlite/external/codemirror/mode/coffeescript/LICENSE b/conlite/external/codemirror/mode/coffeescript/LICENSE new file mode 100644 index 0000000..977e284 --- /dev/null +++ b/conlite/external/codemirror/mode/coffeescript/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2011 Jeff Pickhardt +Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/conlite/external/codemirror/mode/coffeescript/coffeescript.js b/conlite/external/codemirror/mode/coffeescript/coffeescript.js new file mode 100644 index 0000000..d8bfe36 --- /dev/null +++ b/conlite/external/codemirror/mode/coffeescript/coffeescript.js @@ -0,0 +1,346 @@ +/** + * Link to the project's GitHub page: + * https://github.com/pickhardt/coffeescript-codemirror-mode + */ +CodeMirror.defineMode('coffeescript', function(conf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]"); + var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\},:`=;\\.]'); + var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))"); + var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))"); + var identifiers = new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*"); + var properties = new RegExp("^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*"); + + var wordOperators = wordRegexp(['and', 'or', 'not', + 'is', 'isnt', 'in', + 'instanceof', 'typeof']); + var indentKeywords = ['for', 'while', 'loop', 'if', 'unless', 'else', + 'switch', 'try', 'catch', 'finally', 'class']; + var commonKeywords = ['break', 'by', 'continue', 'debugger', 'delete', + 'do', 'in', 'of', 'new', 'return', 'then', + 'this', 'throw', 'when', 'until']; + + var keywords = wordRegexp(indentKeywords.concat(commonKeywords)); + + indentKeywords = wordRegexp(indentKeywords); + + + var stringPrefixes = new RegExp("^('{3}|\"{3}|['\"])"); + var regexPrefixes = new RegExp("^(/{3}|/)"); + var commonConstants = ['Infinity', 'NaN', 'undefined', 'null', 'true', 'false', 'on', 'off', 'yes', 'no']; + var constants = wordRegexp(commonConstants); + + // Tokenizers + function tokenBase(stream, state) { + // Handle scope changes + if (stream.sol()) { + var scopeOffset = state.scopes[0].offset; + if (stream.eatSpace()) { + var lineOffset = stream.indentation(); + if (lineOffset > scopeOffset) { + return 'indent'; + } else if (lineOffset < scopeOffset) { + return 'dedent'; + } + return null; + } else { + if (scopeOffset > 0) { + dedent(stream, state); + } + } + } + if (stream.eatSpace()) { + return null; + } + + var ch = stream.peek(); + + // Handle docco title comment (single line) + if (stream.match("####")) { + stream.skipToEnd(); + return 'comment'; + } + + // Handle multi line comments + if (stream.match("###")) { + state.tokenize = longComment; + return state.tokenize(stream, state); + } + + // Single line comment + if (ch === '#') { + stream.skipToEnd(); + return 'comment'; + } + + // Handle number literals + if (stream.match(/^-?[0-9\.]/, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) { + floatLiteral = true; + } + if (stream.match(/^-?\d+\.\d*/)) { + floatLiteral = true; + } + if (stream.match(/^-?\.\d+/)) { + floatLiteral = true; + } + + if (floatLiteral) { + // prevent from getting extra . on 1.. + if (stream.peek() == "."){ + stream.backUp(1); + } + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^-?0x[0-9a-f]+/i)) { + intLiteral = true; + } + // Decimal + if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) { + intLiteral = true; + } + // Zero by itself with no other piece of number. + if (stream.match(/^-?0(?![\dx])/i)) { + intLiteral = true; + } + if (intLiteral) { + return 'number'; + } + } + + // Handle strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenFactory(stream.current(), 'string'); + return state.tokenize(stream, state); + } + // Handle regex literals + if (stream.match(regexPrefixes)) { + if (stream.current() != '/' || stream.match(/^.*\//, false)) { // prevent highlight of division + state.tokenize = tokenFactory(stream.current(), 'string-2'); + return state.tokenize(stream, state); + } else { + stream.backUp(1); + } + } + + // Handle operators and delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { + return 'punctuation'; + } + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return 'punctuation'; + } + + if (stream.match(constants)) { + return 'atom'; + } + + if (stream.match(keywords)) { + return 'keyword'; + } + + if (stream.match(identifiers)) { + return 'variable'; + } + + if (stream.match(properties)) { + return 'property'; + } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenFactory(delimiter, outclass) { + var singleline = delimiter.length == 1; + return function tokenString(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"\/\\]/); + if (stream.eat('\\')) { + stream.next(); + if (singleline && stream.eol()) { + return outclass; + } + } else if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return outclass; + } else { + stream.eat(/['"\/]/); + } + } + if (singleline) { + if (conf.mode.singleLineStringErrors) { + outclass = ERRORCLASS + } else { + state.tokenize = tokenBase; + } + } + return outclass; + }; + } + + function longComment(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^#]/); + if (stream.match("###")) { + state.tokenize = tokenBase; + break; + } + stream.eatWhile("#"); + } + return "comment" + } + + function indent(stream, state, type) { + type = type || 'coffee'; + var indentUnit = 0; + if (type === 'coffee') { + for (var i = 0; i < state.scopes.length; i++) { + if (state.scopes[i].type === 'coffee') { + indentUnit = state.scopes[i].offset + conf.indentUnit; + break; + } + } + } else { + indentUnit = stream.column() + stream.current().length; + } + state.scopes.unshift({ + offset: indentUnit, + type: type + }); + } + + function dedent(stream, state) { + if (state.scopes.length == 1) return; + if (state.scopes[0].type === 'coffee') { + var _indent = stream.indentation(); + var _indent_index = -1; + for (var i = 0; i < state.scopes.length; ++i) { + if (_indent === state.scopes[i].offset) { + _indent_index = i; + break; + } + } + if (_indent_index === -1) { + return true; + } + while (state.scopes[0].offset !== _indent) { + state.scopes.shift(); + } + return false + } else { + state.scopes.shift(); + return false; + } + } + + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current === '.') { + style = state.tokenize(stream, state); + current = stream.current(); + if (style === 'variable') { + return 'variable'; + } else { + return ERRORCLASS; + } + } + + // Handle scope changes. + if (current === 'return') { + state.dedent += 1; + } + if (((current === '->' || current === '=>') && + !state.lambda && + state.scopes[0].type == 'coffee' && + stream.peek() === '') + || style === 'indent') { + indent(stream, state); + } + var delimiter_index = '[({'.indexOf(current); + if (delimiter_index !== -1) { + indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1)); + } + if (indentKeywords.exec(current)){ + indent(stream, state); + } + if (current == 'then'){ + dedent(stream, state); + } + + + if (style === 'dedent') { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + delimiter_index = '])}'.indexOf(current); + if (delimiter_index !== -1) { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') { + if (state.scopes.length > 1) state.scopes.shift(); + state.dedent -= 1; + } + + return style; + } + + var external = { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + scopes: [{offset:basecolumn || 0, type:'coffee'}], + lastToken: null, + lambda: false, + dedent: 0 + }; + }, + + token: function(stream, state) { + var style = tokenLexer(stream, state); + + state.lastToken = {style:style, content: stream.current()}; + + if (stream.eol() && stream.lambda) { + state.lambda = false; + } + + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) { + return 0; + } + + return state.scopes[0].offset; + } + + }; + return external; +}); + +CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript'); diff --git a/conlite/external/codemirror/mode/coffeescript/index.html b/conlite/external/codemirror/mode/coffeescript/index.html new file mode 100644 index 0000000..98bd497 --- /dev/null +++ b/conlite/external/codemirror/mode/coffeescript/index.html @@ -0,0 +1,727 @@ + + + + CodeMirror: CoffeeScript mode + + + + + + + +

CodeMirror: CoffeeScript mode

+
+ + +

MIME types defined: text/x-coffeescript.

+ +

The CoffeeScript mode was written by Jeff Pickhardt (license).

+ + + diff --git a/conlite/external/codemirror/mode/css/css.js b/conlite/external/codemirror/mode/css/css.js new file mode 100644 index 0000000..050e112 --- /dev/null +++ b/conlite/external/codemirror/mode/css/css.js @@ -0,0 +1,124 @@ +CodeMirror.defineMode("css", function(config) { + var indentUnit = config.indentUnit, type; + function ret(style, tp) {type = tp; return style;} + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());} + else if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + else if (ch == "<" && stream.eat("!")) { + state.tokenize = tokenSGMLComment; + return tokenSGMLComment(stream, state); + } + else if (ch == "=") ret(null, "compare"); + else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + else if (ch == "#") { + stream.eatWhile(/[\w\\\-]/); + return ret("atom", "hash"); + } + else if (ch == "!") { + stream.match(/^\s*\w*/); + return ret("keyword", "important"); + } + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w.%]/); + return ret("number", "unit"); + } + else if (/[,.+>*\/]/.test(ch)) { + return ret(null, "select-op"); + } + else if (/[;{}:\[\]]/.test(ch)) { + return ret(null, ch); + } + else { + stream.eatWhile(/[\w\\\-]/); + return ret("variable", "variable"); + } + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenSGMLComment(stream, state) { + var dashes = 0, ch; + while ((ch = stream.next()) != null) { + if (dashes >= 2 && ch == ">") { + state.tokenize = tokenBase; + break; + } + dashes = (ch == "-") ? dashes + 1 : 0; + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + baseIndent: base || 0, + stack: []}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + var context = state.stack[state.stack.length-1]; + if (type == "hash" && context != "rule") style = "string-2"; + else if (style == "variable") { + if (context == "rule") style = "number"; + else if (!context || context == "@media{") style = "tag"; + } + + if (context == "rule" && /^[\{\};]$/.test(type)) + state.stack.pop(); + if (type == "{") { + if (context == "@media") state.stack[state.stack.length-1] = "@media{"; + else state.stack.push("{"); + } + else if (type == "}") state.stack.pop(); + else if (type == "@media") state.stack.push("@media"); + else if (context == "{" && type != "comment") state.stack.push("rule"); + return style; + }, + + indent: function(state, textAfter) { + var n = state.stack.length; + if (/^\}/.test(textAfter)) + n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1; + return state.baseIndent + n * indentUnit; + }, + + electricChars: "}" + }; +}); + +CodeMirror.defineMIME("text/css", "css"); diff --git a/conlite/external/codemirror/mode/css/index.html b/conlite/external/codemirror/mode/css/index.html new file mode 100644 index 0000000..4993434 --- /dev/null +++ b/conlite/external/codemirror/mode/css/index.html @@ -0,0 +1,55 @@ + + + + CodeMirror: CSS mode + + + + + + + +

CodeMirror: CSS mode

+
+ + +

MIME types defined: text/css.

+ + + diff --git a/conlite/external/codemirror/mode/diff/diff.js b/conlite/external/codemirror/mode/diff/diff.js new file mode 100644 index 0000000..3402f3b --- /dev/null +++ b/conlite/external/codemirror/mode/diff/diff.js @@ -0,0 +1,32 @@ +CodeMirror.defineMode("diff", function() { + + var TOKEN_NAMES = { + '+': 'tag', + '-': 'string', + '@': 'meta' + }; + + return { + token: function(stream) { + var tw_pos = stream.string.search(/[\t ]+?$/); + + if (!stream.sol() || tw_pos === 0) { + stream.skipToEnd(); + return ("error " + ( + TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); + } + + var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); + + if (tw_pos === -1) { + stream.skipToEnd(); + } else { + stream.pos = tw_pos; + } + + return token_name; + } + }; +}); + +CodeMirror.defineMIME("text/x-diff", "diff"); diff --git a/conlite/external/codemirror/mode/diff/index.html b/conlite/external/codemirror/mode/diff/index.html new file mode 100644 index 0000000..b102c09 --- /dev/null +++ b/conlite/external/codemirror/mode/diff/index.html @@ -0,0 +1,104 @@ + + + + CodeMirror: Diff mode + + + + + + + +

CodeMirror: Diff mode

+
+ + +

MIME types defined: text/x-diff.

+ + + diff --git a/conlite/external/codemirror/mode/ecl/ecl.js b/conlite/external/codemirror/mode/ecl/ecl.js new file mode 100644 index 0000000..25df24b --- /dev/null +++ b/conlite/external/codemirror/mode/ecl/ecl.js @@ -0,0 +1,203 @@ +CodeMirror.defineMode("ecl", function(config) { + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + function metaHook(stream, state) { + if (!state.startOfLine) return false; + stream.skipToEnd(); + return "meta"; + } + + function tokenAtString(stream, state) { + var next; + while ((next = stream.next()) != null) { + if (next == '"' && !stream.eat('"')) { + state.tokenize = null; + break; + } + } + return "string"; + } + + var indentUnit = config.indentUnit; + var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode"); + var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait"); + var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath"); + var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode"); + var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when"); + var blockKeywords = words("catch class do else finally for if switch try while"); + var atoms = words("true false null"); + var hooks = {"#": metaHook}; + var multiLineStrings; + var isOperatorChar = /[+\-*&%=<>!?|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (hooks[ch]) { + var result = hooks[ch](stream, state); + if (result !== false) return result; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current().toLowerCase(); + if (keyword.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "keyword"; + } else if (variable.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable"; + } else if (variable_2.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable-2"; + } else if (variable_3.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable-3"; + } else if (builtin.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "builtin"; + } else { //Data types are of from KEYWORD## + var i = cur.length - 1; + while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_')) + --i; + + if (i > 0) { + var cur2 = cur.substr(0, i + 1); + if (variable_3.propertyIsEnumerable(cur2)) { + if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement"; + return "variable-3"; + } + } + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return null; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) + pushContext(state, stream.column(), "statement"); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + var closing = firstChar == ctx.type; + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-ecl", "ecl"); diff --git a/conlite/external/codemirror/mode/ecl/index.html b/conlite/external/codemirror/mode/ecl/index.html new file mode 100644 index 0000000..d6b41f4 --- /dev/null +++ b/conlite/external/codemirror/mode/ecl/index.html @@ -0,0 +1,42 @@ + + + + CodeMirror: ECL mode + + + + + + + +

CodeMirror: ECL mode

+
+ + +

Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

+

MIME types defined: text/x-ecl.

+ + + diff --git a/conlite/external/codemirror/mode/erlang/erlang.js b/conlite/external/codemirror/mode/erlang/erlang.js new file mode 100644 index 0000000..e79ab76 --- /dev/null +++ b/conlite/external/codemirror/mode/erlang/erlang.js @@ -0,0 +1,463 @@ +// block; "begin", "case", "fun", "if", "receive", "try": closed by "end" +// block internal; "after", "catch", "of" +// guard; "when", closed by "->" +// "->" opens a clause, closed by ";" or "." +// "<<" opens a binary, closed by ">>" +// "," appears in arglists, lists, tuples and terminates lines of code +// "." resets indentation to 0 +// obsolete; "cond", "let", "query" + +CodeMirror.defineMIME("text/x-erlang", "erlang"); + +CodeMirror.defineMode("erlang", function(cmCfg, modeCfg) { + + function rval(state,stream,type) { + // distinguish between "." as terminator and record field operator + if (type == "record") { + state.context = "record"; + }else{ + state.context = false; + } + + // remember last significant bit on last line for indenting + if (type != "whitespace" && type != "comment") { + state.lastToken = stream.current(); + } + // erlang -> CodeMirror tag + switch (type) { + case "atom": return "atom"; + case "attribute": return "attribute"; + case "builtin": return "builtin"; + case "comment": return "comment"; + case "fun": return "meta"; + case "function": return "tag"; + case "guard": return "property"; + case "keyword": return "keyword"; + case "macro": return "variable-2"; + case "number": return "number"; + case "operator": return "operator"; + case "record": return "bracket"; + case "string": return "string"; + case "type": return "def"; + case "variable": return "variable"; + case "error": return "error"; + case "separator": return null; + case "open_paren": return null; + case "close_paren": return null; + default: return null; + } + } + + var typeWords = [ + "-type", "-spec", "-export_type", "-opaque"]; + + var keywordWords = [ + "after","begin","catch","case","cond","end","fun","if", + "let","of","query","receive","try","when"]; + + var separatorWords = [ + "->",";",":",".",","]; + + var operatorWords = [ + "and","andalso","band","bnot","bor","bsl","bsr","bxor", + "div","not","or","orelse","rem","xor"]; + + var symbolWords = [ + "+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-"]; + + var openParenWords = [ + "<<","(","[","{"]; + + var closeParenWords = [ + "}","]",")",">>"]; + + var guardWords = [ + "is_atom","is_binary","is_bitstring","is_boolean","is_float", + "is_function","is_integer","is_list","is_number","is_pid", + "is_port","is_record","is_reference","is_tuple", + "atom","binary","bitstring","boolean","function","integer","list", + "number","pid","port","record","reference","tuple"]; + + var bifWords = [ + "abs","adler32","adler32_combine","alive","apply","atom_to_binary", + "atom_to_list","binary_to_atom","binary_to_existing_atom", + "binary_to_list","binary_to_term","bit_size","bitstring_to_list", + "byte_size","check_process_code","contact_binary","crc32", + "crc32_combine","date","decode_packet","delete_module", + "disconnect_node","element","erase","exit","float","float_to_list", + "garbage_collect","get","get_keys","group_leader","halt","hd", + "integer_to_list","internal_bif","iolist_size","iolist_to_binary", + "is_alive","is_atom","is_binary","is_bitstring","is_boolean", + "is_float","is_function","is_integer","is_list","is_number","is_pid", + "is_port","is_process_alive","is_record","is_reference","is_tuple", + "length","link","list_to_atom","list_to_binary","list_to_bitstring", + "list_to_existing_atom","list_to_float","list_to_integer", + "list_to_pid","list_to_tuple","load_module","make_ref","module_loaded", + "monitor_node","node","node_link","node_unlink","nodes","notalive", + "now","open_port","pid_to_list","port_close","port_command", + "port_connect","port_control","pre_loaded","process_flag", + "process_info","processes","purge_module","put","register", + "registered","round","self","setelement","size","spawn","spawn_link", + "spawn_monitor","spawn_opt","split_binary","statistics", + "term_to_binary","time","throw","tl","trunc","tuple_size", + "tuple_to_list","unlink","unregister","whereis"]; + + // ignored for indenting purposes + var ignoreWords = [ + ",", ":", "catch", "after", "of", "cond", "let", "query"]; + + + var smallRE = /[a-z_]/; + var largeRE = /[A-Z_]/; + var digitRE = /[0-9]/; + var octitRE = /[0-7]/; + var anumRE = /[a-z_A-Z0-9]/; + var symbolRE = /[\+\-\*\/<>=\|:]/; + var openParenRE = /[<\(\[\{]/; + var closeParenRE = /[>\)\]\}]/; + var sepRE = /[\->\.,:;]/; + + function isMember(element,list) { + return (-1 < list.indexOf(element)); + } + + function isPrev(stream,string) { + var start = stream.start; + var len = string.length; + if (len <= start) { + var word = stream.string.slice(start-len,start); + return word == string; + }else{ + return false; + } + } + + function tokenize(stream, state) { + if (stream.eatSpace()) { + return rval(state,stream,"whitespace"); + } + + // attributes and type specs + if ((peekToken(state).token == "" || peekToken(state).token == ".") && + stream.peek() == '-') { + stream.next(); + if (stream.eat(smallRE) && stream.eatWhile(anumRE)) { + if (isMember(stream.current(),typeWords)) { + return rval(state,stream,"type"); + }else{ + return rval(state,stream,"attribute"); + } + } + stream.backUp(1); + } + + var ch = stream.next(); + + // comment + if (ch == '%') { + stream.skipToEnd(); + return rval(state,stream,"comment"); + } + + // macro + if (ch == '?') { + stream.eatWhile(anumRE); + return rval(state,stream,"macro"); + } + + // record + if ( ch == "#") { + stream.eatWhile(anumRE); + return rval(state,stream,"record"); + } + + // char + if ( ch == "$") { + if (stream.next() == "\\") { + if (!stream.eatWhile(octitRE)) { + stream.next(); + } + } + return rval(state,stream,"string"); + } + + // quoted atom + if (ch == '\'') { + if (singleQuote(stream)) { + return rval(state,stream,"atom"); + }else{ + return rval(state,stream,"error"); + } + } + + // string + if (ch == '"') { + if (doubleQuote(stream)) { + return rval(state,stream,"string"); + }else{ + return rval(state,stream,"error"); + } + } + + // variable + if (largeRE.test(ch)) { + stream.eatWhile(anumRE); + return rval(state,stream,"variable"); + } + + // atom/keyword/BIF/function + if (smallRE.test(ch)) { + stream.eatWhile(anumRE); + + if (stream.peek() == "/") { + stream.next(); + if (stream.eatWhile(digitRE)) { + return rval(state,stream,"fun"); // f/0 style fun + }else{ + stream.backUp(1); + return rval(state,stream,"atom"); + } + } + + var w = stream.current(); + + if (isMember(w,keywordWords)) { + pushToken(state,stream); + return rval(state,stream,"keyword"); + } + if (stream.peek() == "(") { + // 'put' and 'erlang:put' are bifs, 'foo:put' is not + if (isMember(w,bifWords) && + (!isPrev(stream,":") || isPrev(stream,"erlang:"))) { + return rval(state,stream,"builtin"); + }else{ + return rval(state,stream,"function"); + } + } + if (isMember(w,guardWords)) { + return rval(state,stream,"guard"); + } + if (isMember(w,operatorWords)) { + return rval(state,stream,"operator"); + } + if (stream.peek() == ":") { + if (w == "erlang") { + return rval(state,stream,"builtin"); + } else { + return rval(state,stream,"function"); + } + } + return rval(state,stream,"atom"); + } + + // number + if (digitRE.test(ch)) { + stream.eatWhile(digitRE); + if (stream.eat('#')) { + stream.eatWhile(digitRE); // 16#10 style integer + } else { + if (stream.eat('.')) { // float + stream.eatWhile(digitRE); + } + if (stream.eat(/[eE]/)) { + stream.eat(/[-+]/); // float with exponent + stream.eatWhile(digitRE); + } + } + return rval(state,stream,"number"); // normal integer + } + + // open parens + if (nongreedy(stream,openParenRE,openParenWords)) { + pushToken(state,stream); + return rval(state,stream,"open_paren"); + } + + // close parens + if (nongreedy(stream,closeParenRE,closeParenWords)) { + pushToken(state,stream); + return rval(state,stream,"close_paren"); + } + + // separators + if (greedy(stream,sepRE,separatorWords)) { + // distinguish between "." as terminator and record field operator + if (state.context == false) { + pushToken(state,stream); + } + return rval(state,stream,"separator"); + } + + // operators + if (greedy(stream,symbolRE,symbolWords)) { + return rval(state,stream,"operator"); + } + + return rval(state,stream,null); + } + + function nongreedy(stream,re,words) { + if (stream.current().length == 1 && re.test(stream.current())) { + stream.backUp(1); + while (re.test(stream.peek())) { + stream.next(); + if (isMember(stream.current(),words)) { + return true; + } + } + stream.backUp(stream.current().length-1); + } + return false; + } + + function greedy(stream,re,words) { + if (stream.current().length == 1 && re.test(stream.current())) { + while (re.test(stream.peek())) { + stream.next(); + } + while (0 < stream.current().length) { + if (isMember(stream.current(),words)) { + return true; + }else{ + stream.backUp(1); + } + } + stream.next(); + } + return false; + } + + function doubleQuote(stream) { + return quote(stream, '"', '\\'); + } + + function singleQuote(stream) { + return quote(stream,'\'','\\'); + } + + function quote(stream,quoteChar,escapeChar) { + while (!stream.eol()) { + var ch = stream.next(); + if (ch == quoteChar) { + return true; + }else if (ch == escapeChar) { + stream.next(); + } + } + return false; + } + + function Token(stream) { + this.token = stream ? stream.current() : ""; + this.column = stream ? stream.column() : 0; + this.indent = stream ? stream.indentation() : 0; + } + + function myIndent(state,textAfter) { + var indent = cmCfg.indentUnit; + var outdentWords = ["after","catch"]; + var token = (peekToken(state)).token; + var wordAfter = takewhile(textAfter,/[^a-z]/); + + if (isMember(token,openParenWords)) { + return (peekToken(state)).column+token.length; + }else if (token == "." || token == ""){ + return 0; + }else if (token == "->") { + if (wordAfter == "end") { + return peekToken(state,2).column; + }else if (peekToken(state,2).token == "fun") { + return peekToken(state,2).column+indent; + }else{ + return (peekToken(state)).indent+indent; + } + }else if (isMember(wordAfter,outdentWords)) { + return (peekToken(state)).indent; + }else{ + return (peekToken(state)).column+indent; + } + } + + function takewhile(str,re) { + var m = str.match(re); + return m ? str.slice(0,m.index) : str; + } + + function popToken(state) { + return state.tokenStack.pop(); + } + + function peekToken(state,depth) { + var len = state.tokenStack.length; + var dep = (depth ? depth : 1); + if (len < dep) { + return new Token; + }else{ + return state.tokenStack[len-dep]; + } + } + + function pushToken(state,stream) { + var token = stream.current(); + var prev_token = peekToken(state).token; + if (isMember(token,ignoreWords)) { + return false; + }else if (drop_both(prev_token,token)) { + popToken(state); + return false; + }else if (drop_first(prev_token,token)) { + popToken(state); + return pushToken(state,stream); + }else{ + state.tokenStack.push(new Token(stream)); + return true; + } + } + + function drop_first(open, close) { + switch (open+" "+close) { + case "when ->": return true; + case "-> end": return true; + case "-> .": return true; + case ". .": return true; + default: return false; + } + } + + function drop_both(open, close) { + switch (open+" "+close) { + case "( )": return true; + case "[ ]": return true; + case "{ }": return true; + case "<< >>": return true; + case "begin end": return true; + case "case end": return true; + case "fun end": return true; + case "if end": return true; + case "receive end": return true; + case "try end": return true; + case "-> ;": return true; + default: return false; + } + } + + return { + startState: + function() { + return {tokenStack: [], + context: false, + lastToken: null}; + }, + + token: + function(stream, state) { + return tokenize(stream, state); + }, + + indent: + function(state, textAfter) { +// console.log(state.tokenStack); + return myIndent(state,textAfter); + } + }; +}); diff --git a/conlite/external/codemirror/mode/erlang/index.html b/conlite/external/codemirror/mode/erlang/index.html new file mode 100644 index 0000000..80eefef --- /dev/null +++ b/conlite/external/codemirror/mode/erlang/index.html @@ -0,0 +1,62 @@ + + + + CodeMirror: Erlang mode + + + + + + + + +

CodeMirror: Erlang mode

+ +
+ + + +

MIME types defined: text/x-erlang.

+ + diff --git a/conlite/external/codemirror/mode/gfm/gfm.js b/conlite/external/codemirror/mode/gfm/gfm.js new file mode 100644 index 0000000..8f457c5 --- /dev/null +++ b/conlite/external/codemirror/mode/gfm/gfm.js @@ -0,0 +1,144 @@ +CodeMirror.defineMode("gfm", function(config, parserConfig) { + var mdMode = CodeMirror.getMode(config, "markdown"); + var aliases = { + html: "htmlmixed", + js: "javascript", + json: "application/json", + c: "text/x-csrc", + "c++": "text/x-c++src", + java: "text/x-java", + csharp: "text/x-csharp", + "c#": "text/x-csharp" + }; + + // make this lazy so that we don't need to load GFM last + var getMode = (function () { + var i, modes = {}, mimes = {}, mime; + + var list = CodeMirror.listModes(); + for (i = 0; i < list.length; i++) { + modes[list[i]] = list[i]; + } + var mimesList = CodeMirror.listMIMEs(); + for (i = 0; i < mimesList.length; i++) { + mime = mimesList[i].mime; + mimes[mime] = mimesList[i].mime; + } + + for (var a in aliases) { + if (aliases[a] in modes || aliases[a] in mimes) + modes[a] = aliases[a]; + } + + return function (lang) { + return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null; + } + }()); + + function markdown(stream, state) { + // intercept fenced code blocks + if (stream.sol() && stream.match(/^```([\w+#]*)/)) { + // try switching mode + state.localMode = getMode(RegExp.$1) + if (state.localMode) + state.localState = state.localMode.startState(); + + state.token = local; + return 'code'; + } + + return mdMode.token(stream, state.mdState); + } + + function local(stream, state) { + if (stream.sol() && stream.match(/^```/)) { + state.localMode = state.localState = null; + state.token = markdown; + return 'code'; + } + else if (state.localMode) { + return state.localMode.token(stream, state.localState); + } else { + stream.skipToEnd(); + return 'code'; + } + } + + // custom handleText to prevent emphasis in the middle of a word + // and add autolinking + function handleText(stream, mdState) { + var match; + if (stream.match(/^\w+:\/\/\S+/)) { + return 'link'; + } + if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) { + return mdMode.getType(mdState); + } + if (match = stream.match(/^[^\[*\\<>` ]+/)) { + var word = match[0]; + if (word[0] === '_' && word[word.length-1] === '_') { + stream.backUp(word.length); + return undefined; + } + return mdMode.getType(mdState); + } + if (stream.eatSpace()) { + return null; + } + } + + return { + startState: function() { + var mdState = mdMode.startState(); + mdState.text = handleText; + return {token: markdown, mode: "markdown", mdState: mdState, + localMode: null, localState: null}; + }, + + copyState: function(state) { + return {token: state.token, mode: state.mode, mdState: CodeMirror.copyState(mdMode, state.mdState), + localMode: state.localMode, + localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null}; + }, + + token: function(stream, state) { + /* Parse GFM double bracket links */ + if ((ch = stream.peek()) != undefined && ch == '[') { + stream.next(); // Advance the stream + + /* Only handle double bracket links */ + if ((ch = stream.peek()) == undefined || ch != '[') { + stream.backUp(1); + return state.token(stream, state); + } + + while ((ch = stream.next()) != undefined && ch != ']') {} + + if (ch == ']' && (ch = stream.next()) != undefined && ch == ']') + return 'link'; + + /* If we did not find the second ']' */ + stream.backUp(1); + } + + /* Match GFM latex formulas, as well as latex formulas within '$' */ + if (stream.match(/^\$[^\$]+\$/)) { + return "string"; + } + + if (stream.match(/^\\\((.*?)\\\)/)) { + return "string"; + } + + if (stream.match(/^\$\$[^\$]+\$\$/)) { + return "string"; + } + + if (stream.match(/^\\\[(.*?)\\\]/)) { + return "string"; + } + + return state.token(stream, state); + } + } +}, "markdown"); diff --git a/conlite/external/codemirror/mode/gfm/index.html b/conlite/external/codemirror/mode/gfm/index.html new file mode 100644 index 0000000..92a089b --- /dev/null +++ b/conlite/external/codemirror/mode/gfm/index.html @@ -0,0 +1,47 @@ + + + + CodeMirror: GFM mode + + + + + + + + + + + +

CodeMirror: GFM mode

+ + +
+ + + + + diff --git a/conlite/external/codemirror/mode/go/go.js b/conlite/external/codemirror/mode/go/go.js new file mode 100644 index 0000000..657c014 --- /dev/null +++ b/conlite/external/codemirror/mode/go/go.js @@ -0,0 +1,170 @@ +CodeMirror.defineMode("go", function(config, parserConfig) { + var indentUnit = config.indentUnit; + + var keywords = { + "break":true, "case":true, "chan":true, "const":true, "continue":true, + "default":true, "defer":true, "else":true, "fallthrough":true, "for":true, + "func":true, "go":true, "goto":true, "if":true, "import":true, + "interface":true, "map":true, "package":true, "range":true, "return":true, + "select":true, "struct":true, "switch":true, "type":true, "var":true, + "bool":true, "byte":true, "complex64":true, "complex128":true, + "float32":true, "float64":true, "int8":true, "int16":true, "int32":true, + "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true, + "uint64":true, "int":true, "uint":true, "uintptr":true + }; + + var atoms = { + "true":true, "false":true, "iota":true, "nil":true, "append":true, + "cap":true, "close":true, "complex":true, "copy":true, "imag":true, + "len":true, "make":true, "new":true, "panic":true, "print":true, + "println":true, "real":true, "recover":true + }; + + var blockKeywords = { + "else":true, "for":true, "func":true, "if":true, "interface":true, + "select":true, "struct":true, "switch":true + }; + + var isOperatorChar = /[+\-*&^%:=<>!|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'" || ch == "`") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\d\.]/.test(ch)) { + if (ch == ".") { + stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/); + } else if (ch == "0") { + stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/); + } else { + stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/); + } + return "number"; + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) { + if (cur == "case" || cur == "default") curPunc = "case"; + return "keyword"; + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || quote == "`")) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + if (ctx.type == "case") ctx.type = "}"; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "case") ctx.type = "case" + else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state); + else if (curPunc == ctx.type) popContext(state); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) { + state.context.type = "}"; + return ctx.indented; + } + var closing = firstChar == ctx.type; + if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}:" + }; +}); + +CodeMirror.defineMIME("text/x-go", "go"); diff --git a/conlite/external/codemirror/mode/go/index.html b/conlite/external/codemirror/mode/go/index.html new file mode 100644 index 0000000..9cdad1a --- /dev/null +++ b/conlite/external/codemirror/mode/go/index.html @@ -0,0 +1,72 @@ + + + + CodeMirror: Go mode + + + + + + + + +

CodeMirror: Go mode

+ +
+ + + +

MIME type: text/x-go

+ + diff --git a/conlite/external/codemirror/mode/groovy/groovy.js b/conlite/external/codemirror/mode/groovy/groovy.js new file mode 100644 index 0000000..a7daadb --- /dev/null +++ b/conlite/external/codemirror/mode/groovy/groovy.js @@ -0,0 +1,210 @@ +CodeMirror.defineMode("groovy", function(config, parserConfig) { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var keywords = words( + "abstract as assert boolean break byte case catch char class const continue def default " + + "do double else enum extends final finally float for goto if implements import in " + + "instanceof int interface long native new package private protected public return " + + "short static strictfp super switch synchronized threadsafe throw throws transient " + + "try void volatile while"); + var blockKeywords = words("catch class do else finally for if switch try while enum interface def"); + var atoms = words("null true false this"); + + var curPunc; + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'") { + return startString(ch, stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); } + return "number"; + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize.push(tokenComment); + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + if (expectExpression(state.lastToken)) { + return startString(ch, stream, state); + } + } + if (ch == "-" && stream.eat(">")) { + curPunc = "->"; + return null; + } + if (/[+\-*&%=<>!?|\/~]/.test(ch)) { + stream.eatWhile(/[+\-*&%=<>|~]/); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; } + if (state.lastToken == ".") return "property"; + if (stream.eat(":")) { curPunc = "proplabel"; return "property"; } + var cur = stream.current(); + if (atoms.propertyIsEnumerable(cur)) { return "atom"; } + if (keywords.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "keyword"; + } + return "variable"; + } + tokenBase.isBase = true; + + function startString(quote, stream, state) { + var tripleQuoted = false; + if (quote != "/" && stream.eat(quote)) { + if (stream.eat(quote)) tripleQuoted = true; + else return "string"; + } + function t(stream, state) { + var escaped = false, next, end = !tripleQuoted; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + if (!tripleQuoted) { break; } + if (stream.match(quote + quote)) { end = true; break; } + } + if (quote == '"' && next == "$" && !escaped && stream.eat("{")) { + state.tokenize.push(tokenBaseUntilBrace()); + return "string"; + } + escaped = !escaped && next == "\\"; + } + if (end) state.tokenize.pop(); + return "string"; + } + state.tokenize.push(t); + return t(stream, state); + } + + function tokenBaseUntilBrace() { + var depth = 1; + function t(stream, state) { + if (stream.peek() == "}") { + depth--; + if (depth == 0) { + state.tokenize.pop(); + return state.tokenize[state.tokenize.length-1](stream, state); + } + } else if (stream.peek() == "{") { + depth++; + } + return tokenBase(stream, state); + } + t.isBase = true; + return t; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize.pop(); + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function expectExpression(last) { + return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) || + last == "newstatement" || last == "keyword" || last == "proplabel"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: [tokenBase], + context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false), + indented: 0, + startOfLine: true, + lastToken: null + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + // Automatic semicolon insertion + if (ctx.type == "statement" && !expectExpression(state.lastToken)) { + popContext(state); ctx = state.context; + } + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = state.tokenize[state.tokenize.length-1](stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); + // Handle indentation for {x -> \n ... } + else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") { + popContext(state); + state.context.align = false; + } + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) + pushContext(state, stream.column(), "statement"); + state.startOfLine = false; + state.lastToken = curPunc || style; + return style; + }, + + indent: function(state, textAfter) { + if (!state.tokenize[state.tokenize.length-1].isBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), ctx = state.context; + if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev; + var closing = firstChar == ctx.type; + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : config.indentUnit); + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-groovy", "groovy"); diff --git a/conlite/external/codemirror/mode/groovy/index.html b/conlite/external/codemirror/mode/groovy/index.html new file mode 100644 index 0000000..226475c --- /dev/null +++ b/conlite/external/codemirror/mode/groovy/index.html @@ -0,0 +1,71 @@ + + + + CodeMirror: Groovy mode + + + + + + + +

CodeMirror: Groovy mode

+ +
+ + + +

MIME types defined: text/x-groovy

+ + diff --git a/conlite/external/codemirror/mode/haskell/haskell.js b/conlite/external/codemirror/mode/haskell/haskell.js new file mode 100644 index 0000000..aac5041 --- /dev/null +++ b/conlite/external/codemirror/mode/haskell/haskell.js @@ -0,0 +1,242 @@ +CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) { + + function switchState(source, setState, f) { + setState(f); + return f(source, setState); + } + + // These should all be Unicode extended, as per the Haskell 2010 report + var smallRE = /[a-z_]/; + var largeRE = /[A-Z]/; + var digitRE = /[0-9]/; + var hexitRE = /[0-9A-Fa-f]/; + var octitRE = /[0-7]/; + var idRE = /[a-z_A-Z0-9']/; + var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/; + var specialRE = /[(),;[\]`{}]/; + var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer + + function normal(source, setState) { + if (source.eatWhile(whiteCharRE)) { + return null; + } + + var ch = source.next(); + if (specialRE.test(ch)) { + if (ch == '{' && source.eat('-')) { + var t = "comment"; + if (source.eat('#')) { + t = "meta"; + } + return switchState(source, setState, ncomment(t, 1)); + } + return null; + } + + if (ch == '\'') { + if (source.eat('\\')) { + source.next(); // should handle other escapes here + } + else { + source.next(); + } + if (source.eat('\'')) { + return "string"; + } + return "error"; + } + + if (ch == '"') { + return switchState(source, setState, stringLiteral); + } + + if (largeRE.test(ch)) { + source.eatWhile(idRE); + if (source.eat('.')) { + return "qualifier"; + } + return "variable-2"; + } + + if (smallRE.test(ch)) { + source.eatWhile(idRE); + return "variable"; + } + + if (digitRE.test(ch)) { + if (ch == '0') { + if (source.eat(/[xX]/)) { + source.eatWhile(hexitRE); // should require at least 1 + return "integer"; + } + if (source.eat(/[oO]/)) { + source.eatWhile(octitRE); // should require at least 1 + return "number"; + } + } + source.eatWhile(digitRE); + var t = "number"; + if (source.eat('.')) { + t = "number"; + source.eatWhile(digitRE); // should require at least 1 + } + if (source.eat(/[eE]/)) { + t = "number"; + source.eat(/[-+]/); + source.eatWhile(digitRE); // should require at least 1 + } + return t; + } + + if (symbolRE.test(ch)) { + if (ch == '-' && source.eat(/-/)) { + source.eatWhile(/-/); + if (!source.eat(symbolRE)) { + source.skipToEnd(); + return "comment"; + } + } + var t = "variable"; + if (ch == ':') { + t = "variable-2"; + } + source.eatWhile(symbolRE); + return t; + } + + return "error"; + } + + function ncomment(type, nest) { + if (nest == 0) { + return normal; + } + return function(source, setState) { + var currNest = nest; + while (!source.eol()) { + var ch = source.next(); + if (ch == '{' && source.eat('-')) { + ++currNest; + } + else if (ch == '-' && source.eat('}')) { + --currNest; + if (currNest == 0) { + setState(normal); + return type; + } + } + } + setState(ncomment(type, currNest)); + return type; + } + } + + function stringLiteral(source, setState) { + while (!source.eol()) { + var ch = source.next(); + if (ch == '"') { + setState(normal); + return "string"; + } + if (ch == '\\') { + if (source.eol() || source.eat(whiteCharRE)) { + setState(stringGap); + return "string"; + } + if (source.eat('&')) { + } + else { + source.next(); // should handle other escapes here + } + } + } + setState(normal); + return "error"; + } + + function stringGap(source, setState) { + if (source.eat('\\')) { + return switchState(source, setState, stringLiteral); + } + source.next(); + setState(normal); + return "error"; + } + + + var wellKnownWords = (function() { + var wkw = {}; + function setType(t) { + return function () { + for (var i = 0; i < arguments.length; i++) + wkw[arguments[i]] = t; + } + } + + setType("keyword")( + "case", "class", "data", "default", "deriving", "do", "else", "foreign", + "if", "import", "in", "infix", "infixl", "infixr", "instance", "let", + "module", "newtype", "of", "then", "type", "where", "_"); + + setType("keyword")( + "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>"); + + setType("builtin")( + "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<", + "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**"); + + setType("builtin")( + "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq", + "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT", + "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left", + "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read", + "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS", + "String", "True"); + + setType("builtin")( + "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf", + "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling", + "compare", "concat", "concatMap", "const", "cos", "cosh", "curry", + "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either", + "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo", + "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter", + "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap", + "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger", + "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents", + "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized", + "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last", + "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map", + "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound", + "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or", + "otherwise", "pi", "pred", "print", "product", "properFraction", + "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile", + "readIO", "readList", "readLn", "readParen", "reads", "readsPrec", + "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse", + "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq", + "sequence", "sequence_", "show", "showChar", "showList", "showParen", + "showString", "shows", "showsPrec", "significand", "signum", "sin", + "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum", + "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger", + "toRational", "truncate", "uncurry", "undefined", "unlines", "until", + "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip", + "zip3", "zipWith", "zipWith3"); + + return wkw; + })(); + + + + return { + startState: function () { return { f: normal }; }, + copyState: function (s) { return { f: s.f }; }, + + token: function(stream, state) { + var t = state.f(stream, function(s) { state.f = s; }); + var w = stream.current(); + return (w in wellKnownWords) ? wellKnownWords[w] : t; + } + }; + +}); + +CodeMirror.defineMIME("text/x-haskell", "haskell"); diff --git a/conlite/external/codemirror/mode/haskell/index.html b/conlite/external/codemirror/mode/haskell/index.html new file mode 100644 index 0000000..15706e7 --- /dev/null +++ b/conlite/external/codemirror/mode/haskell/index.html @@ -0,0 +1,60 @@ + + + + CodeMirror: Haskell mode + + + + + + + + +

CodeMirror: Haskell mode

+ +
+ + + +

MIME types defined: text/x-haskell.

+ + diff --git a/conlite/external/codemirror/mode/haxe/haxe.js b/conlite/external/codemirror/mode/haxe/haxe.js new file mode 100644 index 0000000..ef78974 --- /dev/null +++ b/conlite/external/codemirror/mode/haxe/haxe.js @@ -0,0 +1,432 @@ +CodeMirror.defineMode("haxe", function(config, parserConfig) { + var indentUnit = config.indentUnit; + + // Tokenizer + + var keywords = function(){ + function kw(type) {return {type: type, style: "keyword"};} + var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); + var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"} + var type = kw("typedef"); + return { + "if": A, "while": A, "else": B, "do": B, "try": B, + "return": C, "break": C, "continue": C, "new": C, "throw": C, + "var": kw("var"), "inline":attribute, "static": attribute, "using":kw("import"), + "public": attribute, "private": attribute, "cast": kw("cast"), "import": kw("import"), "macro": kw("macro"), + "function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"), + "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), + "in": operator, "never": kw("property_access"), "trace":kw("trace"), + "class": type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type, + "true": atom, "false": atom, "null": atom + }; + }(); + + var isOperatorChar = /[+\-*&%=<>!?|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + function nextUntilUnescaped(stream, end) { + var escaped = false, next; + while ((next = stream.next()) != null) { + if (next == end && !escaped) + return false; + escaped = !escaped && next == "\\"; + } + return escaped; + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + function ret(tp, style, cont) { + type = tp; content = cont; + return style; + } + + function haxeTokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'") + return chain(stream, state, haxeTokenString(ch)); + else if (/[\[\]{}\(\),;\:\.]/.test(ch)) + return ret(ch); + else if (ch == "0" && stream.eat(/x/i)) { + stream.eatWhile(/[\da-f]/i); + return ret("number", "number"); + } + else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) { + stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); + return ret("number", "number"); + } + else if (state.reAllowed && (ch == "~" && stream.eat(/\//))) { + nextUntilUnescaped(stream, "/"); + stream.eatWhile(/[gimsu]/); + return ret("regexp", "string-2"); + } + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, haxeTokenComment); + } + else if (stream.eat("/")) { + stream.skipToEnd(); + return ret("comment", "comment"); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", null, stream.current()); + } + } + else if (ch == "#") { + stream.skipToEnd(); + return ret("conditional", "meta"); + } + else if (ch == "@") { + stream.eat(/:/); + stream.eatWhile(/[\w_]/); + return ret ("metadata", "meta"); + } + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", null, stream.current()); + } + else { + var word; + if(/[A-Z]/.test(ch)) + { + stream.eatWhile(/[\w_<>]/); + word = stream.current(); + return ret("type", "variable-3", word); + } + else + { + stream.eatWhile(/[\w_]/); + var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; + return (known && state.kwAllowed) ? ret(known.type, known.style, word) : + ret("variable", "variable", word); + } + } + } + + function haxeTokenString(quote) { + return function(stream, state) { + if (!nextUntilUnescaped(stream, quote)) + state.tokenize = haxeTokenBase; + return ret("string", "string"); + }; + } + + function haxeTokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = haxeTokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + // Parser + + var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true}; + + function HaxeLexical(indented, column, type, align, prev, info) { + this.indented = indented; + this.column = column; + this.type = type; + this.prev = prev; + this.info = info; + if (align != null) this.align = align; + } + + function inScope(state, varname) { + for (var v = state.localVars; v; v = v.next) + if (v.name == varname) return true; + } + + function parseHaxe(state, style, type, content, stream) { + var cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; + + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = true; + + while(true) { + var combinator = cc.length ? cc.pop() : statement; + if (combinator(type, content)) { + while(cc.length && cc[cc.length - 1].lex) + cc.pop()(); + if (cx.marked) return cx.marked; + if (type == "variable" && inScope(state, content)) return "variable-2"; + if (type == "variable" && imported(state, content)) return "variable-3"; + return style; + } + } + } + + function imported(state, typename) + { + if (/[a-z]/.test(typename.charAt(0))) + return false; + var len = state.importedtypes.length; + for (var i = 0; i= 0; i--) cx.cc.push(arguments[i]); + } + function cont() { + pass.apply(null, arguments); + return true; + } + function register(varname) { + var state = cx.state; + if (state.context) { + cx.marked = "def"; + for (var v = state.localVars; v; v = v.next) + if (v.name == varname) return; + state.localVars = {name: varname, next: state.localVars}; + } + } + + // Combinators + + var defaultVars = {name: "this", next: null}; + function pushcontext() { + if (!cx.state.context) cx.state.localVars = defaultVars; + cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; + } + function popcontext() { + cx.state.localVars = cx.state.context.vars; + cx.state.context = cx.state.context.prev; + } + function pushlex(type, info) { + var result = function() { + var state = cx.state; + state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info) + }; + result.lex = true; + return result; + } + function poplex() { + var state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type == ")") + state.indented = state.lexical.indented; + state.lexical = state.lexical.prev; + } + } + poplex.lex = true; + + function expect(wanted) { + return function expecting(type) { + if (type == wanted) return cont(); + else if (wanted == ";") return pass(); + else return cont(arguments.callee); + }; + } + + function statement(type) { + if (type == "@") return cont(metadef) + if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex); + if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); + if (type == "keyword b") return cont(pushlex("form"), statement, poplex); + if (type == "{") return cont(pushlex("}"), pushcontext, block, poplex, popcontext); + if (type == ";") return cont(); + if (type == "attribute") return cont(maybeattribute); + if (type == "function") return cont(functiondef); + if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), + poplex, statement, poplex); + if (type == "variable") return cont(pushlex("stat"), maybelabel); + if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), + block, poplex, poplex); + if (type == "case") return cont(expression, expect(":")); + if (type == "default") return cont(expect(":")); + if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), + statement, poplex, popcontext); + if (type == "import") return cont(importdef, expect(";")); + if (type == "typedef") return cont(typedef); + return pass(pushlex("stat"), expression, expect(";"), poplex); + } + function expression(type) { + if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator); + if (type == "function") return cont(functiondef); + if (type == "keyword c") return cont(maybeexpression); + if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator); + if (type == "operator") return cont(expression); + if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator); + if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator); + return cont(); + } + function maybeexpression(type) { + if (type.match(/[;\}\)\],]/)) return pass(); + return pass(expression); + } + + function maybeoperator(type, value) { + if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator); + if (type == "operator" || type == ":") return cont(expression); + if (type == ";") return; + if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); + if (type == ".") return cont(property, maybeoperator); + if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator); + } + + function maybeattribute(type, value) { + if (type == "attribute") return cont(maybeattribute); + if (type == "function") return cont(functiondef); + if (type == "var") return cont(vardef1); + } + + function metadef(type, value) { + if(type == ":") return cont(metadef); + if(type == "variable") return cont(metadef); + if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement) + } + function metaargs(type, value) { + if(typ == "variable") return cont(); + } + + function importdef (type, value) { + if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); } + else if(type == "variable" || type == "property" || type == ".") return cont(importdef); + } + + function typedef (type, value) + { + if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); } + } + + function maybelabel(type) { + if (type == ":") return cont(poplex, statement); + return pass(maybeoperator, expect(";"), poplex); + } + function property(type) { + if (type == "variable") {cx.marked = "property"; return cont();} + } + function objprop(type) { + if (type == "variable") cx.marked = "property"; + if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression); + } + function commasep(what, end) { + function proceed(type) { + if (type == ",") return cont(what, proceed); + if (type == end) return cont(); + return cont(expect(end)); + } + return function commaSeparated(type) { + if (type == end) return cont(); + else return pass(what, proceed); + }; + } + function block(type) { + if (type == "}") return cont(); + return pass(statement, block); + } + function vardef1(type, value) { + if (type == "variable"){register(value); return cont(typeuse, vardef2);} + return cont(); + } + function vardef2(type, value) { + if (value == "=") return cont(expression, vardef2); + if (type == ",") return cont(vardef1); + } + function forspec1(type, value) { + if (type == "variable") { + register(value); + } + return cont(pushlex(")"), pushcontext, forin, expression, poplex, statement, popcontext); + } + function forin(type, value) { + if (value == "in") return cont(); + } + function functiondef(type, value) { + if (type == "variable") {register(value); return cont(functiondef);} + if (value == "new") return cont(functiondef); + if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, typeuse, statement, popcontext); + } + function typeuse(type, value) { + if(type == ":") return cont(typestring); + } + function typestring(type, value) { + if(type == "type") return cont(); + if(type == "variable") return cont(); + if(type == "{") return cont(pushlex("}"), commasep(typeprop, "}"), poplex); + } + function typeprop(type, value) { + if(type == "variable") return cont(typeuse); + } + function funarg(type, value) { + if (type == "variable") {register(value); return cont(typeuse);} + } + + // Interface + + return { + startState: function(basecolumn) { + var defaulttypes = ["Int", "Float", "String", "Void", "Std", "Bool", "Dynamic", "Array"]; + return { + tokenize: haxeTokenBase, + reAllowed: true, + kwAllowed: true, + cc: [], + lexical: new HaxeLexical((basecolumn || 0) - indentUnit, 0, "block", false), + localVars: parserConfig.localVars, + importedtypes: defaulttypes, + context: parserConfig.localVars && {vars: parserConfig.localVars}, + indented: 0 + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = false; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (type == "comment") return style; + state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/)); + state.kwAllowed = type != '.'; + return parseHaxe(state, style, type, content, stream); + }, + + indent: function(state, textAfter) { + if (state.tokenize != haxeTokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; + if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; + var type = lexical.type, closing = firstChar == type; + if (type == "vardef") return lexical.indented + 4; + else if (type == "form" && firstChar == "{") return lexical.indented; + else if (type == "stat" || type == "form") return lexical.indented + indentUnit; + else if (lexical.info == "switch" && !closing) + return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); + else if (lexical.align) return lexical.column + (closing ? 0 : 1); + else return lexical.indented + (closing ? 0 : indentUnit); + }, + compareStates: function(state1, state2) { + return (state1.localVars == state2.localVars) && (state1.context == state2.context); + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-haxe", "haxe"); diff --git a/conlite/external/codemirror/mode/haxe/index.html b/conlite/external/codemirror/mode/haxe/index.html new file mode 100644 index 0000000..6e9948a --- /dev/null +++ b/conlite/external/codemirror/mode/haxe/index.html @@ -0,0 +1,90 @@ + + + + CodeMirror: Haxe mode + + + + + + + +

CodeMirror: Haxe mode

+ +
+ + + +

MIME types defined: text/x-haxe.

+ + diff --git a/conlite/external/codemirror/mode/htmlembedded/htmlembedded.js b/conlite/external/codemirror/mode/htmlembedded/htmlembedded.js new file mode 100644 index 0000000..1773aeb --- /dev/null +++ b/conlite/external/codemirror/mode/htmlembedded/htmlembedded.js @@ -0,0 +1,68 @@ +CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { + + //config settings + var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, + scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; + + //inner modes + var scriptingMode, htmlMixedMode; + + //tokenizer when in html mode + function htmlDispatch(stream, state) { + if (stream.match(scriptStartRegex, false)) { + state.token=scriptingDispatch; + return scriptingMode.token(stream, state.scriptState); + } + else + return htmlMixedMode.token(stream, state.htmlState); + } + + //tokenizer when in scripting mode + function scriptingDispatch(stream, state) { + if (stream.match(scriptEndRegex, false)) { + state.token=htmlDispatch; + return htmlMixedMode.token(stream, state.htmlState); + } + else + return scriptingMode.token(stream, state.scriptState); + } + + + return { + startState: function() { + scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec); + htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed"); + return { + token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch, + htmlState : htmlMixedMode.startState(), + scriptState : scriptingMode.startState() + } + }, + + token: function(stream, state) { + return state.token(stream, state); + }, + + indent: function(state, textAfter) { + if (state.token == htmlDispatch) + return htmlMixedMode.indent(state.htmlState, textAfter); + else + return scriptingMode.indent(state.scriptState, textAfter); + }, + + copyState: function(state) { + return { + token : state.token, + htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), + scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) + } + }, + + + electricChars: "/{}:" + } +}, "htmlmixed"); + +CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"}); +CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); +CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"}); diff --git a/conlite/external/codemirror/mode/htmlembedded/index.html b/conlite/external/codemirror/mode/htmlembedded/index.html new file mode 100644 index 0000000..c1374e5 --- /dev/null +++ b/conlite/external/codemirror/mode/htmlembedded/index.html @@ -0,0 +1,49 @@ + + + + CodeMirror: Html Embedded Scripts mode + + + + + + + + + + + +

CodeMirror: Html Embedded Scripts mode

+ +
+ + + +

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on + JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

+ +

MIME types defined: application/x-aspx (ASP.NET), + application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

+ + diff --git a/conlite/external/codemirror/mode/htmlmixed/htmlmixed.js b/conlite/external/codemirror/mode/htmlmixed/htmlmixed.js new file mode 100644 index 0000000..a6c62c9 --- /dev/null +++ b/conlite/external/codemirror/mode/htmlmixed/htmlmixed.js @@ -0,0 +1,85 @@ +CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { + var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); + var jsMode = CodeMirror.getMode(config, "javascript"); + var cssMode = CodeMirror.getMode(config, "css"); + + function html(stream, state) { + var style = htmlMode.token(stream, state.htmlState); + if (style == "tag" && stream.current() == ">" && state.htmlState.context) { + if (/^script$/i.test(state.htmlState.context.tagName)) { + state.token = javascript; + state.localState = jsMode.startState(htmlMode.indent(state.htmlState, "")); + state.mode = "javascript"; + } + else if (/^style$/i.test(state.htmlState.context.tagName)) { + state.token = css; + state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "")); + state.mode = "css"; + } + } + return style; + } + function maybeBackup(stream, pat, style) { + var cur = stream.current(); + var close = cur.search(pat); + if (close > -1) stream.backUp(cur.length - close); + return style; + } + function javascript(stream, state) { + if (stream.match(/^<\/\s*script\s*>/i, false)) { + state.token = html; + state.localState = null; + state.mode = "html"; + return html(stream, state); + } + return maybeBackup(stream, /<\/\s*script\s*>/, + jsMode.token(stream, state.localState)); + } + function css(stream, state) { + if (stream.match(/^<\/\s*style\s*>/i, false)) { + state.token = html; + state.localState = null; + state.mode = "html"; + return html(stream, state); + } + return maybeBackup(stream, /<\/\s*style\s*>/, + cssMode.token(stream, state.localState)); + } + + return { + startState: function() { + var state = htmlMode.startState(); + return {token: html, localState: null, mode: "html", htmlState: state}; + }, + + copyState: function(state) { + if (state.localState) + var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState); + return {token: state.token, localState: local, mode: state.mode, + htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; + }, + + token: function(stream, state) { + return state.token(stream, state); + }, + + indent: function(state, textAfter) { + if (state.token == html || /^\s*<\//.test(textAfter)) + return htmlMode.indent(state.htmlState, textAfter); + else if (state.token == javascript) + return jsMode.indent(state.localState, textAfter); + else + return cssMode.indent(state.localState, textAfter); + }, + + compareStates: function(a, b) { + if (a.mode != b.mode) return false; + if (a.localState) return CodeMirror.Pass; + return htmlMode.compareStates(a.htmlState, b.htmlState); + }, + + electricChars: "/{}:" + } +}, "xml", "javascript", "css"); + +CodeMirror.defineMIME("text/html", "htmlmixed"); diff --git a/conlite/external/codemirror/mode/htmlmixed/index.html b/conlite/external/codemirror/mode/htmlmixed/index.html new file mode 100644 index 0000000..63fc412 --- /dev/null +++ b/conlite/external/codemirror/mode/htmlmixed/index.html @@ -0,0 +1,51 @@ + + + + CodeMirror: HTML mixed mode + + + + + + + + + + +

CodeMirror: HTML mixed mode

+
+ + +

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

+ +

MIME types defined: text/html + (redefined, only takes effect if you load this parser after the + XML parser).

+ + + diff --git a/conlite/external/codemirror/mode/javascript/index.html b/conlite/external/codemirror/mode/javascript/index.html new file mode 100644 index 0000000..c3ab91d --- /dev/null +++ b/conlite/external/codemirror/mode/javascript/index.html @@ -0,0 +1,77 @@ + + + + CodeMirror: JavaScript mode + + + + + + + +

CodeMirror: JavaScript mode

+ +
+ + + +

JavaScript mode supports a single configuration + option, json, which will set the mode to expect JSON + data rather than a JavaScript program.

+ +

MIME types defined: text/javascript, application/json.

+ + diff --git a/conlite/external/codemirror/mode/javascript/javascript.js b/conlite/external/codemirror/mode/javascript/javascript.js new file mode 100644 index 0000000..65f11c5 --- /dev/null +++ b/conlite/external/codemirror/mode/javascript/javascript.js @@ -0,0 +1,361 @@ +CodeMirror.defineMode("javascript", function(config, parserConfig) { + var indentUnit = config.indentUnit; + var jsonMode = parserConfig.json; + + // Tokenizer + + var keywords = function(){ + function kw(type) {return {type: type, style: "keyword"};} + var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); + var operator = kw("operator"), atom = {type: "atom", style: "atom"}; + return { + "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, + "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, + "var": kw("var"), "const": kw("var"), "let": kw("var"), + "function": kw("function"), "catch": kw("catch"), + "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), + "in": operator, "typeof": operator, "instanceof": operator, + "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom + }; + }(); + + var isOperatorChar = /[+\-*&%=<>!?|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + function nextUntilUnescaped(stream, end) { + var escaped = false, next; + while ((next = stream.next()) != null) { + if (next == end && !escaped) + return false; + escaped = !escaped && next == "\\"; + } + return escaped; + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + function ret(tp, style, cont) { + type = tp; content = cont; + return style; + } + + function jsTokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'") + return chain(stream, state, jsTokenString(ch)); + else if (/[\[\]{}\(\),;\:\.]/.test(ch)) + return ret(ch); + else if (ch == "0" && stream.eat(/x/i)) { + stream.eatWhile(/[\da-f]/i); + return ret("number", "number"); + } + else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) { + stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); + return ret("number", "number"); + } + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, jsTokenComment); + } + else if (stream.eat("/")) { + stream.skipToEnd(); + return ret("comment", "comment"); + } + else if (state.reAllowed) { + nextUntilUnescaped(stream, "/"); + stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla + return ret("regexp", "string-2"); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", null, stream.current()); + } + } + else if (ch == "#") { + stream.skipToEnd(); + return ret("error", "error"); + } + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", null, stream.current()); + } + else { + stream.eatWhile(/[\w\$_]/); + var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; + return (known && state.kwAllowed) ? ret(known.type, known.style, word) : + ret("variable", "variable", word); + } + } + + function jsTokenString(quote) { + return function(stream, state) { + if (!nextUntilUnescaped(stream, quote)) + state.tokenize = jsTokenBase; + return ret("string", "string"); + }; + } + + function jsTokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + // Parser + + var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true}; + + function JSLexical(indented, column, type, align, prev, info) { + this.indented = indented; + this.column = column; + this.type = type; + this.prev = prev; + this.info = info; + if (align != null) this.align = align; + } + + function inScope(state, varname) { + for (var v = state.localVars; v; v = v.next) + if (v.name == varname) return true; + } + + function parseJS(state, style, type, content, stream) { + var cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; + + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = true; + + while(true) { + var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; + if (combinator(type, content)) { + while(cc.length && cc[cc.length - 1].lex) + cc.pop()(); + if (cx.marked) return cx.marked; + if (type == "variable" && inScope(state, content)) return "variable-2"; + return style; + } + } + } + + // Combinator utils + + var cx = {state: null, column: null, marked: null, cc: null}; + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); + } + function cont() { + pass.apply(null, arguments); + return true; + } + function register(varname) { + var state = cx.state; + if (state.context) { + cx.marked = "def"; + for (var v = state.localVars; v; v = v.next) + if (v.name == varname) return; + state.localVars = {name: varname, next: state.localVars}; + } + } + + // Combinators + + var defaultVars = {name: "this", next: {name: "arguments"}}; + function pushcontext() { + if (!cx.state.context) cx.state.localVars = defaultVars; + cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; + } + function popcontext() { + cx.state.localVars = cx.state.context.vars; + cx.state.context = cx.state.context.prev; + } + function pushlex(type, info) { + var result = function() { + var state = cx.state; + state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info) + }; + result.lex = true; + return result; + } + function poplex() { + var state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type == ")") + state.indented = state.lexical.indented; + state.lexical = state.lexical.prev; + } + } + poplex.lex = true; + + function expect(wanted) { + return function expecting(type) { + if (type == wanted) return cont(); + else if (wanted == ";") return pass(); + else return cont(arguments.callee); + }; + } + + function statement(type) { + if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex); + if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); + if (type == "keyword b") return cont(pushlex("form"), statement, poplex); + if (type == "{") return cont(pushlex("}"), block, poplex); + if (type == ";") return cont(); + if (type == "function") return cont(functiondef); + if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), + poplex, statement, poplex); + if (type == "variable") return cont(pushlex("stat"), maybelabel); + if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), + block, poplex, poplex); + if (type == "case") return cont(expression, expect(":")); + if (type == "default") return cont(expect(":")); + if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), + statement, poplex, popcontext); + return pass(pushlex("stat"), expression, expect(";"), poplex); + } + function expression(type) { + if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator); + if (type == "function") return cont(functiondef); + if (type == "keyword c") return cont(maybeexpression); + if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator); + if (type == "operator") return cont(expression); + if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator); + if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator); + return cont(); + } + function maybeexpression(type) { + if (type.match(/[;\}\)\],]/)) return pass(); + return pass(expression); + } + + function maybeoperator(type, value) { + if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator); + if (type == "operator" || type == ":") return cont(expression); + if (type == ";") return; + if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); + if (type == ".") return cont(property, maybeoperator); + if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator); + } + function maybelabel(type) { + if (type == ":") return cont(poplex, statement); + return pass(maybeoperator, expect(";"), poplex); + } + function property(type) { + if (type == "variable") {cx.marked = "property"; return cont();} + } + function objprop(type) { + if (type == "variable") cx.marked = "property"; + if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression); + } + function commasep(what, end) { + function proceed(type) { + if (type == ",") return cont(what, proceed); + if (type == end) return cont(); + return cont(expect(end)); + } + return function commaSeparated(type) { + if (type == end) return cont(); + else return pass(what, proceed); + }; + } + function block(type) { + if (type == "}") return cont(); + return pass(statement, block); + } + function vardef1(type, value) { + if (type == "variable"){register(value); return cont(vardef2);} + return cont(); + } + function vardef2(type, value) { + if (value == "=") return cont(expression, vardef2); + if (type == ",") return cont(vardef1); + } + function forspec1(type) { + if (type == "var") return cont(vardef1, forspec2); + if (type == ";") return pass(forspec2); + if (type == "variable") return cont(formaybein); + return pass(forspec2); + } + function formaybein(type, value) { + if (value == "in") return cont(expression); + return cont(maybeoperator, forspec2); + } + function forspec2(type, value) { + if (type == ";") return cont(forspec3); + if (value == "in") return cont(expression); + return cont(expression, expect(";"), forspec3); + } + function forspec3(type) { + if (type != ")") cont(expression); + } + function functiondef(type, value) { + if (type == "variable") {register(value); return cont(functiondef);} + if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext); + } + function funarg(type, value) { + if (type == "variable") {register(value); return cont();} + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: jsTokenBase, + reAllowed: true, + kwAllowed: true, + cc: [], + lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), + localVars: parserConfig.localVars, + context: parserConfig.localVars && {vars: parserConfig.localVars}, + indented: 0 + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = false; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (type == "comment") return style; + state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/)); + state.kwAllowed = type != '.'; + return parseJS(state, style, type, content, stream); + }, + + indent: function(state, textAfter) { + if (state.tokenize != jsTokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; + if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; + var type = lexical.type, closing = firstChar == type; + if (type == "vardef") return lexical.indented + 4; + else if (type == "form" && firstChar == "{") return lexical.indented; + else if (type == "stat" || type == "form") return lexical.indented + indentUnit; + else if (lexical.info == "switch" && !closing) + return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); + else if (lexical.align) return lexical.column + (closing ? 0 : 1); + else return lexical.indented + (closing ? 0 : indentUnit); + }, + + electricChars: ":{}" + }; +}); + +CodeMirror.defineMIME("text/javascript", "javascript"); +CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); diff --git a/conlite/external/codemirror/mode/jinja2/index.html b/conlite/external/codemirror/mode/jinja2/index.html new file mode 100644 index 0000000..021a282 --- /dev/null +++ b/conlite/external/codemirror/mode/jinja2/index.html @@ -0,0 +1,37 @@ + + + + CodeMirror: Jinja2 mode + + + + + + + +

CodeMirror: Jinja2 mode

+
+ + + diff --git a/conlite/external/codemirror/mode/jinja2/jinja2.js b/conlite/external/codemirror/mode/jinja2/jinja2.js new file mode 100644 index 0000000..75419d8 --- /dev/null +++ b/conlite/external/codemirror/mode/jinja2/jinja2.js @@ -0,0 +1,42 @@ +CodeMirror.defineMode("jinja2", function(config, parserConf) { + var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", + "loop", "none", "self", "super", "if", "as", "not", "and", + "else", "import", "with", "without", "context"]; + keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); + + function tokenBase (stream, state) { + var ch = stream.next(); + if (ch == "{") { + if (ch = stream.eat(/\{|%|#/)) { + stream.eat("-"); + state.tokenize = inTag(ch); + return "tag"; + } + } + } + function inTag (close) { + if (close == "{") { + close = "}"; + } + return function (stream, state) { + var ch = stream.next(); + if ((ch == close || (ch == "-" && stream.eat(close))) + && stream.eat("}")) { + state.tokenize = tokenBase; + return "tag"; + } + if (stream.match(keywords)) { + return "keyword"; + } + return close == "#" ? "comment" : "string"; + }; + } + return { + startState: function () { + return {tokenize: tokenBase}; + }, + token: function (stream, state) { + return state.tokenize(stream, state); + } + }; +}); diff --git a/conlite/external/codemirror/mode/less/index.html b/conlite/external/codemirror/mode/less/index.html new file mode 100644 index 0000000..cad8e4b --- /dev/null +++ b/conlite/external/codemirror/mode/less/index.html @@ -0,0 +1,618 @@ + + + + CodeMirror: LESS mode + + + + + + + + + +

CodeMirror: LESS mode

+
+ + +

MIME types defined: text/x-less, text/css (if not previously defined).

+ + diff --git a/conlite/external/codemirror/mode/less/less.js b/conlite/external/codemirror/mode/less/less.js new file mode 100644 index 0000000..e80beb1 --- /dev/null +++ b/conlite/external/codemirror/mode/less/less.js @@ -0,0 +1,232 @@ +/* + LESS mode - http://www.lesscss.org/ + Ported to CodeMirror by Peter Kroon +*/ + +CodeMirror.defineMode("less", function(config) { + var indentUnit = config.indentUnit, type; + function ret(style, tp) {type = tp; return style;} + //html5 tags + var tags = ["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"]; + + function inTagsArray(val){ + for(var i=0; i*\/]/.test(ch)) {//removed . dot character original was [,.+>*\/] + return ret(null, "select-op"); + } + else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]] + if(ch == ":"){ + stream.eatWhile(/[active|hover|link|visited]/); + if( stream.current().match(/active|hover|link|visited/)){ + return ret("tag", "tag"); + }else{ + return ret(null, ch); + } + }else{ + return ret(null, ch); + } + } + else if (ch == ".") { // lesscss + stream.eatWhile(/[\a-zA-Z0-9\-_]/); + return ret("tag", "tag"); + } + else if (ch == "#") { // lesscss + //we don't eat white-space, we want the hex color and or id only + stream.eatWhile(/[A-Za-z0-9]/); + //check if there is a proper hex color length e.g. #eee || #eeeEEE + if(stream.current().length ===4 || stream.current().length ===7){ + if(stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false) != null){//is there a valid hex color value present in the current stream + //when not a valid hex value, parse as id + if(stream.current().substring(1) != stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false))return ret("atom", "tag"); + //eat white-space + stream.eatSpace(); + //when hex value declaration doesn't end with [;,] but is does with a slash/cc comment treat it as an id, just like the other hex values that don't end with[;,] + if( /[\/<>.(){!$%^&*_\-\\?=+\|#'~`]/.test(stream.peek()) )return ret("atom", "tag"); + //#time { color: #aaa } + else if(stream.peek() == "}" )return ret("number", "unit"); + //we have a valid hex color value, parse as id whenever an element/class is defined after the hex(id) value e.g. #eee aaa || #eee .aaa + else if( /[a-zA-Z\\]/.test(stream.peek()) )return ret("atom", "tag"); + //when a hex value is on the end of a line, parse as id + else if(stream.eol())return ret("atom", "tag"); + //default + else return ret("number", "unit"); + }else{//when not a valid hexvalue in the current stream e.g. #footer + stream.eatWhile(/[\w\\\-]/); + return ret("atom", "tag"); + } + }else{ + stream.eatWhile(/[\w\\\-]/); + return ret("atom", "tag"); + } + } + else if (ch == "&") { + stream.eatWhile(/[\w\-]/); + return ret(null, ch); + } + else { + stream.eatWhile(/[\w\\\-_%.{]/); + if(stream.current().match(/http|https/) != null){ + stream.eatWhile(/[\w\\\-_%.{:\/]/); + return ret("string", "string"); + }else if(stream.peek() == "<" || stream.peek() == ">"){ + return ret("tag", "tag"); + }else if( stream.peek().match(/\(/) != null ){// lessc + return ret(null, ch); + }else if (stream.peek() == "/" && state.stack[state.stack.length-1] != undefined){ // url(dir/center/image.png) + return ret("string", "string"); + }else if( stream.current().match(/\-\d|\-.\d/) ){ // lesscss match e.g.: -5px -0.4 etc... only colorize the minus sign + //stream.backUp(stream.current().length-1); //commment out these 2 comment if you want the minus sign to be parsed as null -500px + //return ret(null, ch); + return ret("number", "unit"); + }else if( inTagsArray(stream.current()) ){ // lesscss match html tags + return ret("tag", "tag"); + }else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){ + if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){ + stream.backUp(1); + return ret("tag", "tag"); + }//end if + if( (stream.eatSpace() && stream.peek().match(/[{<>.a-zA-Z]/) != null) || stream.eol() )return ret("tag", "tag");//e.g. button.icon-plus + return ret("string", "string");//let url(/images/logo.png) without quotes return as string + }else if( stream.eol() ){ + if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1); + return ret("tag", "tag"); + }else{ + return ret("variable", "variable"); + } + } + + } + + function tokenSComment(stream, state) {// SComment = Slash comment + stream.skipToEnd(); + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenSGMLComment(stream, state) { + var dashes = 0, ch; + while ((ch = stream.next()) != null) { + if (dashes >= 2 && ch == ">") { + state.tokenize = tokenBase; + break; + } + dashes = (ch == "-") ? dashes + 1 : 0; + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + baseIndent: base || 0, + stack: []}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + var context = state.stack[state.stack.length-1]; + if (type == "hash" && context == "rule") style = "atom"; + else if (style == "variable") { + if (context == "rule") style = null; //"tag" + else if (!context || context == "@media{"){ + style = stream.current() == "when" ? "variable" : + stream.string.match(/#/g) != undefined ? null : + /[\s,|\s\)]/.test(stream.peek()) ? "tag" : null; + } + } + + if (context == "rule" && /^[\{\};]$/.test(type)) + state.stack.pop(); + if (type == "{") { + if (context == "@media") state.stack[state.stack.length-1] = "@media{"; + else state.stack.push("{"); + } + else if (type == "}") state.stack.pop(); + else if (type == "@media") state.stack.push("@media"); + else if (context == "{" && type != "comment") state.stack.push("rule"); + return style; + }, + + indent: function(state, textAfter) { + var n = state.stack.length; + if (/^\}/.test(textAfter)) + n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1; + return state.baseIndent + n * indentUnit; + }, + + electricChars: "}" + }; +}); + +CodeMirror.defineMIME("text/x-less", "less"); +if (!CodeMirror.mimeModes.hasOwnProperty("text/css")) + CodeMirror.defineMIME("text/css", "less"); diff --git a/conlite/external/codemirror/mode/lua/index.html b/conlite/external/codemirror/mode/lua/index.html new file mode 100644 index 0000000..600ddb0 --- /dev/null +++ b/conlite/external/codemirror/mode/lua/index.html @@ -0,0 +1,72 @@ + + + + CodeMirror: Lua mode + + + + + + + + +

CodeMirror: Lua mode

+
+ + +

Loosely based on Franciszek + Wawrzak's CodeMirror + 1 mode. One configuration parameter is + supported, specials, to which you can provide an + array of strings to have those identifiers highlighted with + the lua-special style.

+

MIME types defined: text/x-lua.

+ + + diff --git a/conlite/external/codemirror/mode/lua/lua.js b/conlite/external/codemirror/mode/lua/lua.js new file mode 100644 index 0000000..60e84a9 --- /dev/null +++ b/conlite/external/codemirror/mode/lua/lua.js @@ -0,0 +1,140 @@ +// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's +// CodeMirror 1 mode. +// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting + +CodeMirror.defineMode("lua", function(config, parserConfig) { + var indentUnit = config.indentUnit; + + function prefixRE(words) { + return new RegExp("^(?:" + words.join("|") + ")", "i"); + } + function wordRE(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + var specials = wordRE(parserConfig.specials || []); + + // long list of standard functions from lua manual + var builtins = wordRE([ + "_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load", + "loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require", + "select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall", + + "coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield", + + "debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable", + "debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable", + "debug.setupvalue","debug.traceback", + + "close","flush","lines","read","seek","setvbuf","write", + + "io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin", + "io.stdout","io.tmpfile","io.type","io.write", + + "math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg", + "math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max", + "math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh", + "math.sqrt","math.tan","math.tanh", + + "os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale", + "os.time","os.tmpname", + + "package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload", + "package.seeall", + + "string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub", + "string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper", + + "table.concat","table.insert","table.maxn","table.remove","table.sort" + ]); + var keywords = wordRE(["and","break","elseif","false","nil","not","or","return", + "true","function", "end", "if", "then", "else", "do", + "while", "repeat", "until", "for", "in", "local" ]); + + var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]); + var dedentTokens = wordRE(["end", "until", "\\)", "}"]); + var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]); + + function readBracket(stream) { + var level = 0; + while (stream.eat("=")) ++level; + stream.eat("["); + return level; + } + + function normal(stream, state) { + var ch = stream.next(); + if (ch == "-" && stream.eat("-")) { + if (stream.eat("[")) + return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state); + stream.skipToEnd(); + return "comment"; + } + if (ch == "\"" || ch == "'") + return (state.cur = string(ch))(stream, state); + if (ch == "[" && /[\[=]/.test(stream.peek())) + return (state.cur = bracketed(readBracket(stream), "string"))(stream, state); + if (/\d/.test(ch)) { + stream.eatWhile(/[\w.%]/); + return "number"; + } + if (/[\w_]/.test(ch)) { + stream.eatWhile(/[\w\\\-_.]/); + return "variable"; + } + return null; + } + + function bracketed(level, style) { + return function(stream, state) { + var curlev = null, ch; + while ((ch = stream.next()) != null) { + if (curlev == null) {if (ch == "]") curlev = 0;} + else if (ch == "=") ++curlev; + else if (ch == "]" && curlev == level) { state.cur = normal; break; } + else curlev = null; + } + return style; + }; + } + + function string(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.cur = normal; + return "string"; + }; + } + + return { + startState: function(basecol) { + return {basecol: basecol || 0, indentDepth: 0, cur: normal}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.cur(stream, state); + var word = stream.current(); + if (style == "variable") { + if (keywords.test(word)) style = "keyword"; + else if (builtins.test(word)) style = "builtin"; + else if (specials.test(word)) style = "variable-2"; + } + if ((style != "comment") && (style != "string")){ + if (indentTokens.test(word)) ++state.indentDepth; + else if (dedentTokens.test(word)) --state.indentDepth; + } + return style; + }, + + indent: function(state, textAfter) { + var closing = dedentPartial.test(textAfter); + return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0)); + } + }; +}); + +CodeMirror.defineMIME("text/x-lua", "lua"); diff --git a/conlite/external/codemirror/mode/markdown/index.html b/conlite/external/codemirror/mode/markdown/index.html new file mode 100644 index 0000000..c8791a7 --- /dev/null +++ b/conlite/external/codemirror/mode/markdown/index.html @@ -0,0 +1,340 @@ + + + + CodeMirror: Markdown mode + + + + + + + + +

CodeMirror: Markdown mode

+ + +
+ + + +

Optionally depends on the XML mode for properly highlighted inline XML blocks.

+ +

MIME types defined: text/x-markdown.

+ + + diff --git a/conlite/external/codemirror/mode/markdown/markdown.js b/conlite/external/codemirror/mode/markdown/markdown.js new file mode 100644 index 0000000..e3d5676 --- /dev/null +++ b/conlite/external/codemirror/mode/markdown/markdown.js @@ -0,0 +1,268 @@ +CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { + + var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html"); + var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? "text/html" : "text/plain"); + + var header = 'header' + , code = 'comment' + , quote = 'quote' + , list = 'string' + , hr = 'hr' + , linktext = 'link' + , linkhref = 'string' + , em = 'em' + , strong = 'strong' + , emstrong = 'emstrong'; + + var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/ + , ulRE = /^[*\-+]\s+/ + , olRE = /^[0-9]+\.\s+/ + , headerRE = /^(?:\={3,}|-{3,})$/ + , textRE = /^[^\[*_\\<>`]+/; + + function switchInline(stream, state, f) { + state.f = state.inline = f; + return f(stream, state); + } + + function switchBlock(stream, state, f) { + state.f = state.block = f; + return f(stream, state); + } + + + // Blocks + + function blankLine(state) { + // Reset EM state + state.em = false; + // Reset STRONG state + state.strong = false; + if (!htmlFound && state.f == htmlBlock) { + state.f = inlineNormal; + state.block = blockNormal; + } + return null; + } + + function blockNormal(stream, state) { + var match; + if (state.indentationDiff >= 4) { + state.indentation -= state.indentationDiff; + stream.skipToEnd(); + return code; + } else if (stream.eatSpace()) { + return null; + } else if (stream.peek() === '#' || stream.match(headerRE)) { + state.header = true; + } else if (stream.eat('>')) { + state.indentation++; + state.quote = true; + } else if (stream.peek() === '[') { + return switchInline(stream, state, footnoteLink); + } else if (stream.match(hrRE, true)) { + return hr; + } else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) { + state.indentation += match[0].length; + return list; + } + + return switchInline(stream, state, state.inline); + } + + function htmlBlock(stream, state) { + var style = htmlMode.token(stream, state.htmlState); + if (htmlFound && style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) { + state.f = inlineNormal; + state.block = blockNormal; + } + if (state.md_inside && stream.current().indexOf(">")!=-1) { + state.f = inlineNormal; + state.block = blockNormal; + state.htmlState.context = undefined; + } + return style; + } + + + // Inline + function getType(state) { + var styles = []; + + if (state.strong) { styles.push(state.em ? emstrong : strong); } + else if (state.em) { styles.push(em); } + + if (state.header) { styles.push(header); } + if (state.quote) { styles.push(quote); } + + return styles.length ? styles.join(' ') : null; + } + + function handleText(stream, state) { + if (stream.match(textRE, true)) { + return getType(state); + } + return undefined; + } + + function inlineNormal(stream, state) { + var style = state.text(stream, state) + if (typeof style !== 'undefined') + return style; + + var ch = stream.next(); + + if (ch === '\\') { + stream.next(); + return getType(state); + } + if (ch === '`') { + return switchInline(stream, state, inlineElement(code, '`')); + } + if (ch === '[') { + return switchInline(stream, state, linkText); + } + if (ch === '<' && stream.match(/^\w/, false)) { + var md_inside = false; + if (stream.string.indexOf(">")!=-1) { + var atts = stream.string.substring(1,stream.string.indexOf(">")); + if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) { + state.md_inside = true; + } + } + stream.backUp(1); + return switchBlock(stream, state, htmlBlock); + } + + if (ch === '<' && stream.match(/^\/\w*?>/)) { + state.md_inside = false; + return "tag"; + } + + var t = getType(state); + if (ch === '*' || ch === '_') { + if (stream.eat(ch)) { + return (state.strong = !state.strong) ? getType(state) : t; + } + return (state.em = !state.em) ? getType(state) : t; + } + + return getType(state); + } + + function linkText(stream, state) { + while (!stream.eol()) { + var ch = stream.next(); + if (ch === '\\') stream.next(); + if (ch === ']') { + state.inline = state.f = linkHref; + return linktext; + } + } + return linktext; + } + + function linkHref(stream, state) { + stream.eatSpace(); + var ch = stream.next(); + if (ch === '(' || ch === '[') { + return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']')); + } + return 'error'; + } + + function footnoteLink(stream, state) { + if (stream.match(/^[^\]]*\]:/, true)) { + state.f = footnoteUrl; + return linktext; + } + return switchInline(stream, state, inlineNormal); + } + + function footnoteUrl(stream, state) { + stream.eatSpace(); + stream.match(/^[^\s]+/, true); + state.f = state.inline = inlineNormal; + return linkhref; + } + + function inlineRE(endChar) { + if (!inlineRE[endChar]) { + // match any not-escaped-non-endChar and any escaped char + // then match endChar or eol + inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)'); + } + return inlineRE[endChar]; + } + + function inlineElement(type, endChar, next) { + next = next || inlineNormal; + return function(stream, state) { + stream.match(inlineRE(endChar)); + state.inline = state.f = next; + return type; + }; + } + + return { + startState: function() { + return { + f: blockNormal, + + block: blockNormal, + htmlState: CodeMirror.startState(htmlMode), + indentation: 0, + + inline: inlineNormal, + text: handleText, + em: false, + strong: false, + header: false, + quote: false + }; + }, + + copyState: function(s) { + return { + f: s.f, + + block: s.block, + htmlState: CodeMirror.copyState(htmlMode, s.htmlState), + indentation: s.indentation, + + inline: s.inline, + text: s.text, + em: s.em, + strong: s.strong, + header: s.header, + quote: s.quote, + md_inside: s.md_inside + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (stream.match(/^\s*$/, true)) { return blankLine(state); } + + // Reset state.header + state.header = false; + // Reset state.quote + state.quote = false; + + state.f = state.block; + var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length; + state.indentationDiff = indentation - state.indentation; + state.indentation = indentation; + if (indentation > 0) { return null; } + } + return state.f(stream, state); + }, + + blankLine: blankLine, + + getType: getType + }; + +}, "xml"); + +CodeMirror.defineMIME("text/x-markdown", "markdown"); diff --git a/conlite/external/codemirror/mode/mysql/index.html b/conlite/external/codemirror/mode/mysql/index.html new file mode 100644 index 0000000..006918c --- /dev/null +++ b/conlite/external/codemirror/mode/mysql/index.html @@ -0,0 +1,41 @@ + + + + CodeMirror: MySQL mode + + + + + + + +

CodeMirror: MySQL mode

+
+ + +

MIME types defined: text/x-mysql.

+ + + diff --git a/conlite/external/codemirror/mode/mysql/mysql.js b/conlite/external/codemirror/mode/mysql/mysql.js new file mode 100644 index 0000000..3098d77 --- /dev/null +++ b/conlite/external/codemirror/mode/mysql/mysql.js @@ -0,0 +1,186 @@ +/* + * MySQL Mode for CodeMirror 2 by MySQL-Tools + * @author James Thorne (partydroid) + * @link http://github.com/partydroid/MySQL-Tools + * @link http://mysqltools.org + * @version 02/Jan/2012 +*/ +CodeMirror.defineMode("mysql", function(config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", + "isblank", "isliteral", "union", "a"]); + var keywords = wordRegexp([ + ('ACCESSIBLE'),('ALTER'),('AS'),('BEFORE'),('BINARY'),('BY'),('CASE'),('CHARACTER'),('COLUMN'),('CONTINUE'),('CROSS'),('CURRENT_TIMESTAMP'),('DATABASE'),('DAY_MICROSECOND'),('DEC'),('DEFAULT'), + ('DESC'),('DISTINCT'),('DOUBLE'),('EACH'),('ENCLOSED'),('EXIT'),('FETCH'),('FLOAT8'),('FOREIGN'),('GRANT'),('HIGH_PRIORITY'),('HOUR_SECOND'),('IN'),('INNER'),('INSERT'),('INT2'),('INT8'), + ('INTO'),('JOIN'),('KILL'),('LEFT'),('LINEAR'),('LOCALTIME'),('LONG'),('LOOP'),('MATCH'),('MEDIUMTEXT'),('MINUTE_SECOND'),('NATURAL'),('NULL'),('OPTIMIZE'),('OR'),('OUTER'),('PRIMARY'), + ('RANGE'),('READ_WRITE'),('REGEXP'),('REPEAT'),('RESTRICT'),('RIGHT'),('SCHEMAS'),('SENSITIVE'),('SHOW'),('SPECIFIC'),('SQLSTATE'),('SQL_CALC_FOUND_ROWS'),('STARTING'),('TERMINATED'), + ('TINYINT'),('TRAILING'),('UNDO'),('UNLOCK'),('USAGE'),('UTC_DATE'),('VALUES'),('VARCHARACTER'),('WHERE'),('WRITE'),('ZEROFILL'),('ALL'),('AND'),('ASENSITIVE'),('BIGINT'),('BOTH'),('CASCADE'), + ('CHAR'),('COLLATE'),('CONSTRAINT'),('CREATE'),('CURRENT_TIME'),('CURSOR'),('DAY_HOUR'),('DAY_SECOND'),('DECLARE'),('DELETE'),('DETERMINISTIC'),('DIV'),('DUAL'),('ELSEIF'),('EXISTS'),('FALSE'), + ('FLOAT4'),('FORCE'),('FULLTEXT'),('HAVING'),('HOUR_MINUTE'),('IGNORE'),('INFILE'),('INSENSITIVE'),('INT1'),('INT4'),('INTERVAL'),('ITERATE'),('KEYS'),('LEAVE'),('LIMIT'),('LOAD'),('LOCK'), + ('LONGTEXT'),('MASTER_SSL_VERIFY_SERVER_CERT'),('MEDIUMINT'),('MINUTE_MICROSECOND'),('MODIFIES'),('NO_WRITE_TO_BINLOG'),('ON'),('OPTIONALLY'),('OUT'),('PRECISION'),('PURGE'),('READS'), + ('REFERENCES'),('RENAME'),('REQUIRE'),('REVOKE'),('SCHEMA'),('SELECT'),('SET'),('SPATIAL'),('SQLEXCEPTION'),('SQL_BIG_RESULT'),('SSL'),('TABLE'),('TINYBLOB'),('TO'),('TRUE'),('UNIQUE'), + ('UPDATE'),('USING'),('UTC_TIMESTAMP'),('VARCHAR'),('WHEN'),('WITH'),('YEAR_MONTH'),('ADD'),('ANALYZE'),('ASC'),('BETWEEN'),('BLOB'),('CALL'),('CHANGE'),('CHECK'),('CONDITION'),('CONVERT'), + ('CURRENT_DATE'),('CURRENT_USER'),('DATABASES'),('DAY_MINUTE'),('DECIMAL'),('DELAYED'),('DESCRIBE'),('DISTINCTROW'),('DROP'),('ELSE'),('ESCAPED'),('EXPLAIN'),('FLOAT'),('FOR'),('FROM'), + ('GROUP'),('HOUR_MICROSECOND'),('IF'),('INDEX'),('INOUT'),('INT'),('INT3'),('INTEGER'),('IS'),('KEY'),('LEADING'),('LIKE'),('LINES'),('LOCALTIMESTAMP'),('LONGBLOB'),('LOW_PRIORITY'), + ('MEDIUMBLOB'),('MIDDLEINT'),('MOD'),('NOT'),('NUMERIC'),('OPTION'),('ORDER'),('OUTFILE'),('PROCEDURE'),('READ'),('REAL'),('RELEASE'),('REPLACE'),('RETURN'),('RLIKE'),('SECOND_MICROSECOND'), + ('SEPARATOR'),('SMALLINT'),('SQL'),('SQLWARNING'),('SQL_SMALL_RESULT'),('STRAIGHT_JOIN'),('THEN'),('TINYTEXT'),('TRIGGER'),('UNION'),('UNSIGNED'),('USE'),('UTC_TIME'),('VARBINARY'),('VARYING'), + ('WHILE'),('XOR'),('FULL'),('COLUMNS'),('MIN'),('MAX'),('STDEV'),('COUNT') + ]); + var operatorChars = /[*+\-<>=&|]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "$" || ch == "?") { + stream.match(/^[\w\d]*/); + return "variable-2"; + } + else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } + else if (ch == "`") { + state.tokenize = tokenOpLiteral(ch); + return state.tokenize(stream, state); + } + else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return null; + } + else if (ch == "-") { + var ch2 = stream.next(); + if (ch2=="-") { + stream.skipToEnd(); + return "comment"; + } + } + else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return null; + } + else if (ch == ":") { + stream.eatWhile(/[\w\d\._\-]/); + return "atom"; + } + else { + stream.eatWhile(/[_\w\d]/); + if (stream.eat(":")) { + stream.eatWhile(/[\w\d_\-]/); + return "atom"; + } + var word = stream.current(), type; + if (ops.test(word)) + return null; + else if (keywords.test(word)) + return "keyword"; + else + return "variable"; + } + } + + function tokenLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function tokenOpLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "variable-2"; + }; + } + + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + context: null, + indent: 0, + col: 0}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } + else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function(state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + } + }; +}); + +CodeMirror.defineMIME("text/x-mysql", "mysql"); diff --git a/conlite/external/codemirror/mode/ntriples/index.html b/conlite/external/codemirror/mode/ntriples/index.html new file mode 100644 index 0000000..08d33ba --- /dev/null +++ b/conlite/external/codemirror/mode/ntriples/index.html @@ -0,0 +1,32 @@ + + + + CodeMirror: NTriples mode + + + + + + + +

CodeMirror: NTriples mode

+
+ +
+ + +

MIME types defined: text/n-triples.

+ + diff --git a/conlite/external/codemirror/mode/ntriples/ntriples.js b/conlite/external/codemirror/mode/ntriples/ntriples.js new file mode 100644 index 0000000..3b6cb41 --- /dev/null +++ b/conlite/external/codemirror/mode/ntriples/ntriples.js @@ -0,0 +1,172 @@ +/********************************************************** +* This script provides syntax highlighting support for +* the Ntriples format. +* Ntriples format specification: +* http://www.w3.org/TR/rdf-testcases/#ntriples +***********************************************************/ + +/* + The following expression defines the defined ASF grammar transitions. + + pre_subject -> + { + ( writing_subject_uri | writing_bnode_uri ) + -> pre_predicate + -> writing_predicate_uri + -> pre_object + -> writing_object_uri | writing_object_bnode | + ( + writing_object_literal + -> writing_literal_lang | writing_literal_type + ) + -> post_object + -> BEGIN + } otherwise { + -> ERROR + } +*/ +CodeMirror.defineMode("ntriples", function() { + + Location = { + PRE_SUBJECT : 0, + WRITING_SUB_URI : 1, + WRITING_BNODE_URI : 2, + PRE_PRED : 3, + WRITING_PRED_URI : 4, + PRE_OBJ : 5, + WRITING_OBJ_URI : 6, + WRITING_OBJ_BNODE : 7, + WRITING_OBJ_LITERAL : 8, + WRITING_LIT_LANG : 9, + WRITING_LIT_TYPE : 10, + POST_OBJ : 11, + ERROR : 12 + }; + function transitState(currState, c) { + var currLocation = currState.location; + var ret; + + // Opening. + if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI; + else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI; + else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI; + else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI; + else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE; + else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL; + + // Closing. + else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED; + else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED; + else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ; + else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ; + + // Closing typed and language literal. + else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG; + else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE; + + // Spaces. + else if( c == ' ' && + ( + currLocation == Location.PRE_SUBJECT || + currLocation == Location.PRE_PRED || + currLocation == Location.PRE_OBJ || + currLocation == Location.POST_OBJ + ) + ) ret = currLocation; + + // Reset. + else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT; + + // Error + else ret = Location.ERROR; + + currState.location=ret; + } + + untilSpace = function(c) { return c != ' '; }; + untilEndURI = function(c) { return c != '>'; }; + return { + startState: function() { + return { + location : Location.PRE_SUBJECT, + uris : [], + anchors : [], + bnodes : [], + langs : [], + types : [] + }; + }, + token: function(stream, state) { + var ch = stream.next(); + if(ch == '<') { + transitState(state, ch); + var parsedURI = ''; + stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} ); + state.uris.push(parsedURI); + if( stream.match('#', false) ) return 'variable'; + stream.next(); + transitState(state, '>'); + return 'variable'; + } + if(ch == '#') { + var parsedAnchor = ''; + stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false}); + state.anchors.push(parsedAnchor); + return 'variable-2'; + } + if(ch == '>') { + transitState(state, '>'); + return 'variable'; + } + if(ch == '_') { + transitState(state, ch); + var parsedBNode = ''; + stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;}); + state.bnodes.push(parsedBNode); + stream.next(); + transitState(state, ' '); + return 'builtin'; + } + if(ch == '"') { + transitState(state, ch); + stream.eatWhile( function(c) { return c != '"'; } ); + stream.next(); + if( stream.peek() != '@' && stream.peek() != '^' ) { + transitState(state, '"'); + } + return 'string'; + } + if( ch == '@' ) { + transitState(state, '@'); + var parsedLang = ''; + stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;}); + state.langs.push(parsedLang); + stream.next(); + transitState(state, ' '); + return 'string-2'; + } + if( ch == '^' ) { + stream.next(); + transitState(state, '^'); + var parsedType = ''; + stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} ); + state.types.push(parsedType); + stream.next(); + transitState(state, '>'); + return 'variable'; + } + if( ch == ' ' ) { + transitState(state, ch); + } + if( ch == '.' ) { + transitState(state, ch); + } + } + }; +}); + +CodeMirror.defineMIME("text/n-triples", "ntriples"); diff --git a/conlite/external/codemirror/mode/ocaml/index.html b/conlite/external/codemirror/mode/ocaml/index.html new file mode 100644 index 0000000..d286edc --- /dev/null +++ b/conlite/external/codemirror/mode/ocaml/index.html @@ -0,0 +1,130 @@ + + +CodeMirror: OCaml mode + + + + + + + + + +

CodeMirror: OCaml mode

+ + + + + +

MIME types defined: text/x-ocaml.

diff --git a/conlite/external/codemirror/mode/ocaml/ocaml.js b/conlite/external/codemirror/mode/ocaml/ocaml.js new file mode 100644 index 0000000..294d944 --- /dev/null +++ b/conlite/external/codemirror/mode/ocaml/ocaml.js @@ -0,0 +1,114 @@ +CodeMirror.defineMode('ocaml', function(config) { + + var words = { + 'true': 'atom', + 'false': 'atom', + 'let': 'keyword', + 'rec': 'keyword', + 'in': 'keyword', + 'of': 'keyword', + 'and': 'keyword', + 'succ': 'keyword', + 'if': 'keyword', + 'then': 'keyword', + 'else': 'keyword', + 'for': 'keyword', + 'to': 'keyword', + 'while': 'keyword', + 'do': 'keyword', + 'done': 'keyword', + 'fun': 'keyword', + 'function': 'keyword', + 'val': 'keyword', + 'type': 'keyword', + 'mutable': 'keyword', + 'match': 'keyword', + 'with': 'keyword', + 'try': 'keyword', + 'raise': 'keyword', + 'begin': 'keyword', + 'end': 'keyword', + 'open': 'builtin', + 'trace': 'builtin', + 'ignore': 'builtin', + 'exit': 'builtin', + 'print_string': 'builtin', + 'print_endline': 'builtin' + }; + + function tokenBase(stream, state) { + var sol = stream.sol(); + var ch = stream.next(); + + if (ch === '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + if (ch === '(') { + if (stream.eat('*')) { + state.commentLevel++; + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } + } + if (ch === '~') { + stream.eatWhile(/\w/); + return 'variable-2'; + } + if (ch === '`') { + stream.eatWhile(/\w/); + return 'quote'; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\d]/); + if (stream.eat('.')) { + stream.eatWhile(/[\d]/); + } + return 'number'; + } + if ( /[+\-*&%=<>!?|]/.test(ch)) { + return 'operator'; + } + stream.eatWhile(/\w/); + var cur = stream.current(); + return words[cur] || 'variable'; + } + + function tokenString(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === '"' && !escaped) { + end = true; + break; + } + escaped = !escaped && next === '\\'; + } + if (end && !escaped) { + state.tokenize = tokenBase; + } + return 'string'; + }; + + function tokenComment(stream, state) { + var prev, next; + while(state.commentLevel > 0 && (next = stream.next()) != null) { + if (prev === '(' && next === '*') state.commentLevel++; + if (prev === '*' && next === ')') state.commentLevel--; + prev = next; + } + if (state.commentLevel <= 0) { + state.tokenize = tokenBase; + } + return 'comment'; + } + + return { + startState: function() {return {tokenize: tokenBase, commentLevel: 0}}, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME('text/x-ocaml', 'ocaml'); diff --git a/conlite/external/codemirror/mode/pascal/LICENSE b/conlite/external/codemirror/mode/pascal/LICENSE new file mode 100644 index 0000000..8e3747e --- /dev/null +++ b/conlite/external/codemirror/mode/pascal/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2011 souceLair + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/conlite/external/codemirror/mode/pascal/index.html b/conlite/external/codemirror/mode/pascal/index.html new file mode 100644 index 0000000..6af6b46 --- /dev/null +++ b/conlite/external/codemirror/mode/pascal/index.html @@ -0,0 +1,48 @@ + + + + CodeMirror: Pascal mode + + + + + + + +

CodeMirror: Pascal mode

+ +
+ + + +

MIME types defined: text/x-pascal.

+ + diff --git a/conlite/external/codemirror/mode/pascal/pascal.js b/conlite/external/codemirror/mode/pascal/pascal.js new file mode 100644 index 0000000..55d1fb6 --- /dev/null +++ b/conlite/external/codemirror/mode/pascal/pascal.js @@ -0,0 +1,94 @@ +CodeMirror.defineMode("pascal", function(config) { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var keywords = words("and array begin case const div do downto else end file for forward integer " + + "boolean char function goto if in label mod nil not of or packed procedure " + + "program record repeat set string then to type until var while with"); + var atoms = {"null": true}; + + var isOperatorChar = /[+\-*&%=<>!?|\/]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == "#" && state.startOfLine) { + stream.skipToEnd(); + return "meta"; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (ch == "(" && stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + return null + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !escaped) state.tokenize = null; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == ")" && maybeEnd) { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + // Interface + + return { + startState: function(basecolumn) { + return {tokenize: null}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + return style; + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-pascal", "pascal"); diff --git a/conlite/external/codemirror/mode/perl/LICENSE b/conlite/external/codemirror/mode/perl/LICENSE new file mode 100644 index 0000000..96f4115 --- /dev/null +++ b/conlite/external/codemirror/mode/perl/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011 by Sabaca under the MIT license. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/conlite/external/codemirror/mode/perl/index.html b/conlite/external/codemirror/mode/perl/index.html new file mode 100644 index 0000000..5ef55d3 --- /dev/null +++ b/conlite/external/codemirror/mode/perl/index.html @@ -0,0 +1,62 @@ + + + + CodeMirror: Perl mode + + + + + + + +

CodeMirror: Perl mode

+ +
+ + + +

MIME types defined: text/x-perl.

+ + diff --git a/conlite/external/codemirror/mode/perl/perl.js b/conlite/external/codemirror/mode/perl/perl.js new file mode 100644 index 0000000..7fa129e --- /dev/null +++ b/conlite/external/codemirror/mode/perl/perl.js @@ -0,0 +1,816 @@ +// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) +// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) +CodeMirror.defineMode("perl",function(config,parserConfig){ + // http://perldoc.perl.org + var PERL={ // null - magic touch + // 1 - keyword + // 2 - def + // 3 - atom + // 4 - operator + // 5 - variable-2 (predefined) + // [x,y] - x=1,2,3; y=must be defined if x{...} + // PERL operators + '->' : 4, + '++' : 4, + '--' : 4, + '**' : 4, + // ! ~ \ and unary + and - + '=~' : 4, + '!~' : 4, + '*' : 4, + '/' : 4, + '%' : 4, + 'x' : 4, + '+' : 4, + '-' : 4, + '.' : 4, + '<<' : 4, + '>>' : 4, + // named unary operators + '<' : 4, + '>' : 4, + '<=' : 4, + '>=' : 4, + 'lt' : 4, + 'gt' : 4, + 'le' : 4, + 'ge' : 4, + '==' : 4, + '!=' : 4, + '<=>' : 4, + 'eq' : 4, + 'ne' : 4, + 'cmp' : 4, + '~~' : 4, + '&' : 4, + '|' : 4, + '^' : 4, + '&&' : 4, + '||' : 4, + '//' : 4, + '..' : 4, + '...' : 4, + '?' : 4, + ':' : 4, + '=' : 4, + '+=' : 4, + '-=' : 4, + '*=' : 4, // etc. ??? + ',' : 4, + '=>' : 4, + '::' : 4, + // list operators (rightward) + 'not' : 4, + 'and' : 4, + 'or' : 4, + 'xor' : 4, + // PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;) + 'BEGIN' : [5,1], + 'END' : [5,1], + 'PRINT' : [5,1], + 'PRINTF' : [5,1], + 'GETC' : [5,1], + 'READ' : [5,1], + 'READLINE' : [5,1], + 'DESTROY' : [5,1], + 'TIE' : [5,1], + 'TIEHANDLE' : [5,1], + 'UNTIE' : [5,1], + 'STDIN' : 5, + 'STDIN_TOP' : 5, + 'STDOUT' : 5, + 'STDOUT_TOP' : 5, + 'STDERR' : 5, + 'STDERR_TOP' : 5, + '$ARG' : 5, + '$_' : 5, + '@ARG' : 5, + '@_' : 5, + '$LIST_SEPARATOR' : 5, + '$"' : 5, + '$PROCESS_ID' : 5, + '$PID' : 5, + '$$' : 5, + '$REAL_GROUP_ID' : 5, + '$GID' : 5, + '$(' : 5, + '$EFFECTIVE_GROUP_ID' : 5, + '$EGID' : 5, + '$)' : 5, + '$PROGRAM_NAME' : 5, + '$0' : 5, + '$SUBSCRIPT_SEPARATOR' : 5, + '$SUBSEP' : 5, + '$;' : 5, + '$REAL_USER_ID' : 5, + '$UID' : 5, + '$<' : 5, + '$EFFECTIVE_USER_ID' : 5, + '$EUID' : 5, + '$>' : 5, + '$a' : 5, + '$b' : 5, + '$COMPILING' : 5, + '$^C' : 5, + '$DEBUGGING' : 5, + '$^D' : 5, + '${^ENCODING}' : 5, + '$ENV' : 5, + '%ENV' : 5, + '$SYSTEM_FD_MAX' : 5, + '$^F' : 5, + '@F' : 5, + '${^GLOBAL_PHASE}' : 5, + '$^H' : 5, + '%^H' : 5, + '@INC' : 5, + '%INC' : 5, + '$INPLACE_EDIT' : 5, + '$^I' : 5, + '$^M' : 5, + '$OSNAME' : 5, + '$^O' : 5, + '${^OPEN}' : 5, + '$PERLDB' : 5, + '$^P' : 5, + '$SIG' : 5, + '%SIG' : 5, + '$BASETIME' : 5, + '$^T' : 5, + '${^TAINT}' : 5, + '${^UNICODE}' : 5, + '${^UTF8CACHE}' : 5, + '${^UTF8LOCALE}' : 5, + '$PERL_VERSION' : 5, + '$^V' : 5, + '${^WIN32_SLOPPY_STAT}' : 5, + '$EXECUTABLE_NAME' : 5, + '$^X' : 5, + '$1' : 5, // - regexp $1, $2... + '$MATCH' : 5, + '$&' : 5, + '${^MATCH}' : 5, + '$PREMATCH' : 5, + '$`' : 5, + '${^PREMATCH}' : 5, + '$POSTMATCH' : 5, + "$'" : 5, + '${^POSTMATCH}' : 5, + '$LAST_PAREN_MATCH' : 5, + '$+' : 5, + '$LAST_SUBMATCH_RESULT' : 5, + '$^N' : 5, + '@LAST_MATCH_END' : 5, + '@+' : 5, + '%LAST_PAREN_MATCH' : 5, + '%+' : 5, + '@LAST_MATCH_START' : 5, + '@-' : 5, + '%LAST_MATCH_START' : 5, + '%-' : 5, + '$LAST_REGEXP_CODE_RESULT' : 5, + '$^R' : 5, + '${^RE_DEBUG_FLAGS}' : 5, + '${^RE_TRIE_MAXBUF}' : 5, + '$ARGV' : 5, + '@ARGV' : 5, + 'ARGV' : 5, + 'ARGVOUT' : 5, + '$OUTPUT_FIELD_SEPARATOR' : 5, + '$OFS' : 5, + '$,' : 5, + '$INPUT_LINE_NUMBER' : 5, + '$NR' : 5, + '$.' : 5, + '$INPUT_RECORD_SEPARATOR' : 5, + '$RS' : 5, + '$/' : 5, + '$OUTPUT_RECORD_SEPARATOR' : 5, + '$ORS' : 5, + '$\\' : 5, + '$OUTPUT_AUTOFLUSH' : 5, + '$|' : 5, + '$ACCUMULATOR' : 5, + '$^A' : 5, + '$FORMAT_FORMFEED' : 5, + '$^L' : 5, + '$FORMAT_PAGE_NUMBER' : 5, + '$%' : 5, + '$FORMAT_LINES_LEFT' : 5, + '$-' : 5, + '$FORMAT_LINE_BREAK_CHARACTERS' : 5, + '$:' : 5, + '$FORMAT_LINES_PER_PAGE' : 5, + '$=' : 5, + '$FORMAT_TOP_NAME' : 5, + '$^' : 5, + '$FORMAT_NAME' : 5, + '$~' : 5, + '${^CHILD_ERROR_NATIVE}' : 5, + '$EXTENDED_OS_ERROR' : 5, + '$^E' : 5, + '$EXCEPTIONS_BEING_CAUGHT' : 5, + '$^S' : 5, + '$WARNING' : 5, + '$^W' : 5, + '${^WARNING_BITS}' : 5, + '$OS_ERROR' : 5, + '$ERRNO' : 5, + '$!' : 5, + '%OS_ERROR' : 5, + '%ERRNO' : 5, + '%!' : 5, + '$CHILD_ERROR' : 5, + '$?' : 5, + '$EVAL_ERROR' : 5, + '$@' : 5, + '$OFMT' : 5, + '$#' : 5, + '$*' : 5, + '$ARRAY_BASE' : 5, + '$[' : 5, + '$OLD_PERL_VERSION' : 5, + '$]' : 5, + // PERL blocks + 'if' :[1,1], + elsif :[1,1], + 'else' :[1,1], + 'while' :[1,1], + unless :[1,1], + 'for' :[1,1], + foreach :[1,1], + // PERL functions + 'abs' :1, // - absolute value function + accept :1, // - accept an incoming socket connect + alarm :1, // - schedule a SIGALRM + 'atan2' :1, // - arctangent of Y/X in the range -PI to PI + bind :1, // - binds an address to a socket + binmode :1, // - prepare binary files for I/O + bless :1, // - create an object + bootstrap :1, // + 'break' :1, // - break out of a "given" block + caller :1, // - get context of the current subroutine call + chdir :1, // - change your current working directory + chmod :1, // - changes the permissions on a list of files + chomp :1, // - remove a trailing record separator from a string + chop :1, // - remove the last character from a string + chown :1, // - change the owership on a list of files + chr :1, // - get character this number represents + chroot :1, // - make directory new root for path lookups + close :1, // - close file (or pipe or socket) handle + closedir :1, // - close directory handle + connect :1, // - connect to a remote socket + 'continue' :[1,1], // - optional trailing block in a while or foreach + 'cos' :1, // - cosine function + crypt :1, // - one-way passwd-style encryption + dbmclose :1, // - breaks binding on a tied dbm file + dbmopen :1, // - create binding on a tied dbm file + 'default' :1, // + defined :1, // - test whether a value, variable, or function is defined + 'delete' :1, // - deletes a value from a hash + die :1, // - raise an exception or bail out + 'do' :1, // - turn a BLOCK into a TERM + dump :1, // - create an immediate core dump + each :1, // - retrieve the next key/value pair from a hash + endgrent :1, // - be done using group file + endhostent :1, // - be done using hosts file + endnetent :1, // - be done using networks file + endprotoent :1, // - be done using protocols file + endpwent :1, // - be done using passwd file + endservent :1, // - be done using services file + eof :1, // - test a filehandle for its end + 'eval' :1, // - catch exceptions or compile and run code + 'exec' :1, // - abandon this program to run another + exists :1, // - test whether a hash key is present + exit :1, // - terminate this program + 'exp' :1, // - raise I to a power + fcntl :1, // - file control system call + fileno :1, // - return file descriptor from filehandle + flock :1, // - lock an entire file with an advisory lock + fork :1, // - create a new process just like this one + format :1, // - declare a picture format with use by the write() function + formline :1, // - internal function used for formats + getc :1, // - get the next character from the filehandle + getgrent :1, // - get next group record + getgrgid :1, // - get group record given group user ID + getgrnam :1, // - get group record given group name + gethostbyaddr :1, // - get host record given its address + gethostbyname :1, // - get host record given name + gethostent :1, // - get next hosts record + getlogin :1, // - return who logged in at this tty + getnetbyaddr :1, // - get network record given its address + getnetbyname :1, // - get networks record given name + getnetent :1, // - get next networks record + getpeername :1, // - find the other end of a socket connection + getpgrp :1, // - get process group + getppid :1, // - get parent process ID + getpriority :1, // - get current nice value + getprotobyname :1, // - get protocol record given name + getprotobynumber :1, // - get protocol record numeric protocol + getprotoent :1, // - get next protocols record + getpwent :1, // - get next passwd record + getpwnam :1, // - get passwd record given user login name + getpwuid :1, // - get passwd record given user ID + getservbyname :1, // - get services record given its name + getservbyport :1, // - get services record given numeric port + getservent :1, // - get next services record + getsockname :1, // - retrieve the sockaddr for a given socket + getsockopt :1, // - get socket options on a given socket + given :1, // + glob :1, // - expand filenames using wildcards + gmtime :1, // - convert UNIX time into record or string using Greenwich time + 'goto' :1, // - create spaghetti code + grep :1, // - locate elements in a list test true against a given criterion + hex :1, // - convert a string to a hexadecimal number + 'import' :1, // - patch a module's namespace into your own + index :1, // - find a substring within a string + 'int' :1, // - get the integer portion of a number + ioctl :1, // - system-dependent device control system call + 'join' :1, // - join a list into a string using a separator + keys :1, // - retrieve list of indices from a hash + kill :1, // - send a signal to a process or process group + last :1, // - exit a block prematurely + lc :1, // - return lower-case version of a string + lcfirst :1, // - return a string with just the next letter in lower case + length :1, // - return the number of bytes in a string + 'link' :1, // - create a hard link in the filesytem + listen :1, // - register your socket as a server + local : 2, // - create a temporary value for a global variable (dynamic scoping) + localtime :1, // - convert UNIX time into record or string using local time + lock :1, // - get a thread lock on a variable, subroutine, or method + 'log' :1, // - retrieve the natural logarithm for a number + lstat :1, // - stat a symbolic link + m :null, // - match a string with a regular expression pattern + map :1, // - apply a change to a list to get back a new list with the changes + mkdir :1, // - create a directory + msgctl :1, // - SysV IPC message control operations + msgget :1, // - get SysV IPC message queue + msgrcv :1, // - receive a SysV IPC message from a message queue + msgsnd :1, // - send a SysV IPC message to a message queue + my : 2, // - declare and assign a local variable (lexical scoping) + 'new' :1, // + next :1, // - iterate a block prematurely + no :1, // - unimport some module symbols or semantics at compile time + oct :1, // - convert a string to an octal number + open :1, // - open a file, pipe, or descriptor + opendir :1, // - open a directory + ord :1, // - find a character's numeric representation + our : 2, // - declare and assign a package variable (lexical scoping) + pack :1, // - convert a list into a binary representation + 'package' :1, // - declare a separate global namespace + pipe :1, // - open a pair of connected filehandles + pop :1, // - remove the last element from an array and return it + pos :1, // - find or set the offset for the last/next m//g search + print :1, // - output a list to a filehandle + printf :1, // - output a formatted list to a filehandle + prototype :1, // - get the prototype (if any) of a subroutine + push :1, // - append one or more elements to an array + q :null, // - singly quote a string + qq :null, // - doubly quote a string + qr :null, // - Compile pattern + quotemeta :null, // - quote regular expression magic characters + qw :null, // - quote a list of words + qx :null, // - backquote quote a string + rand :1, // - retrieve the next pseudorandom number + read :1, // - fixed-length buffered input from a filehandle + readdir :1, // - get a directory from a directory handle + readline :1, // - fetch a record from a file + readlink :1, // - determine where a symbolic link is pointing + readpipe :1, // - execute a system command and collect standard output + recv :1, // - receive a message over a Socket + redo :1, // - start this loop iteration over again + ref :1, // - find out the type of thing being referenced + rename :1, // - change a filename + require :1, // - load in external functions from a library at runtime + reset :1, // - clear all variables of a given name + 'return' :1, // - get out of a function early + reverse :1, // - flip a string or a list + rewinddir :1, // - reset directory handle + rindex :1, // - right-to-left substring search + rmdir :1, // - remove a directory + s :null, // - replace a pattern with a string + say :1, // - print with newline + scalar :1, // - force a scalar context + seek :1, // - reposition file pointer for random-access I/O + seekdir :1, // - reposition directory pointer + select :1, // - reset default output or do I/O multiplexing + semctl :1, // - SysV semaphore control operations + semget :1, // - get set of SysV semaphores + semop :1, // - SysV semaphore operations + send :1, // - send a message over a socket + setgrent :1, // - prepare group file for use + sethostent :1, // - prepare hosts file for use + setnetent :1, // - prepare networks file for use + setpgrp :1, // - set the process group of a process + setpriority :1, // - set a process's nice value + setprotoent :1, // - prepare protocols file for use + setpwent :1, // - prepare passwd file for use + setservent :1, // - prepare services file for use + setsockopt :1, // - set some socket options + shift :1, // - remove the first element of an array, and return it + shmctl :1, // - SysV shared memory operations + shmget :1, // - get SysV shared memory segment identifier + shmread :1, // - read SysV shared memory + shmwrite :1, // - write SysV shared memory + shutdown :1, // - close down just half of a socket connection + 'sin' :1, // - return the sine of a number + sleep :1, // - block for some number of seconds + socket :1, // - create a socket + socketpair :1, // - create a pair of sockets + 'sort' :1, // - sort a list of values + splice :1, // - add or remove elements anywhere in an array + 'split' :1, // - split up a string using a regexp delimiter + sprintf :1, // - formatted print into a string + 'sqrt' :1, // - square root function + srand :1, // - seed the random number generator + stat :1, // - get a file's status information + state :1, // - declare and assign a state variable (persistent lexical scoping) + study :1, // - optimize input data for repeated searches + 'sub' :1, // - declare a subroutine, possibly anonymously + 'substr' :1, // - get or alter a portion of a stirng + symlink :1, // - create a symbolic link to a file + syscall :1, // - execute an arbitrary system call + sysopen :1, // - open a file, pipe, or descriptor + sysread :1, // - fixed-length unbuffered input from a filehandle + sysseek :1, // - position I/O pointer on handle used with sysread and syswrite + system :1, // - run a separate program + syswrite :1, // - fixed-length unbuffered output to a filehandle + tell :1, // - get current seekpointer on a filehandle + telldir :1, // - get current seekpointer on a directory handle + tie :1, // - bind a variable to an object class + tied :1, // - get a reference to the object underlying a tied variable + time :1, // - return number of seconds since 1970 + times :1, // - return elapsed time for self and child processes + tr :null, // - transliterate a string + truncate :1, // - shorten a file + uc :1, // - return upper-case version of a string + ucfirst :1, // - return a string with just the next letter in upper case + umask :1, // - set file creation mode mask + undef :1, // - remove a variable or function definition + unlink :1, // - remove one link to a file + unpack :1, // - convert binary structure into normal perl variables + unshift :1, // - prepend more elements to the beginning of a list + untie :1, // - break a tie binding to a variable + use :1, // - load in a module at compile time + utime :1, // - set a file's last access and modify times + values :1, // - return a list of the values in a hash + vec :1, // - test or set particular bits in a string + wait :1, // - wait for any child process to die + waitpid :1, // - wait for a particular child process to die + wantarray :1, // - get void vs scalar vs list context of current subroutine call + warn :1, // - print debugging info + when :1, // + write :1, // - print a picture record + y :null}; // - transliterate a string + + var RXstyle="string-2"; + var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type + + function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;) + state.chain=null; // 12 3tail + state.style=null; + state.tail=null; + state.tokenize=function(stream,state){ + var e=false,c,i=0; + while(c=stream.next()){ + if(c===chain[i]&&!e){ + if(chain[++i]!==undefined){ + state.chain=chain[i]; + state.style=style; + state.tail=tail} + else if(tail) + stream.eatWhile(tail); + state.tokenize=tokenPerl; + return style} + e=!e&&c=="\\"} + return style}; + return state.tokenize(stream,state)} + + function tokenSOMETHING(stream,state,string){ + state.tokenize=function(stream,state){ + if(stream.string==string) + state.tokenize=tokenPerl; + stream.skipToEnd(); + return "string"}; + return state.tokenize(stream,state)} + + function tokenPerl(stream,state){ + if(stream.eatSpace()) + return null; + if(state.chain) + return tokenChain(stream,state,state.chain,state.style,state.tail); + if(stream.match(/^\-?[\d\.]/,false)) + if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) + return 'number'; + if(stream.match(/^<<(?=\w)/)){ // NOTE: <"],RXstyle,RXmodifiers)} + if(/[\^'"!~\/]/.test(c)){ + stream.eatSuffix(1); + return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}} + else if(c=="q"){ + c=stream.look(1); + if(c=="("){ + stream.eatSuffix(2); + return tokenChain(stream,state,[")"],"string")} + if(c=="["){ + stream.eatSuffix(2); + return tokenChain(stream,state,["]"],"string")} + if(c=="{"){ + stream.eatSuffix(2); + return tokenChain(stream,state,["}"],"string")} + if(c=="<"){ + stream.eatSuffix(2); + return tokenChain(stream,state,[">"],"string")} + if(/[\^'"!~\/]/.test(c)){ + stream.eatSuffix(1); + return tokenChain(stream,state,[stream.eat(c)],"string")}} + else if(c=="w"){ + c=stream.look(1); + if(c=="("){ + stream.eatSuffix(2); + return tokenChain(stream,state,[")"],"bracket")} + if(c=="["){ + stream.eatSuffix(2); + return tokenChain(stream,state,["]"],"bracket")} + if(c=="{"){ + stream.eatSuffix(2); + return tokenChain(stream,state,["}"],"bracket")} + if(c=="<"){ + stream.eatSuffix(2); + return tokenChain(stream,state,[">"],"bracket")} + if(/[\^'"!~\/]/.test(c)){ + stream.eatSuffix(1); + return tokenChain(stream,state,[stream.eat(c)],"bracket")}} + else if(c=="r"){ + c=stream.look(1); + if(c=="("){ + stream.eatSuffix(2); + return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)} + if(c=="["){ + stream.eatSuffix(2); + return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)} + if(c=="{"){ + stream.eatSuffix(2); + return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)} + if(c=="<"){ + stream.eatSuffix(2); + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)} + if(/[\^'"!~\/]/.test(c)){ + stream.eatSuffix(1); + return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}} + else if(/[\^'"!~\/(\[{<]/.test(c)){ + if(c=="("){ + stream.eatSuffix(1); + return tokenChain(stream,state,[")"],"string")} + if(c=="["){ + stream.eatSuffix(1); + return tokenChain(stream,state,["]"],"string")} + if(c=="{"){ + stream.eatSuffix(1); + return tokenChain(stream,state,["}"],"string")} + if(c=="<"){ + stream.eatSuffix(1); + return tokenChain(stream,state,[">"],"string")} + if(/[\^'"!~\/]/.test(c)){ + return tokenChain(stream,state,[stream.eat(c)],"string")}}}} + if(ch=="m"){ + var c=stream.look(-2); + if(!(c&&/\w/.test(c))){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(/[\^'"!~\/]/.test(c)){ + return tokenChain(stream,state,[c],RXstyle,RXmodifiers)} + if(c=="("){ + return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)} + if(c=="["){ + return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)} + if(c=="{"){ + return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)} + if(c=="<"){ + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}}}} + if(ch=="s"){ + var c=/[\/>\]})\w]/.test(stream.look(-2)); + if(!c){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(c=="[") + return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); + if(c=="{") + return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); + if(c=="<") + return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); + if(c=="(") + return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}} + if(ch=="y"){ + var c=/[\/>\]})\w]/.test(stream.look(-2)); + if(!c){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(c=="[") + return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); + if(c=="{") + return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); + if(c=="<") + return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); + if(c=="(") + return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}} + if(ch=="t"){ + var c=/[\/>\]})\w]/.test(stream.look(-2)); + if(!c){ + c=stream.eat("r");if(c){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(c=="[") + return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); + if(c=="{") + return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); + if(c=="<") + return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); + if(c=="(") + return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}} + if(ch=="`"){ + return tokenChain(stream,state,[ch],"variable-2")} + if(ch=="/"){ + if(!/~\s*$/.test(stream.prefix())) + return "operator"; + else + return tokenChain(stream,state,[ch],RXstyle,RXmodifiers)} + if(ch=="$"){ + var p=stream.pos; + if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}")) + return "variable-2"; + else + stream.pos=p} + if(/[$@%]/.test(ch)){ + var p=stream.pos; + if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(stream.look(-2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){ + var c=stream.current(); + if(PERL[c]) + return "variable-2"} + stream.pos=p} + if(/[$@%&]/.test(ch)){ + if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){ + var c=stream.current(); + if(PERL[c]) + return "variable-2"; + else + return "variable"}} + if(ch=="#"){ + if(stream.look(-2)!="$"){ + stream.skipToEnd(); + return "comment"}} + if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){ + var p=stream.pos; + stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/); + if(PERL[stream.current()]) + return "operator"; + else + stream.pos=p} + if(ch=="_"){ + if(stream.pos==1){ + if(stream.suffix(6)=="_END__"){ + return tokenChain(stream,state,['\0'],"comment")} + else if(stream.suffix(7)=="_DATA__"){ + return tokenChain(stream,state,['\0'],"variable-2")} + else if(stream.suffix(7)=="_C__"){ + return tokenChain(stream,state,['\0'],"string")}}} + if(/\w/.test(ch)){ + var p=stream.pos; + if(stream.look(-2)=="{"&&(stream.look(0)=="}"||stream.eatWhile(/\w/)&&stream.look(0)=="}")) + return "string"; + else + stream.pos=p} + if(/[A-Z]/.test(ch)){ + var l=stream.look(-2); + var p=stream.pos; + stream.eatWhile(/[A-Z_]/); + if(/[\da-z]/.test(stream.look(0))){ + stream.pos=p} + else{ + var c=PERL[stream.current()]; + if(!c) + return "meta"; + if(c[1]) + c=c[0]; + if(l!=":"){ + if(c==1) + return "keyword"; + else if(c==2) + return "def"; + else if(c==3) + return "atom"; + else if(c==4) + return "operator"; + else if(c==5) + return "variable-2"; + else + return "meta"} + else + return "meta"}} + if(/[a-zA-Z_]/.test(ch)){ + var l=stream.look(-2); + stream.eatWhile(/\w/); + var c=PERL[stream.current()]; + if(!c) + return "meta"; + if(c[1]) + c=c[0]; + if(l!=":"){ + if(c==1) + return "keyword"; + else if(c==2) + return "def"; + else if(c==3) + return "atom"; + else if(c==4) + return "operator"; + else if(c==5) + return "variable-2"; + else + return "meta"} + else + return "meta"} + return null} + + return{ + startState:function(){ + return{ + tokenize:tokenPerl, + chain:null, + style:null, + tail:null}}, + token:function(stream,state){ + return (state.tokenize||tokenPerl)(stream,state)}, + electricChars:"{}"}}); + +CodeMirror.defineMIME("text/x-perl", "perl"); + +// it's like "peek", but need for look-ahead or look-behind if index < 0 +CodeMirror.StringStream.prototype.look=function(c){ + return this.string.charAt(this.pos+(c||0))}; + +// return a part of prefix of current stream from current position +CodeMirror.StringStream.prototype.prefix=function(c){ + if(c){ + var x=this.pos-c; + return this.string.substr((x>=0?x:0),c)} + else{ + return this.string.substr(0,this.pos-1)}}; + +// return a part of suffix of current stream from current position +CodeMirror.StringStream.prototype.suffix=function(c){ + var y=this.string.length; + var x=y-this.pos+1; + return this.string.substr(this.pos,(c&&c=(y=this.string.length-1)) + this.pos=y; + else + this.pos=x}; diff --git a/conlite/external/codemirror/mode/php/index.html b/conlite/external/codemirror/mode/php/index.html new file mode 100644 index 0000000..7949044 --- /dev/null +++ b/conlite/external/codemirror/mode/php/index.html @@ -0,0 +1,48 @@ + + + + CodeMirror: PHP mode + + + + + + + + + + + +

CodeMirror: PHP mode

+ +
+ + + +

Simple HTML/PHP mode based on + the C-like mode. Depends on XML, + JavaScript, CSS, and C-like modes.

+ +

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

+ + diff --git a/conlite/external/codemirror/mode/php/php.js b/conlite/external/codemirror/mode/php/php.js new file mode 100644 index 0000000..e35922f --- /dev/null +++ b/conlite/external/codemirror/mode/php/php.js @@ -0,0 +1,150 @@ +(function() { + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + function heredoc(delim) { + return function(stream, state) { + if (stream.match(delim)) state.tokenize = null; + else stream.skipToEnd(); + return "string"; + } + } + var phpConfig = { + name: "clike", + keywords: keywords("abstract and array as break case catch class clone const continue declare default " + + "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + + "for foreach function global goto if implements interface instanceof namespace " + + "new or private protected public static switch throw trait try use var while xor " + + "die echo empty exit eval include include_once isset list require require_once return " + + "print unset __halt_compiler self static parent"), + blockKeywords: keywords("catch do else elseif for foreach if switch try while"), + atoms: keywords("true false null TRUE FALSE NULL"), + multiLineStrings: true, + hooks: { + "$": function(stream, state) { + stream.eatWhile(/[\w\$_]/); + return "variable-2"; + }, + "<": function(stream, state) { + if (stream.match(/<", false)) stream.next(); + return "comment"; + }, + "/": function(stream, state) { + if (stream.eat("/")) { + while (!stream.eol() && !stream.match("?>", false)) stream.next(); + return "comment"; + } + return false; + } + } + }; + + CodeMirror.defineMode("php", function(config, parserConfig) { + var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); + var jsMode = CodeMirror.getMode(config, "javascript"); + var cssMode = CodeMirror.getMode(config, "css"); + var phpMode = CodeMirror.getMode(config, phpConfig); + + function dispatch(stream, state) { // TODO open PHP inside text/css + var isPHP = state.mode == "php"; + if (stream.sol() && state.pending != '"') state.pending = null; + if (state.curMode == htmlMode) { + if (stream.match(/^<\?\w*/)) { + state.curMode = phpMode; + state.curState = state.php; + state.curClose = "?>"; + state.mode = "php"; + return "meta"; + } + if (state.pending == '"') { + while (!stream.eol() && stream.next() != '"') {} + var style = "string"; + } else if (state.pending && stream.pos < state.pending.end) { + stream.pos = state.pending.end; + var style = state.pending.style; + } else { + var style = htmlMode.token(stream, state.curState); + } + state.pending = null; + var cur = stream.current(), openPHP = cur.search(/<\?/); + if (openPHP != -1) { + if (style == "string" && /\"$/.test(cur) && !/\?>/.test(cur)) state.pending = '"'; + else state.pending = {end: stream.pos, style: style}; + stream.backUp(cur.length - openPHP); + } else if (style == "tag" && stream.current() == ">" && state.curState.context) { + if (/^script$/i.test(state.curState.context.tagName)) { + state.curMode = jsMode; + state.curState = jsMode.startState(htmlMode.indent(state.curState, "")); + state.curClose = /^<\/\s*script\s*>/i; + state.mode = "javascript"; + } + else if (/^style$/i.test(state.curState.context.tagName)) { + state.curMode = cssMode; + state.curState = cssMode.startState(htmlMode.indent(state.curState, "")); + state.curClose = /^<\/\s*style\s*>/i; + state.mode = "css"; + } + } + return style; + } else if ((!isPHP || state.php.tokenize == null) && + stream.match(state.curClose, isPHP)) { + state.curMode = htmlMode; + state.curState = state.html; + state.curClose = null; + state.mode = "html"; + if (isPHP) return "meta"; + else return dispatch(stream, state); + } else { + return state.curMode.token(stream, state.curState); + } + } + + return { + startState: function() { + var html = htmlMode.startState(); + return {html: html, + php: phpMode.startState(), + curMode: parserConfig.startOpen ? phpMode : htmlMode, + curState: parserConfig.startOpen ? phpMode.startState() : html, + curClose: parserConfig.startOpen ? /^\?>/ : null, + mode: parserConfig.startOpen ? "php" : "html", + pending: null} + }, + + copyState: function(state) { + var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html), + php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur; + if (state.curState == html) cur = htmlNew; + else if (state.curState == php) cur = phpNew; + else cur = CodeMirror.copyState(state.curMode, state.curState); + return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, + curClose: state.curClose, mode: state.mode, + pending: state.pending}; + }, + + token: dispatch, + + indent: function(state, textAfter) { + if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) || + (state.curMode == phpMode && /^\?>/.test(textAfter))) + return htmlMode.indent(state.html, textAfter); + return state.curMode.indent(state.curState, textAfter); + }, + + electricChars: "/{}:" + } + }, "xml", "clike", "javascript", "css"); + CodeMirror.defineMIME("application/x-httpd-php", "php"); + CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true}); + CodeMirror.defineMIME("text/x-php", phpConfig); +})(); diff --git a/conlite/external/codemirror/mode/pig/index.html b/conlite/external/codemirror/mode/pig/index.html new file mode 100644 index 0000000..9cd69c4 --- /dev/null +++ b/conlite/external/codemirror/mode/pig/index.html @@ -0,0 +1,42 @@ + + + + CodeMirror: Pig Latin mode + + + + + + + +

CodeMirror: Pig Latin mode

+ +
+ + + +

+ Simple mode that handles Pig Latin language. +

+ +

MIME type defined: text/x-pig + (PIG code) + diff --git a/conlite/external/codemirror/mode/pig/pig.js b/conlite/external/codemirror/mode/pig/pig.js new file mode 100644 index 0000000..e893e57 --- /dev/null +++ b/conlite/external/codemirror/mode/pig/pig.js @@ -0,0 +1,172 @@ +/* + * Pig Latin Mode for CodeMirror 2 + * @author Prasanth Jayachandran + * @link https://github.com/prasanthj/pig-codemirror-2 + * This implementation is adapted from PL/SQL mode in CodeMirror 2. +*/ +CodeMirror.defineMode("pig", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords, + builtins = parserConfig.builtins, + types = parserConfig.types, + multiLineStrings = parserConfig.multiLineStrings; + + var isOperatorChar = /[*+\-%<>=&?:\/!|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + var type; + function ret(tp, style) { + type = tp; + return style; + } + + function tokenComment(stream, state) { + var isEnd = false; + var ch; + while(ch = stream.next()) { + if(ch == "/" && isEnd) { + state.tokenize = tokenBase; + break; + } + isEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return ret("string", "error"); + }; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + + // is a start of string? + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch)); + // is it one of the special chars + else if(/[\[\]{}\(\),;\.]/.test(ch)) + return ret(ch); + // is it a number? + else if(/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return ret("number", "number"); + } + // multi line comment or operator + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, tokenComment); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // single line comment or operator + else if (ch=="-") { + if(stream.eat("-")){ + stream.skipToEnd(); + return ret("comment", "comment"); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // is it an operator + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + else { + // get the while word + stream.eatWhile(/[\w\$_]/); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) { + if (stream.eat(")") || stream.eat(".")) { + //keywords can be used as variables like flatten(group), group.$0 etc.. + } + else { + return ("keyword", "keyword"); + } + } + // is it one of the builtin functions? + if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) + { + return ("keyword", "variable-2") + } + // is it one of the listed types? + if (types && types.propertyIsEnumerable(stream.current().toUpperCase())) + return ("keyword", "variable-3") + // default is a 'variable' + return ret("variable", "pig-word"); + } + } + + // Interface + return { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + startOfLine: true + }; + }, + + token: function(stream, state) { + if(stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + } + }; +}); + +(function() { + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + // builtin funcs taken from trunk revision 1303237 + var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " + + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " + + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " + + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " + + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " + + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " + + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " + + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " + + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " + + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER "; + + // taken from QueryLexer.g + var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " + + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " + + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " + + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " + + "NEQ MATCHES TRUE FALSE "; + + // data types + var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP " + + CodeMirror.defineMIME("text/x-pig", { + name: "pig", + builtins: keywords(pBuiltins), + keywords: keywords(pKeywords), + types: keywords(pTypes) + }); +}()); diff --git a/conlite/external/codemirror/mode/plsql/index.html b/conlite/external/codemirror/mode/plsql/index.html new file mode 100644 index 0000000..be603d9 --- /dev/null +++ b/conlite/external/codemirror/mode/plsql/index.html @@ -0,0 +1,62 @@ + + + + CodeMirror: Oracle PL/SQL mode + + + + + + + +

CodeMirror: Oracle PL/SQL mode

+ +
+ + + +

+ Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course). +

+ +

MIME type defined: text/x-plsql + (PLSQL code) + diff --git a/conlite/external/codemirror/mode/plsql/plsql.js b/conlite/external/codemirror/mode/plsql/plsql.js new file mode 100644 index 0000000..013deaf --- /dev/null +++ b/conlite/external/codemirror/mode/plsql/plsql.js @@ -0,0 +1,217 @@ +CodeMirror.defineMode("plsql", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords, + functions = parserConfig.functions, + types = parserConfig.types, + sqlplus = parserConfig.sqlplus, + multiLineStrings = parserConfig.multiLineStrings; + var isOperatorChar = /[+\-*&%=<>!?:\/|]/; + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + var type; + function ret(tp, style) { + type = tp; + return style; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + // start of string? + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch)); + // is it one of the special signs []{}().,;? Seperator? + else if (/[\[\]{}\(\),;\.]/.test(ch)) + return ret(ch); + // start of a number value? + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return ret("number", "number"); + } + // multi line comment or simple operator? + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, tokenComment); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // single line comment or simple operator? + else if (ch == "-") { + if (stream.eat("-")) { + stream.skipToEnd(); + return ret("comment", "comment"); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // pl/sql variable? + else if (ch == "@" || ch == "$") { + stream.eatWhile(/[\w\d\$_]/); + return ret("word", "variable"); + } + // is it a operator? + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + else { + // get the whole word + stream.eatWhile(/[\w\$_]/); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "keyword"); + // is it one of the listed functions? + if (functions && functions.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "builtin"); + // is it one of the listed types? + if (types && types.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-2"); + // is it one of the listed sqlplus keywords? + if (sqlplus && sqlplus.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-3"); + // default: just a "variable" + return ret("word", "variable"); + } + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return ret("string", "plsql-string"); + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "plsql-comment"); + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + startOfLine: true + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + } + }; +}); + +(function() { + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var cKeywords = "abort accept access add all alter and any array arraylen as asc assert assign at attributes audit " + + "authorization avg " + + "base_table begin between binary_integer body boolean by " + + "case cast char char_base check close cluster clusters colauth column comment commit compress connect " + + "connected constant constraint crash create current currval cursor " + + "data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete " + + "desc digits dispose distinct do drop " + + "else elsif enable end entry escape exception exception_init exchange exclusive exists exit external " + + "fast fetch file for force form from function " + + "generic goto grant group " + + "having " + + "identified if immediate in increment index indexes indicator initial initrans insert interface intersect " + + "into is " + + "key " + + "level library like limited local lock log logging long loop " + + "master maxextents maxtrans member minextents minus mislabel mode modify multiset " + + "new next no noaudit nocompress nologging noparallel not nowait number_base " + + "object of off offline on online only open option or order out " + + "package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior " + + "private privileges procedure public " + + "raise range raw read rebuild record ref references refresh release rename replace resource restrict return " + + "returning reverse revoke rollback row rowid rowlabel rownum rows run " + + "savepoint schema segment select separate session set share snapshot some space split sql start statement " + + "storage subtype successful synonym " + + "tabauth table tables tablespace task terminate then to trigger truncate type " + + "union unique unlimited unrecoverable unusable update use using " + + "validate value values variable view views " + + "when whenever where while with work"; + + var cFunctions = "abs acos add_months ascii asin atan atan2 average " + + "bfilename " + + "ceil chartorowid chr concat convert cos cosh count " + + "decode deref dual dump dup_val_on_index " + + "empty error exp " + + "false floor found " + + "glb greatest " + + "hextoraw " + + "initcap instr instrb isopen " + + "last_day least lenght lenghtb ln lower lpad ltrim lub " + + "make_ref max min mod months_between " + + "new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower " + + "nls_sort nls_upper nlssort no_data_found notfound null nvl " + + "others " + + "power " + + "rawtohex reftohex round rowcount rowidtochar rpad rtrim " + + "sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate " + + "tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc " + + "uid upper user userenv " + + "variance vsize"; + + var cTypes = "bfile blob " + + "character clob " + + "dec " + + "float " + + "int integer " + + "mlslabel " + + "natural naturaln nchar nclob number numeric nvarchar2 " + + "real rowtype " + + "signtype smallint string " + + "varchar varchar2"; + + var cSqlplus = "appinfo arraysize autocommit autoprint autorecovery autotrace " + + "blockterminator break btitle " + + "cmdsep colsep compatibility compute concat copycommit copytypecheck " + + "define describe " + + "echo editfile embedded escape exec execute " + + "feedback flagger flush " + + "heading headsep " + + "instance " + + "linesize lno loboffset logsource long longchunksize " + + "markup " + + "native newpage numformat numwidth " + + "pagesize pause pno " + + "recsep recsepchar release repfooter repheader " + + "serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber " + + "sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix " + + "tab term termout time timing trimout trimspool ttitle " + + "underline " + + "verify version " + + "wrap"; + + CodeMirror.defineMIME("text/x-plsql", { + name: "plsql", + keywords: keywords(cKeywords), + functions: keywords(cFunctions), + types: keywords(cTypes), + sqlplus: keywords(cSqlplus) + }); +}()); diff --git a/conlite/external/codemirror/mode/properties/index.html b/conlite/external/codemirror/mode/properties/index.html new file mode 100644 index 0000000..4f0c269 --- /dev/null +++ b/conlite/external/codemirror/mode/properties/index.html @@ -0,0 +1,40 @@ + + + + CodeMirror: Properties files mode + + + + + + + +

CodeMirror: Properties files mode

+
+ + +

MIME types defined: text/x-properties, + text/x-ini.

+ + + diff --git a/conlite/external/codemirror/mode/properties/properties.js b/conlite/external/codemirror/mode/properties/properties.js new file mode 100644 index 0000000..d3a13c7 --- /dev/null +++ b/conlite/external/codemirror/mode/properties/properties.js @@ -0,0 +1,63 @@ +CodeMirror.defineMode("properties", function() { + return { + token: function(stream, state) { + var sol = stream.sol() || state.afterSection; + var eol = stream.eol(); + + state.afterSection = false; + + if (sol) { + if (state.nextMultiline) { + state.inMultiline = true; + state.nextMultiline = false; + } else { + state.position = "def"; + } + } + + if (eol && ! state.nextMultiline) { + state.inMultiline = false; + state.position = "def"; + } + + if (sol) { + while(stream.eatSpace()); + } + + var ch = stream.next(); + + if (sol && (ch === "#" || ch === "!" || ch === ";")) { + state.position = "comment"; + stream.skipToEnd(); + return "comment"; + } else if (sol && ch === "[") { + state.afterSection = true; + stream.skipTo("]"); stream.eat("]"); + return "header"; + } else if (ch === "=" || ch === ":") { + state.position = "quote"; + return null; + } else if (ch === "\\" && state.position === "quote") { + if (stream.next() !== "u") { // u = Unicode sequence \u1234 + // Multiline value + state.nextMultiline = true; + } + } + + return state.position; + }, + + startState: function() { + return { + position : "def", // Current position, "def", "quote" or "comment" + nextMultiline : false, // Is the next line multiline value + inMultiline : false, // Is the current line a multiline value + afterSection : false // Did we just open a section + }; + } + + }; +}); + +CodeMirror.defineMIME("text/x-properties", "properties"); +CodeMirror.defineMIME("text/x-ini", "properties"); diff --git a/conlite/external/codemirror/mode/python/LICENSE.txt b/conlite/external/codemirror/mode/python/LICENSE.txt new file mode 100644 index 0000000..918866b --- /dev/null +++ b/conlite/external/codemirror/mode/python/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010 Timothy Farrell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/conlite/external/codemirror/mode/python/index.html b/conlite/external/codemirror/mode/python/index.html new file mode 100644 index 0000000..47e0e9d --- /dev/null +++ b/conlite/external/codemirror/mode/python/index.html @@ -0,0 +1,122 @@ + + + + CodeMirror: Python mode + + + + + + + +

CodeMirror: Python mode

+ +
+ +

Configuration Options:

+
    +
  • version - 2/3 - The version of Python to recognize. Default is 2.
  • +
  • singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.
  • +
+ +

MIME types defined: text/x-python.

+ + diff --git a/conlite/external/codemirror/mode/python/python.js b/conlite/external/codemirror/mode/python/python.js new file mode 100644 index 0000000..d6888e8 --- /dev/null +++ b/conlite/external/codemirror/mode/python/python.js @@ -0,0 +1,338 @@ +CodeMirror.defineMode("python", function(conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); + var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); + var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); + var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); + var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + + var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']); + var commonkeywords = ['as', 'assert', 'break', 'class', 'continue', + 'def', 'del', 'elif', 'else', 'except', 'finally', + 'for', 'from', 'global', 'if', 'import', + 'lambda', 'pass', 'raise', 'return', + 'try', 'while', 'with', 'yield']; + var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr', + 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', + 'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset', + 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', + 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', + 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', + 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range', + 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', + 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', + 'type', 'vars', 'zip', '__import__', 'NotImplemented', + 'Ellipsis', '__debug__']; + var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile', + 'file', 'intern', 'long', 'raw_input', 'reduce', 'reload', + 'unichr', 'unicode', 'xrange', 'False', 'True', 'None'], + 'keywords': ['exec', 'print']}; + var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'], + 'keywords': ['nonlocal', 'False', 'True', 'None']}; + + if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) { + commonkeywords = commonkeywords.concat(py3.keywords); + commonBuiltins = commonBuiltins.concat(py3.builtins); + var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i"); + } else { + commonkeywords = commonkeywords.concat(py2.keywords); + commonBuiltins = commonBuiltins.concat(py2.builtins); + var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); + } + var keywords = wordRegexp(commonkeywords); + var builtins = wordRegexp(commonBuiltins); + + var indentInfo = null; + + // tokenizers + function tokenBase(stream, state) { + // Handle scope changes + if (stream.sol()) { + var scopeOffset = state.scopes[0].offset; + if (stream.eatSpace()) { + var lineOffset = stream.indentation(); + if (lineOffset > scopeOffset) { + indentInfo = 'indent'; + } else if (lineOffset < scopeOffset) { + indentInfo = 'dedent'; + } + return null; + } else { + if (scopeOffset > 0) { + dedent(stream, state); + } + } + } + if (stream.eatSpace()) { + return null; + } + + var ch = stream.peek(); + + // Handle Comments + if (ch === '#') { + stream.skipToEnd(); + return 'comment'; + } + + // Handle Number Literals + if (stream.match(/^[0-9\.]/, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; } + if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } + if (stream.match(/^\.\d+/)) { floatLiteral = true; } + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; } + // Binary + if (stream.match(/^0b[01]+/i)) { intLiteral = true; } + // Octal + if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; } + // Decimal + if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return 'number'; + } + } + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + // Handle operators and Delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { + return null; + } + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return null; + } + + if (stream.match(keywords)) { + return 'keyword'; + } + + if (stream.match(builtins)) { + return 'builtin'; + } + + if (stream.match(identifiers)) { + return 'variable'; + } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenStringFactory(delimiter) { + while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) { + delimiter = delimiter.substr(1); + } + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + return function tokenString(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"\\]/); + if (stream.eat('\\')) { + stream.next(); + if (singleline && stream.eol()) { + return OUTCLASS; + } + } else if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } + } + return OUTCLASS; + }; + } + + function indent(stream, state, type) { + type = type || 'py'; + var indentUnit = 0; + if (type === 'py') { + if (state.scopes[0].type !== 'py') { + state.scopes[0].offset = stream.indentation(); + return; + } + for (var i = 0; i < state.scopes.length; ++i) { + if (state.scopes[i].type === 'py') { + indentUnit = state.scopes[i].offset + conf.indentUnit; + break; + } + } + } else { + indentUnit = stream.column() + stream.current().length; + } + state.scopes.unshift({ + offset: indentUnit, + type: type + }); + } + + function dedent(stream, state, type) { + type = type || 'py'; + if (state.scopes.length == 1) return; + if (state.scopes[0].type === 'py') { + var _indent = stream.indentation(); + var _indent_index = -1; + for (var i = 0; i < state.scopes.length; ++i) { + if (_indent === state.scopes[i].offset) { + _indent_index = i; + break; + } + } + if (_indent_index === -1) { + return true; + } + while (state.scopes[0].offset !== _indent) { + state.scopes.shift(); + } + return false + } else { + if (type === 'py') { + state.scopes[0].offset = stream.indentation(); + return false; + } else { + if (state.scopes[0].type != type) { + return true; + } + state.scopes.shift(); + return false; + } + } + } + + function tokenLexer(stream, state) { + indentInfo = null; + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current === '.') { + style = stream.match(identifiers, false) ? null : ERRORCLASS; + if (style === null && state.lastToken === 'meta') { + // Apply 'meta' style to '.' connected identifiers when + // appropriate. + style = 'meta'; + } + return style; + } + + // Handle decorators + if (current === '@') { + return stream.match(identifiers, false) ? 'meta' : ERRORCLASS; + } + + if ((style === 'variable' || style === 'builtin') + && state.lastToken === 'meta') { + style = 'meta'; + } + + // Handle scope changes. + if (current === 'pass' || current === 'return') { + state.dedent += 1; + } + if (current === 'lambda') state.lambda = true; + if ((current === ':' && !state.lambda && state.scopes[0].type == 'py') + || indentInfo === 'indent') { + indent(stream, state); + } + var delimiter_index = '[({'.indexOf(current); + if (delimiter_index !== -1) { + indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1)); + } + if (indentInfo === 'dedent') { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + delimiter_index = '])}'.indexOf(current); + if (delimiter_index !== -1) { + if (dedent(stream, state, current)) { + return ERRORCLASS; + } + } + if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') { + if (state.scopes.length > 1) state.scopes.shift(); + state.dedent -= 1; + } + + return style; + } + + var external = { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + scopes: [{offset:basecolumn || 0, type:'py'}], + lastToken: null, + lambda: false, + dedent: 0 + }; + }, + + token: function(stream, state) { + var style = tokenLexer(stream, state); + + state.lastToken = style; + + if (stream.eol() && stream.lambda) { + state.lambda = false; + } + + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) { + return 0; + } + + return state.scopes[0].offset; + } + + }; + return external; +}); + +CodeMirror.defineMIME("text/x-python", "python"); diff --git a/conlite/external/codemirror/mode/r/LICENSE b/conlite/external/codemirror/mode/r/LICENSE new file mode 100644 index 0000000..2510ae1 --- /dev/null +++ b/conlite/external/codemirror/mode/r/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011, Ubalo, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Ubalo, Inc nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/conlite/external/codemirror/mode/r/index.html b/conlite/external/codemirror/mode/r/index.html new file mode 100644 index 0000000..6977505 --- /dev/null +++ b/conlite/external/codemirror/mode/r/index.html @@ -0,0 +1,73 @@ + + + + CodeMirror: R mode + + + + + + + +

CodeMirror: R mode

+
+ + +

MIME types defined: text/x-rsrc.

+ +

Development of the CodeMirror R mode was kindly sponsored + by Ubalo, who hold + the license.

+ + + diff --git a/conlite/external/codemirror/mode/r/r.js b/conlite/external/codemirror/mode/r/r.js new file mode 100644 index 0000000..53647f2 --- /dev/null +++ b/conlite/external/codemirror/mode/r/r.js @@ -0,0 +1,141 @@ +CodeMirror.defineMode("r", function(config) { + function wordObj(str) { + var words = str.split(" "), res = {}; + for (var i = 0; i < words.length; ++i) res[words[i]] = true; + return res; + } + var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"); + var builtins = wordObj("list quote bquote eval return call parse deparse"); + var keywords = wordObj("if else repeat while function for in next break"); + var blockkeywords = wordObj("if else repeat while function for"); + var opChars = /[+\-*\/^<>=!&|~$:]/; + var curPunc; + + function tokenBase(stream, state) { + curPunc = null; + var ch = stream.next(); + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (ch == "0" && stream.eat("x")) { + stream.eatWhile(/[\da-f]/i); + return "number"; + } else if (ch == "." && stream.eat(/\d/)) { + stream.match(/\d*(?:e[+\-]?\d+)?/); + return "number"; + } else if (/\d/.test(ch)) { + stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/); + return "number"; + } else if (ch == "'" || ch == '"') { + state.tokenize = tokenString(ch); + return "string"; + } else if (ch == "." && stream.match(/.[.\d]+/)) { + return "keyword"; + } else if (/[\w\.]/.test(ch) && ch != "_") { + stream.eatWhile(/[\w\.]/); + var word = stream.current(); + if (atoms.propertyIsEnumerable(word)) return "atom"; + if (keywords.propertyIsEnumerable(word)) { + if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block"; + return "keyword"; + } + if (builtins.propertyIsEnumerable(word)) return "builtin"; + return "variable"; + } else if (ch == "%") { + if (stream.skipTo("%")) stream.next(); + return "variable-2"; + } else if (ch == "<" && stream.eat("-")) { + return "arrow"; + } else if (ch == "=" && state.ctx.argList) { + return "arg-is"; + } else if (opChars.test(ch)) { + if (ch == "$") return "dollar"; + stream.eatWhile(opChars); + return "operator"; + } else if (/[\(\){}\[\];]/.test(ch)) { + curPunc = ch; + if (ch == ";") return "semi"; + return null; + } else { + return null; + } + } + + function tokenString(quote) { + return function(stream, state) { + if (stream.eat("\\")) { + var ch = stream.next(); + if (ch == "x") stream.match(/^[a-f0-9]{2}/i); + else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next(); + else if (ch == "u") stream.match(/^[a-f0-9]{4}/i); + else if (ch == "U") stream.match(/^[a-f0-9]{8}/i); + else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/); + return "string-2"; + } else { + var next; + while ((next = stream.next()) != null) { + if (next == quote) { state.tokenize = tokenBase; break; } + if (next == "\\") { stream.backUp(1); break; } + } + return "string"; + } + }; + } + + function push(state, type, stream) { + state.ctx = {type: type, + indent: state.indent, + align: null, + column: stream.column(), + prev: state.ctx}; + } + function pop(state) { + state.indent = state.ctx.indent; + state.ctx = state.ctx.prev; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + ctx: {type: "top", + indent: -config.indentUnit, + align: false}, + indent: 0, + afterIdent: false}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.ctx.align == null) state.ctx.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (style != "comment" && state.ctx.align == null) state.ctx.align = true; + + var ctype = state.ctx.type; + if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state); + if (curPunc == "{") push(state, "}", stream); + else if (curPunc == "(") { + push(state, ")", stream); + if (state.afterIdent) state.ctx.argList = true; + } + else if (curPunc == "[") push(state, "]", stream); + else if (curPunc == "block") push(state, "block", stream); + else if (curPunc == ctype) pop(state); + state.afterIdent = style == "variable" || style == "keyword"; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx, + closing = firstChar == ctx.type; + if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indent + (closing ? 0 : config.indentUnit); + } + }; +}); + +CodeMirror.defineMIME("text/x-rsrc", "r"); diff --git a/conlite/external/codemirror/mode/rpm/changes/changes.js b/conlite/external/codemirror/mode/rpm/changes/changes.js new file mode 100644 index 0000000..cb45f9e --- /dev/null +++ b/conlite/external/codemirror/mode/rpm/changes/changes.js @@ -0,0 +1,19 @@ +CodeMirror.defineMode("changes", function(config, modeConfig) { + var headerSeperator = /^-+$/; + var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; + var simpleEmail = /^[\w+.-]+@[\w.-]+/; + + return { + token: function(stream) { + if (stream.sol()) { + if (stream.match(headerSeperator)) { return 'tag'; } + if (stream.match(headerLine)) { return 'tag'; } + } + if (stream.match(simpleEmail)) { return 'string'; } + stream.next(); + return null; + } + }; +}); + +CodeMirror.defineMIME("text/x-rpm-changes", "changes"); diff --git a/conlite/external/codemirror/mode/rpm/changes/index.html b/conlite/external/codemirror/mode/rpm/changes/index.html new file mode 100644 index 0000000..b7ff952 --- /dev/null +++ b/conlite/external/codemirror/mode/rpm/changes/index.html @@ -0,0 +1,53 @@ + + + + CodeMirror: RPM changes mode + + + + + + + +

CodeMirror: RPM changes mode

+ +
+ + +

MIME types defined: text/x-rpm-changes.

+ + diff --git a/conlite/external/codemirror/mode/rpm/spec/index.html b/conlite/external/codemirror/mode/rpm/spec/index.html new file mode 100644 index 0000000..e3bca15 --- /dev/null +++ b/conlite/external/codemirror/mode/rpm/spec/index.html @@ -0,0 +1,99 @@ + + + + CodeMirror: RPM spec mode + + + + + + + + +

CodeMirror: RPM spec mode

+ +
+ + +

MIME types defined: text/x-rpm-spec.

+ + diff --git a/conlite/external/codemirror/mode/rpm/spec/spec.css b/conlite/external/codemirror/mode/rpm/spec/spec.css new file mode 100644 index 0000000..d0a5d43 --- /dev/null +++ b/conlite/external/codemirror/mode/rpm/spec/spec.css @@ -0,0 +1,5 @@ +.cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} +.cm-s-default span.cm-macro {color: #b218b2;} +.cm-s-default span.cm-section {color: green; font-weight: bold;} +.cm-s-default span.cm-script {color: red;} +.cm-s-default span.cm-issue {color: yellow;} diff --git a/conlite/external/codemirror/mode/rpm/spec/spec.js b/conlite/external/codemirror/mode/rpm/spec/spec.js new file mode 100644 index 0000000..902db6a --- /dev/null +++ b/conlite/external/codemirror/mode/rpm/spec/spec.js @@ -0,0 +1,66 @@ +// Quick and dirty spec file highlighting + +CodeMirror.defineMode("spec", function(config, modeConfig) { + var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; + + var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/; + var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preun|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/; + var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros + var control_flow_simple = /^%(else|endif)/; // rpm control flow macros + var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros + + return { + startState: function () { + return { + controlFlow: false, + macroParameters: false, + section: false + }; + }, + token: function (stream, state) { + var ch = stream.peek(); + if (ch == "#") { stream.skipToEnd(); return "comment"; } + + if (stream.sol()) { + if (stream.match(preamble)) { return "preamble"; } + if (stream.match(section)) { return "section"; } + } + + if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT' + if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}' + + if (stream.match(control_flow_simple)) { return "keyword"; } + if (stream.match(control_flow_complex)) { + state.controlFlow = true; + return "keyword"; + } + if (state.controlFlow) { + if (stream.match(operators)) { return "operator"; } + if (stream.match(/^(\d+)/)) { return "number"; } + if (stream.eol()) { state.controlFlow = false; } + } + + if (stream.match(arch)) { return "number"; } + + // Macros like '%make_install' or '%attr(0775,root,root)' + if (stream.match(/^%[\w]+/)) { + if (stream.match(/^\(/)) { state.macroParameters = true; } + return "macro"; + } + if (state.macroParameters) { + if (stream.match(/^\d+/)) { return "number";} + if (stream.match(/^\)/)) { + state.macroParameters = false; + return "macro"; + } + } + if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}' + + //TODO: Include bash script sub-parser (CodeMirror supports that) + stream.next(); + return null; + } + }; +}); + +CodeMirror.defineMIME("text/x-rpm-spec", "spec"); diff --git a/conlite/external/codemirror/mode/rst/index.html b/conlite/external/codemirror/mode/rst/index.html new file mode 100644 index 0000000..fd75a28 --- /dev/null +++ b/conlite/external/codemirror/mode/rst/index.html @@ -0,0 +1,525 @@ + + + + CodeMirror: reStructuredText mode + + + + + + + +

CodeMirror: reStructuredText mode

+ +
+ + +

The reStructuredText mode supports one configuration parameter:

+
+
verbatim (string)
+
A name or MIME type of a mode that will be used for highlighting + verbatim blocks. By default, reStructuredText mode uses uniform color + for whole block of verbatim text if no mode is given.
+
+

If python mode is available, + it will be used for highlighting blocks containing Python/IPython terminal + sessions (blocks starting with >>> (for Python) or + In [num]: (for IPython). + +

MIME types defined: text/x-rst.

+ + + diff --git a/conlite/external/codemirror/mode/rst/rst.js b/conlite/external/codemirror/mode/rst/rst.js new file mode 100644 index 0000000..c4ecdf4 --- /dev/null +++ b/conlite/external/codemirror/mode/rst/rst.js @@ -0,0 +1,326 @@ +CodeMirror.defineMode('rst', function(config, options) { + function setState(state, fn, ctx) { + state.fn = fn; + setCtx(state, ctx); + } + + function setCtx(state, ctx) { + state.ctx = ctx || {}; + } + + function setNormal(state, ch) { + if (ch && (typeof ch !== 'string')) { + var str = ch.current(); + ch = str[str.length-1]; + } + + setState(state, normal, {back: ch}); + } + + function hasMode(mode) { + if (mode) { + var modes = CodeMirror.listModes(); + + for (var i in modes) { + if (modes[i] == mode) { + return true; + } + } + } + + return false; + } + + function getMode(mode) { + if (hasMode(mode)) { + return CodeMirror.getMode(config, mode); + } else { + return null; + } + } + + var verbatimMode = getMode(options.verbatim); + var pythonMode = getMode('python'); + + var reSection = /^[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/; + var reDirective = /^\s*\w([-:.\w]*\w)?::(\s|$)/; + var reHyperlink = /^\s*_[\w-]+:(\s|$)/; + var reFootnote = /^\s*\[(\d+|#)\](\s|$)/; + var reCitation = /^\s*\[[A-Za-z][\w-]*\](\s|$)/; + var reFootnoteRef = /^\[(\d+|#)\]_/; + var reCitationRef = /^\[[A-Za-z][\w-]*\]_/; + var reDirectiveMarker = /^\.\.(\s|$)/; + var reVerbatimMarker = /^::\s*$/; + var rePreInline = /^[-\s"([{/:.,;!?\\_]/; + var reEnumeratedList = /^\s*((\d+|[A-Za-z#])[.)]|\((\d+|[A-Z-a-z#])\))\s/; + var reBulletedList = /^\s*[-\+\*]\s/; + var reExamples = /^\s+(>>>|In \[\d+\]:)\s/; + + function normal(stream, state) { + var ch, sol, i; + + if (stream.eat(/\\/)) { + ch = stream.next(); + setNormal(state, ch); + return null; + } + + sol = stream.sol(); + + if (sol && (ch = stream.eat(reSection))) { + for (i = 0; stream.eat(ch); i++); + + if (i >= 3 && stream.match(/^\s*$/)) { + setNormal(state, null); + return 'header'; + } else { + stream.backUp(i + 1); + } + } + + if (sol && stream.match(reDirectiveMarker)) { + if (!stream.eol()) { + setState(state, directive); + } + return 'meta'; + } + + if (stream.match(reVerbatimMarker)) { + if (!verbatimMode) { + setState(state, verbatim); + } else { + var mode = verbatimMode; + + setState(state, verbatim, { + mode: mode, + local: mode.startState() + }); + } + return 'meta'; + } + + if (sol && stream.match(reExamples, false)) { + if (!pythonMode) { + setState(state, verbatim); + return 'meta'; + } else { + var mode = pythonMode; + + setState(state, verbatim, { + mode: mode, + local: mode.startState() + }); + + return null; + } + } + + function testBackward(re) { + return sol || !state.ctx.back || re.test(state.ctx.back); + } + + function testForward(re) { + return stream.eol() || stream.match(re, false); + } + + function testInline(re) { + return stream.match(re) && testBackward(/\W/) && testForward(/\W/); + } + + if (testInline(reFootnoteRef)) { + setNormal(state, stream); + return 'footnote'; + } + + if (testInline(reCitationRef)) { + setNormal(state, stream); + return 'citation'; + } + + ch = stream.next(); + + if (testBackward(rePreInline)) { + if ((ch === ':' || ch === '|') && stream.eat(/\S/)) { + var token; + + if (ch === ':') { + token = 'builtin'; + } else { + token = 'atom'; + } + + setState(state, inline, { + ch: ch, + wide: false, + prev: null, + token: token + }); + + return token; + } + + if (ch === '*' || ch === '`') { + var orig = ch, + wide = false; + + ch = stream.next(); + + if (ch == orig) { + wide = true; + ch = stream.next(); + } + + if (ch && !/\s/.test(ch)) { + var token; + + if (orig === '*') { + token = wide ? 'strong' : 'em'; + } else { + token = wide ? 'string' : 'string-2'; + } + + setState(state, inline, { + ch: orig, // inline() has to know what to search for + wide: wide, // are we looking for `ch` or `chch` + prev: null, // terminator must not be preceeded with whitespace + token: token // I don't want to recompute this all the time + }); + + return token; + } + } + } + + setNormal(state, ch); + return null; + } + + function inline(stream, state) { + var ch = stream.next(), + token = state.ctx.token; + + function finish(ch) { + state.ctx.prev = ch; + return token; + } + + if (ch != state.ctx.ch) { + return finish(ch); + } + + if (/\s/.test(state.ctx.prev)) { + return finish(ch); + } + + if (state.ctx.wide) { + ch = stream.next(); + + if (ch != state.ctx.ch) { + return finish(ch); + } + } + + if (!stream.eol() && !rePostInline.test(stream.peek())) { + if (state.ctx.wide) { + stream.backUp(1); + } + + return finish(ch); + } + + setState(state, normal); + setNormal(state, ch); + + return token; + } + + function directive(stream, state) { + var token = null; + + if (stream.match(reDirective)) { + token = 'attribute'; + } else if (stream.match(reHyperlink)) { + token = 'link'; + } else if (stream.match(reFootnote)) { + token = 'quote'; + } else if (stream.match(reCitation)) { + token = 'quote'; + } else { + stream.eatSpace(); + + if (stream.eol()) { + setNormal(state, stream); + return null; + } else { + stream.skipToEnd(); + setState(state, comment); + return 'comment'; + } + } + + // FIXME this is unreachable + setState(state, body, {start: true}); + return token; + } + + function body(stream, state) { + var token = 'body'; + + if (!state.ctx.start || stream.sol()) { + return block(stream, state, token); + } + + stream.skipToEnd(); + setCtx(state); + + return token; + } + + function comment(stream, state) { + return block(stream, state, 'comment'); + } + + function verbatim(stream, state) { + if (!verbatimMode) { + return block(stream, state, 'meta'); + } else { + if (stream.sol()) { + if (!stream.eatSpace()) { + setNormal(state, stream); + } + + return null; + } + + return verbatimMode.token(stream, state.ctx.local); + } + } + + function block(stream, state, token) { + if (stream.eol() || stream.eatSpace()) { + stream.skipToEnd(); + return token; + } else { + setNormal(state, stream); + return null; + } + } + + return { + startState: function() { + return {fn: normal, ctx: {}}; + }, + + copyState: function(state) { + return {fn: state.fn, ctx: state.ctx}; + }, + + token: function(stream, state) { + var token = state.fn(stream, state); + return token; + } + }; +}, "python"); + +CodeMirror.defineMIME("text/x-rst", "rst"); diff --git a/conlite/external/codemirror/mode/ruby/LICENSE b/conlite/external/codemirror/mode/ruby/LICENSE new file mode 100644 index 0000000..ac09fc4 --- /dev/null +++ b/conlite/external/codemirror/mode/ruby/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2011, Ubalo, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Ubalo, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/conlite/external/codemirror/mode/ruby/index.html b/conlite/external/codemirror/mode/ruby/index.html new file mode 100644 index 0000000..6d33db1 --- /dev/null +++ b/conlite/external/codemirror/mode/ruby/index.html @@ -0,0 +1,171 @@ + + + + CodeMirror: Ruby mode + + + + + + + +

CodeMirror: Ruby mode

+
+ + +

MIME types defined: text/x-ruby.

+ +

Development of the CodeMirror Ruby mode was kindly sponsored + by Ubalo, who hold + the license.

+ + + diff --git a/conlite/external/codemirror/mode/ruby/ruby.js b/conlite/external/codemirror/mode/ruby/ruby.js new file mode 100644 index 0000000..74ed7b9 --- /dev/null +++ b/conlite/external/codemirror/mode/ruby/ruby.js @@ -0,0 +1,195 @@ +CodeMirror.defineMode("ruby", function(config, parserConfig) { + function wordObj(words) { + var o = {}; + for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; + return o; + } + var keywords = wordObj([ + "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", + "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", + "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", + "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc", + "caller", "lambda", "proc", "public", "protected", "private", "require", "load", + "require_relative", "extend", "autoload" + ]); + var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then", + "catch", "loop", "proc", "begin"]); + var dedentWords = wordObj(["end", "until"]); + var matching = {"[": "]", "{": "}", "(": ")"}; + var curPunc; + + function chain(newtok, stream, state) { + state.tokenize.push(newtok); + return newtok(stream, state); + } + + function tokenBase(stream, state) { + curPunc = null; + if (stream.sol() && stream.match("=begin") && stream.eol()) { + state.tokenize.push(readBlockComment); + return "comment"; + } + if (stream.eatSpace()) return null; + var ch = stream.next(), m; + if (ch == "`" || ch == "'" || ch == '"' || + (ch == "/" && !stream.eol() && stream.peek() != " ")) { + return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); + } else if (ch == "%") { + var style, embed = false; + if (stream.eat("s")) style = "atom"; + else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; } + else if (stream.eat(/[wxqr]/)) style = "string"; + var delim = stream.eat(/[^\w\s]/); + if (!delim) return "operator"; + if (matching.propertyIsEnumerable(delim)) delim = matching[delim]; + return chain(readQuoted(delim, style, embed, true), stream, state); + } else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) { + return chain(readHereDoc(m[1]), stream, state); + } else if (ch == "0") { + if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/); + else if (stream.eat("b")) stream.eatWhile(/[01]/); + else stream.eatWhile(/[0-7]/); + return "number"; + } else if (/\d/.test(ch)) { + stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/); + return "number"; + } else if (ch == "?") { + while (stream.match(/^\\[CM]-/)) {} + if (stream.eat("\\")) stream.eatWhile(/\w/); + else stream.next(); + return "string"; + } else if (ch == ":") { + if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state); + if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state); + stream.eatWhile(/[\w\?]/); + return "atom"; + } else if (ch == "@") { + stream.eat("@"); + stream.eatWhile(/[\w\?]/); + return "variable-2"; + } else if (ch == "$") { + stream.next(); + stream.eatWhile(/[\w\?]/); + return "variable-3"; + } else if (/\w/.test(ch)) { + stream.eatWhile(/[\w\?]/); + if (stream.eat(":")) return "atom"; + return "ident"; + } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) { + curPunc = "|"; + return null; + } else if (/[\(\)\[\]{}\\;]/.test(ch)) { + curPunc = ch; + return null; + } else if (ch == "-" && stream.eat(">")) { + return "arrow"; + } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) { + stream.eatWhile(/[=+\-\/*:\.^%<>~|]/); + return "operator"; + } else { + return null; + } + } + + function tokenBaseUntilBrace() { + var depth = 1; + return function(stream, state) { + if (stream.peek() == "}") { + depth--; + if (depth == 0) { + state.tokenize.pop(); + return state.tokenize[state.tokenize.length-1](stream, state); + } + } else if (stream.peek() == "{") { + depth++; + } + return tokenBase(stream, state); + }; + } + function readQuoted(quote, style, embed, unescaped) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && (unescaped || !escaped)) { + state.tokenize.pop(); + break; + } + if (embed && ch == "#" && !escaped && stream.eat("{")) { + state.tokenize.push(tokenBaseUntilBrace(arguments.callee)); + break; + } + escaped = !escaped && ch == "\\"; + } + return style; + }; + } + function readHereDoc(phrase) { + return function(stream, state) { + if (stream.match(phrase)) state.tokenize.pop(); + else stream.skipToEnd(); + return "string"; + }; + } + function readBlockComment(stream, state) { + if (stream.sol() && stream.match("=end") && stream.eol()) + state.tokenize.pop(); + stream.skipToEnd(); + return "comment"; + } + + return { + startState: function() { + return {tokenize: [tokenBase], + indented: 0, + context: {type: "top", indented: -config.indentUnit}, + continuedLine: false, + lastTok: null, + varList: false}; + }, + + token: function(stream, state) { + if (stream.sol()) state.indented = stream.indentation(); + var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype; + if (style == "ident") { + var word = stream.current(); + style = keywords.propertyIsEnumerable(stream.current()) ? "keyword" + : /^[A-Z]/.test(word) ? "tag" + : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def" + : "variable"; + if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; + else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; + else if ((word == "if" || word == "unless") && stream.column() == stream.indentation()) + kwtype = "indent"; + } + if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style; + if (curPunc == "|") state.varList = !state.varList; + + if (kwtype == "indent" || /[\(\[\{]/.test(curPunc)) + state.context = {prev: state.context, type: curPunc || style, indented: state.indented}; + else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev) + state.context = state.context.prev; + + if (stream.eol()) + state.continuedLine = (curPunc == "\\" || style == "operator"); + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0); + var ct = state.context; + var closing = ct.type == matching[firstChar] || + ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter); + return ct.indented + (closing ? 0 : config.indentUnit) + + (state.continuedLine ? config.indentUnit : 0); + }, + electricChars: "}de" // enD and rescuE + + }; +}); + +CodeMirror.defineMIME("text/x-ruby", "ruby"); + diff --git a/conlite/external/codemirror/mode/rust/index.html b/conlite/external/codemirror/mode/rust/index.html new file mode 100644 index 0000000..3b811e3 --- /dev/null +++ b/conlite/external/codemirror/mode/rust/index.html @@ -0,0 +1,48 @@ + + + + CodeMirror: Rust mode + + + + + + + +

CodeMirror: Rust mode

+ +
+ + + +

MIME types defined: text/x-rustsrc.

+ + diff --git a/conlite/external/codemirror/mode/rust/rust.js b/conlite/external/codemirror/mode/rust/rust.js new file mode 100644 index 0000000..2a5caac --- /dev/null +++ b/conlite/external/codemirror/mode/rust/rust.js @@ -0,0 +1,432 @@ +CodeMirror.defineMode("rust", function() { + var indentUnit = 4, altIndentUnit = 2; + var valKeywords = { + "if": "if-style", "while": "if-style", "else": "else-style", + "do": "else-style", "ret": "else-style", "fail": "else-style", + "break": "atom", "cont": "atom", "const": "let", "resource": "fn", + "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface", + "impl": "impl", "type": "type", "enum": "enum", "mod": "mod", + "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op", + "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style", + "export": "else-style", "copy": "op", "log": "op", "log_err": "op", + "use": "op", "bind": "op", "self": "atom" + }; + var typeKeywords = function() { + var keywords = {"fn": "fn", "block": "fn", "obj": "obj"}; + var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" "); + for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom"; + return keywords; + }(); + var operatorChar = /[+\-*&%=<>!?|\.@]/; + + // Tokenizer + + // Used as scratch variable to communicate multiple values without + // consing up tons of objects. + var tcat, content; + function r(tc, style) { + tcat = tc; + return style; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + if (ch == "'") { + tcat = "atom"; + if (stream.eat("\\")) { + if (stream.skipTo("'")) { stream.next(); return "string"; } + else { return "error"; } + } else { + stream.next(); + return stream.eat("'") ? "string" : "error"; + } + } + if (ch == "/") { + if (stream.eat("/")) { stream.skipToEnd(); return "comment"; } + if (stream.eat("*")) { + state.tokenize = tokenComment(1); + return state.tokenize(stream, state); + } + } + if (ch == "#") { + if (stream.eat("[")) { tcat = "open-attr"; return null; } + stream.eatWhile(/\w/); + return r("macro", "meta"); + } + if (ch == ":" && stream.match(":<")) { + return r("op", null); + } + if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) { + var flp = false; + if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) { + stream.eatWhile(/\d/); + if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); } + if (stream.match(/^e[+\-]?\d+/i)) { flp = true; } + } + if (flp) stream.match(/^f(?:32|64)/); + else stream.match(/^[ui](?:8|16|32|64)/); + return r("atom", "number"); + } + if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null); + if (ch == "-" && stream.eat(">")) return r("->", null); + if (ch.match(operatorChar)) { + stream.eatWhile(operatorChar); + return r("op", null); + } + stream.eatWhile(/\w/); + content = stream.current(); + if (stream.match(/^::\w/)) { + stream.backUp(1); + return r("prefix", "variable-2"); + } + if (state.keywords.propertyIsEnumerable(content)) + return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword"); + return r("name", "variable"); + } + + function tokenString(stream, state) { + var ch, escaped = false; + while (ch = stream.next()) { + if (ch == '"' && !escaped) { + state.tokenize = tokenBase; + return r("atom", "string"); + } + escaped = !escaped && ch == "\\"; + } + // Hack to not confuse the parser when a string is split in + // pieces. + return r("op", "string"); + } + + function tokenComment(depth) { + return function(stream, state) { + var lastCh = null, ch; + while (ch = stream.next()) { + if (ch == "/" && lastCh == "*") { + if (depth == 1) { + state.tokenize = tokenBase; + break; + } else { + state.tokenize = tokenComment(depth - 1); + return state.tokenize(stream, state); + } + } + if (ch == "*" && lastCh == "/") { + state.tokenize = tokenComment(depth + 1); + return state.tokenize(stream, state); + } + lastCh = ch; + } + return "comment"; + }; + } + + // Parser + + var cx = {state: null, stream: null, marked: null, cc: null}; + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); + } + function cont() { + pass.apply(null, arguments); + return true; + } + + function pushlex(type, info) { + var result = function() { + var state = cx.state; + state.lexical = {indented: state.indented, column: cx.stream.column(), + type: type, prev: state.lexical, info: info}; + }; + result.lex = true; + return result; + } + function poplex() { + var state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type == ")") + state.indented = state.lexical.indented; + state.lexical = state.lexical.prev; + } + } + function typecx() { cx.state.keywords = typeKeywords; } + function valcx() { cx.state.keywords = valKeywords; } + poplex.lex = typecx.lex = valcx.lex = true; + + function commasep(comb, end) { + function more(type) { + if (type == ",") return cont(comb, more); + if (type == end) return cont(); + return cont(more); + } + return function(type) { + if (type == end) return cont(); + return pass(comb, more); + }; + } + + function stat_of(comb, tag) { + return cont(pushlex("stat", tag), comb, poplex, block); + } + function block(type) { + if (type == "}") return cont(); + if (type == "let") return stat_of(letdef1, "let"); + if (type == "fn") return stat_of(fndef); + if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block); + if (type == "enum") return stat_of(enumdef); + if (type == "mod") return stat_of(mod); + if (type == "iface") return stat_of(iface); + if (type == "impl") return stat_of(impl); + if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex); + if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block); + return pass(pushlex("stat"), expression, poplex, endstatement, block); + } + function endstatement(type) { + if (type == ";") return cont(); + return pass(); + } + function expression(type) { + if (type == "atom" || type == "name") return cont(maybeop); + if (type == "{") return cont(pushlex("}"), exprbrace, poplex); + if (type.match(/[\[\(]/)) return matchBrackets(type, expression); + if (type.match(/[\]\)\};,]/)) return pass(); + if (type == "if-style") return cont(expression, expression); + if (type == "else-style" || type == "op") return cont(expression); + if (type == "for") return cont(pattern, maybetype, inop, expression, expression); + if (type == "alt") return cont(expression, altbody); + if (type == "fn") return cont(fndef); + if (type == "macro") return cont(macro); + return cont(); + } + function maybeop(type) { + if (content == ".") return cont(maybeprop); + if (content == "::<"){return cont(typarams, maybeop);} + if (type == "op" || content == ":") return cont(expression); + if (type == "(" || type == "[") return matchBrackets(type, expression); + return pass(); + } + function maybeprop(type) { + if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);} + return pass(expression); + } + function exprbrace(type) { + if (type == "op") { + if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block); + if (content == "||") return cont(poplex, pushlex("}", "block"), block); + } + if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":" + && !cx.stream.match("::", false))) + return pass(record_of(expression)); + return pass(block); + } + function record_of(comb) { + function ro(type) { + if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);} + if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);} + if (type == ":") return cont(comb, ro); + if (type == "}") return cont(); + return cont(ro); + } + return ro; + } + function blockvars(type) { + if (type == "name") {cx.marked = "def"; return cont(blockvars);} + if (type == "op" && content == "|") return cont(); + return cont(blockvars); + } + + function letdef1(type) { + if (type.match(/[\]\)\};]/)) return cont(); + if (content == "=") return cont(expression, letdef2); + if (type == ",") return cont(letdef1); + return pass(pattern, maybetype, letdef1); + } + function letdef2(type) { + if (type.match(/[\]\)\};,]/)) return pass(letdef1); + else return pass(expression, letdef2); + } + function maybetype(type) { + if (type == ":") return cont(typecx, rtype, valcx); + return pass(); + } + function inop(type) { + if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();} + return pass(); + } + function fndef(type) { + if (content == "@" || content == "~") {cx.marked = "keyword"; return cont(fndef);} + if (type == "name") {cx.marked = "def"; return cont(fndef);} + if (content == "<") return cont(typarams, fndef); + if (type == "{") return pass(expression); + if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef); + if (type == "->") return cont(typecx, rtype, valcx, fndef); + if (type == ";") return cont(); + return cont(fndef); + } + function tydef(type) { + if (type == "name") {cx.marked = "def"; return cont(tydef);} + if (content == "<") return cont(typarams, tydef); + if (content == "=") return cont(typecx, rtype, valcx); + return cont(tydef); + } + function enumdef(type) { + if (type == "name") {cx.marked = "def"; return cont(enumdef);} + if (content == "<") return cont(typarams, enumdef); + if (content == "=") return cont(typecx, rtype, valcx, endstatement); + if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex); + return cont(enumdef); + } + function enumblock(type) { + if (type == "}") return cont(); + if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock); + if (content.match(/^\w+$/)) cx.marked = "def"; + return cont(enumblock); + } + function mod(type) { + if (type == "name") {cx.marked = "def"; return cont(mod);} + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + function iface(type) { + if (type == "name") {cx.marked = "def"; return cont(iface);} + if (content == "<") return cont(typarams, iface); + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + function impl(type) { + if (content == "<") return cont(typarams, impl); + if (content == "of" || content == "for") {cx.marked = "keyword"; return cont(rtype, impl);} + if (type == "name") {cx.marked = "def"; return cont(impl);} + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + function typarams(type) { + if (content == ">") return cont(); + if (content == ",") return cont(typarams); + if (content == ":") return cont(rtype, typarams); + return pass(rtype, typarams); + } + function argdef(type) { + if (type == "name") {cx.marked = "def"; return cont(argdef);} + if (type == ":") return cont(typecx, rtype, valcx); + return pass(); + } + function rtype(type) { + if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); } + if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);} + if (type == "atom") return cont(rtypemaybeparam); + if (type == "op" || type == "obj") return cont(rtype); + if (type == "fn") return cont(fntype); + if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex); + return matchBrackets(type, rtype); + } + function rtypemaybeparam(type) { + if (content == "<") return cont(typarams); + return pass(); + } + function fntype(type) { + if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype); + if (type == "->") return cont(rtype); + return pass(); + } + function pattern(type) { + if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);} + if (type == "atom") return cont(patternmaybeop); + if (type == "op") return cont(pattern); + if (type.match(/[\]\)\};,]/)) return pass(); + return matchBrackets(type, pattern); + } + function patternmaybeop(type) { + if (type == "op" && content == ".") return cont(); + if (content == "to") {cx.marked = "keyword"; return cont(pattern);} + else return pass(); + } + function altbody(type) { + if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex); + return pass(); + } + function altblock1(type) { + if (type == "}") return cont(); + if (type == "|") return cont(altblock1); + if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);} + if (type.match(/[\]\);,]/)) return cont(altblock1); + return pass(pattern, altblock2); + } + function altblock2(type) { + if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1); + else return pass(altblock1); + } + + function macro(type) { + if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression); + return pass(); + } + function matchBrackets(type, comb) { + if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex); + if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex); + if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex); + return cont(); + } + + function parse(state, stream, style) { + var cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; + + while (true) { + var combinator = cc.length ? cc.pop() : block; + if (combinator(tcat)) { + while(cc.length && cc[cc.length - 1].lex) + cc.pop()(); + return cx.marked || style; + } + } + } + + return { + startState: function() { + return { + tokenize: tokenBase, + cc: [], + lexical: {indented: -indentUnit, column: 0, type: "top", align: false}, + keywords: valKeywords, + indented: 0 + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = false; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + tcat = content = null; + var style = state.tokenize(stream, state); + if (style == "comment") return style; + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = true; + if (tcat == "prefix") return style; + if (!content) content = stream.current(); + return parse(state, stream, style); + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, + type = lexical.type, closing = firstChar == type; + if (type == "stat") return lexical.indented + indentUnit; + if (lexical.align) return lexical.column + (closing ? 0 : 1); + return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit)); + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-rustsrc", "rust"); diff --git a/conlite/external/codemirror/mode/scheme/index.html b/conlite/external/codemirror/mode/scheme/index.html new file mode 100644 index 0000000..2a6105f --- /dev/null +++ b/conlite/external/codemirror/mode/scheme/index.html @@ -0,0 +1,64 @@ + + + + CodeMirror: Scheme mode + + + + + + + +

CodeMirror: Scheme mode

+
+ + +

MIME types defined: text/x-scheme.

+ + + diff --git a/conlite/external/codemirror/mode/scheme/scheme.js b/conlite/external/codemirror/mode/scheme/scheme.js new file mode 100644 index 0000000..f981b23 --- /dev/null +++ b/conlite/external/codemirror/mode/scheme/scheme.js @@ -0,0 +1,230 @@ +/** + * Author: Koh Zi Han, based on implementation by Koh Zi Chun + */ +CodeMirror.defineMode("scheme", function (config, mode) { + var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", + ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword"; + var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1; + + function makeKeywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"); + var indentKeys = makeKeywords("define let letrec let* lambda"); + + function stateStack(indent, type, prev) { // represents a state stack object + this.indent = indent; + this.type = type; + this.prev = prev; + } + + function pushStack(state, indent, type) { + state.indentStack = new stateStack(indent, type, state.indentStack); + } + + function popStack(state) { + state.indentStack = state.indentStack.prev; + } + + var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i); + var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i); + var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i); + var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i); + + function isBinaryNumber (stream) { + return stream.match(binaryMatcher); + } + + function isOctalNumber (stream) { + return stream.match(octalMatcher); + } + + function isDecimalNumber (stream, backup) { + if (backup === true) { + stream.backUp(1); + } + return stream.match(decimalMatcher); + } + + function isHexNumber (stream) { + return stream.match(hexMatcher); + } + + return { + startState: function () { + return { + indentStack: null, + indentation: 0, + mode: false, + sExprComment: false + }; + }, + + token: function (stream, state) { + if (state.indentStack == null && stream.sol()) { + // update indentation, but only if indentStack is empty + state.indentation = stream.indentation(); + } + + // skip spaces + if (stream.eatSpace()) { + return null; + } + var returnType = null; + + switch(state.mode){ + case "string": // multi-line string parsing mode + var next, escaped = false; + while ((next = stream.next()) != null) { + if (next == "\"" && !escaped) { + + state.mode = false; + break; + } + escaped = !escaped && next == "\\"; + } + returnType = STRING; // continue on in scheme-string mode + break; + case "comment": // comment parsing mode + var next, maybeEnd = false; + while ((next = stream.next()) != null) { + if (next == "#" && maybeEnd) { + + state.mode = false; + break; + } + maybeEnd = (next == "|"); + } + returnType = COMMENT; + break; + case "s-expr-comment": // s-expr commenting mode + state.mode = false; + if(stream.peek() == "(" || stream.peek() == "["){ + // actually start scheme s-expr commenting mode + state.sExprComment = 0; + }else{ + // if not we just comment the entire of the next token + stream.eatWhile(/[^/s]/); // eat non spaces + returnType = COMMENT; + break; + } + default: // default parsing mode + var ch = stream.next(); + + if (ch == "\"") { + state.mode = "string"; + returnType = STRING; + + } else if (ch == "'") { + returnType = ATOM; + } else if (ch == '#') { + if (stream.eat("|")) { // Multi-line comment + state.mode = "comment"; // toggle to comment mode + returnType = COMMENT; + } else if (stream.eat(/[tf]/i)) { // #t/#f (atom) + returnType = ATOM; + } else if (stream.eat(';')) { // S-Expr comment + state.mode = "s-expr-comment"; + returnType = COMMENT; + } else { + var numTest = null, hasExactness = false, hasRadix = true; + if (stream.eat(/[ei]/i)) { + hasExactness = true; + } else { + stream.backUp(1); // must be radix specifier + } + if (stream.match(/^#b/i)) { + numTest = isBinaryNumber; + } else if (stream.match(/^#o/i)) { + numTest = isOctalNumber; + } else if (stream.match(/^#x/i)) { + numTest = isHexNumber; + } else if (stream.match(/^#d/i)) { + numTest = isDecimalNumber; + } else if (stream.match(/^[-+0-9.]/, false)) { + hasRadix = false; + numTest = isDecimalNumber; + // re-consume the intial # if all matches failed + } else if (!hasExactness) { + stream.eat('#'); + } + if (numTest != null) { + if (hasRadix && !hasExactness) { + // consume optional exactness after radix + stream.match(/^#[ei]/i); + } + if (numTest(stream)) + returnType = NUMBER; + } + } + } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal + returnType = NUMBER; + } else if (ch == ";") { // comment + stream.skipToEnd(); // rest of the line is a comment + returnType = COMMENT; + } else if (ch == "(" || ch == "[") { + var keyWord = ''; var indentTemp = stream.column(); + /** + Either + (indent-word .. + (non-indent-word .. + (;something else, bracket, etc. + */ + + while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) { + keyWord += letter; + } + + if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word + + pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); + } else { // non-indent word + // we continue eating the spaces + stream.eatSpace(); + if (stream.eol() || stream.peek() == ";") { + // nothing significant after + // we restart indentation 1 space after + pushStack(state, indentTemp + 1, ch); + } else { + pushStack(state, indentTemp + stream.current().length, ch); // else we match + } + } + stream.backUp(stream.current().length - 1); // undo all the eating + + if(typeof state.sExprComment == "number") state.sExprComment++; + + returnType = BRACKET; + } else if (ch == ")" || ch == "]") { + returnType = BRACKET; + if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) { + popStack(state); + + if(typeof state.sExprComment == "number"){ + if(--state.sExprComment == 0){ + returnType = COMMENT; // final closing bracket + state.sExprComment = false; // turn off s-expr commenting mode + } + } + } + } else { + stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/); + + if (keywords && keywords.propertyIsEnumerable(stream.current())) { + returnType = BUILTIN; + } else returnType = "variable"; + } + } + return (typeof state.sExprComment == "number") ? COMMENT : returnType; + }, + + indent: function (state, textAfter) { + if (state.indentStack == null) return state.indentation; + return state.indentStack.indent; + } + }; +}); + +CodeMirror.defineMIME("text/x-scheme", "scheme"); diff --git a/conlite/external/codemirror/mode/shell/index.html b/conlite/external/codemirror/mode/shell/index.html new file mode 100644 index 0000000..2d6d084 --- /dev/null +++ b/conlite/external/codemirror/mode/shell/index.html @@ -0,0 +1,50 @@ + + +CodeMirror: Shell mode + + + + + + + + + +

CodeMirror: Shell mode

+ + + + + +

MIME types defined: text/x-sh.

diff --git a/conlite/external/codemirror/mode/shell/shell.js b/conlite/external/codemirror/mode/shell/shell.js new file mode 100644 index 0000000..df77131 --- /dev/null +++ b/conlite/external/codemirror/mode/shell/shell.js @@ -0,0 +1,118 @@ +CodeMirror.defineMode('shell', function(config) { + + var words = {}; + function define(style, string) { + var split = string.split(' '); + for(var i = 0; i < split.length; i++) { + words[split[i]] = style; + } + }; + + // Atoms + define('atom', 'true false'); + + // Keywords + define('keyword', 'if then do else elif while until for in esac fi fin ' + + 'fil done exit set unset export function'); + + // Commands + define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' + + 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' + + 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' + + 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' + + 'touch vi vim wall wc wget who write yes zsh'); + + function tokenBase(stream, state) { + + var sol = stream.sol(); + var ch = stream.next(); + + if (ch === '\'' || ch === '"' || ch === '`') { + state.tokens.unshift(tokenString(ch)); + return tokenize(stream, state); + } + if (ch === '#') { + if (sol && stream.eat('!')) { + stream.skipToEnd(); + return 'meta'; // 'comment'? + } + stream.skipToEnd(); + return 'comment'; + } + if (ch === '$') { + state.tokens.unshift(tokenDollar); + return tokenize(stream, state); + } + if (ch === '+' || ch === '=') { + return 'operator'; + } + if (ch === '-') { + stream.eat('-'); + stream.eatWhile(/\w/); + return 'attribute'; + } + if (/\d/.test(ch)) { + stream.eatWhile(/\d/); + if(!/\w/.test(stream.peek())) { + return 'number'; + } + } + stream.eatWhile(/\w/); + var cur = stream.current(); + if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; + return words[cur] || null; + } + + function tokenString(quote) { + return function(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === quote && !escaped) { + end = true; + break; + } + if (next === '$' && !escaped && quote !== '\'') { + escaped = true; + stream.backUp(1); + state.tokens.unshift(tokenDollar); + break; + } + escaped = !escaped && next === '\\'; + } + if (end || !escaped) { + state.tokens.shift(); + } + return (quote === '`' || quote === ')' ? 'quote' : 'string'); + }; + }; + + var tokenDollar = function(stream, state) { + if (state.tokens.length > 1) stream.eat('$'); + var ch = stream.next(), hungry = /\w/; + if (ch === '{') hungry = /[^}]/; + if (ch === '(') { + state.tokens[0] = tokenString(')'); + return tokenize(stream, state); + } + if (!/\d/.test(ch)) { + stream.eatWhile(hungry); + stream.eat('}'); + } + state.tokens.shift(); + return 'def'; + }; + + function tokenize(stream, state) { + return (state.tokens[0] || tokenBase) (stream, state); + }; + + return { + startState: function() {return {tokens:[]}}, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME('text/x-sh', 'shell'); diff --git a/conlite/external/codemirror/mode/smalltalk/index.html b/conlite/external/codemirror/mode/smalltalk/index.html new file mode 100644 index 0000000..8a85c39 --- /dev/null +++ b/conlite/external/codemirror/mode/smalltalk/index.html @@ -0,0 +1,55 @@ + + + + CodeMirror: Smalltalk mode + + + + + + + +

CodeMirror: Smalltalk mode

+ +
+ + + +

Simple Smalltalk mode.

+ +

MIME types defined: text/x-stsrc.

+ + diff --git a/conlite/external/codemirror/mode/smalltalk/smalltalk.js b/conlite/external/codemirror/mode/smalltalk/smalltalk.js new file mode 100644 index 0000000..e589332 --- /dev/null +++ b/conlite/external/codemirror/mode/smalltalk/smalltalk.js @@ -0,0 +1,139 @@ +CodeMirror.defineMode('smalltalk', function(config, modeConfig) { + + var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/; + var keywords = /true|false|nil|self|super|thisContext/; + + var Context = function(tokenizer, parent) { + this.next = tokenizer; + this.parent = parent; + }; + + var Token = function(name, context, eos) { + this.name = name; + this.context = context; + this.eos = eos; + }; + + var State = function() { + this.context = new Context(next, null); + this.expectVariable = true; + this.indentation = 0; + this.userIndentationDelta = 0; + }; + + State.prototype.userIndent = function(indentation) { + this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0; + }; + + var next = function(stream, context, state) { + var token = new Token(null, context, false); + var aChar = stream.next(); + + if (aChar === '"') { + token = nextComment(stream, new Context(nextComment, context)); + + } else if (aChar === '\'') { + token = nextString(stream, new Context(nextString, context)); + + } else if (aChar === '#') { + stream.eatWhile(/[^ .]/); + token.name = 'string-2'; + + } else if (aChar === '$') { + stream.eatWhile(/[^ ]/); + token.name = 'string-2'; + + } else if (aChar === '|' && state.expectVariable) { + token.context = new Context(nextTemporaries, context); + + } else if (/[\[\]{}()]/.test(aChar)) { + token.name = 'bracket'; + token.eos = /[\[{(]/.test(aChar); + + if (aChar === '[') { + state.indentation++; + } else if (aChar === ']') { + state.indentation = Math.max(0, state.indentation - 1); + } + + } else if (specialChars.test(aChar)) { + stream.eatWhile(specialChars); + token.name = 'operator'; + token.eos = aChar !== ';'; // ; cascaded message expression + + } else if (/\d/.test(aChar)) { + stream.eatWhile(/[\w\d]/); + token.name = 'number' + + } else if (/[\w_]/.test(aChar)) { + stream.eatWhile(/[\w\d_]/); + token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null; + + } else { + token.eos = state.expectVariable; + } + + return token; + }; + + var nextComment = function(stream, context) { + stream.eatWhile(/[^"]/); + return new Token('comment', stream.eat('"') ? context.parent : context, true); + }; + + var nextString = function(stream, context) { + stream.eatWhile(/[^']/); + return new Token('string', stream.eat('\'') ? context.parent : context, false); + }; + + var nextTemporaries = function(stream, context, state) { + var token = new Token(null, context, false); + var aChar = stream.next(); + + if (aChar === '|') { + token.context = context.parent; + token.eos = true; + + } else { + stream.eatWhile(/[^|]/); + token.name = 'variable'; + } + + return token; + } + + return { + startState: function() { + return new State; + }, + + token: function(stream, state) { + state.userIndent(stream.indentation()); + + if (stream.eatSpace()) { + return null; + } + + var token = state.context.next(stream, state.context, state); + state.context = token.context; + state.expectVariable = token.eos; + + state.lastToken = token; + return token.name; + }, + + blankLine: function(state) { + state.userIndent(0); + }, + + indent: function(state, textAfter) { + var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta; + return (state.indentation + i) * config.indentUnit; + }, + + electricChars: ']' + }; + +}); + +CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'}); \ No newline at end of file diff --git a/conlite/external/codemirror/mode/smarty/index.html b/conlite/external/codemirror/mode/smarty/index.html new file mode 100644 index 0000000..ad4dccf --- /dev/null +++ b/conlite/external/codemirror/mode/smarty/index.html @@ -0,0 +1,82 @@ + + + + CodeMirror: Smarty mode + + + + + + + +

CodeMirror: Smarty mode

+ +
+ + + +
+ +
+ + + +

A plain text/Smarty mode which allows for custom delimiter tags (defaults to { and }).

+ +

MIME types defined: text/x-smarty

+ + diff --git a/conlite/external/codemirror/mode/smarty/smarty.js b/conlite/external/codemirror/mode/smarty/smarty.js new file mode 100644 index 0000000..9da7da6 --- /dev/null +++ b/conlite/external/codemirror/mode/smarty/smarty.js @@ -0,0 +1,148 @@ +CodeMirror.defineMode("smarty", function(config, parserConfig) { + var keyFuncs = ["debug", "extends", "function", "include", "literal"]; + var last; + var regs = { + operatorChars: /[+\-*&%=<>!?]/, + validIdentifier: /[a-zA-Z0-9\_]/, + stringChar: /[\'\"]/ + } + var leftDelim = (typeof config.mode.leftDelimiter != 'undefined') ? config.mode.leftDelimiter : "{"; + var rightDelim = (typeof config.mode.rightDelimiter != 'undefined') ? config.mode.rightDelimiter : "}"; + function ret(style, lst) { last = lst; return style; } + + + function tokenizer(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } + + if (stream.match(leftDelim, true)) { + if (stream.eat("*")) { + return chain(inBlock("comment", "*" + rightDelim)); + } + else { + state.tokenize = inSmarty; + return "tag"; + } + } + else { + // I'd like to do an eatWhile() here, but I can't get it to eat only up to the rightDelim string/char + stream.next(); + return null; + } + } + + function inSmarty(stream, state) { + if (stream.match(rightDelim, true)) { + state.tokenize = tokenizer; + return ret("tag", null); + } + + var ch = stream.next(); + if (ch == "$") { + stream.eatWhile(regs.validIdentifier); + return ret("variable-2", "variable"); + } + else if (ch == ".") { + return ret("operator", "property"); + } + else if (regs.stringChar.test(ch)) { + state.tokenize = inAttribute(ch); + return ret("string", "string"); + } + else if (regs.operatorChars.test(ch)) { + stream.eatWhile(regs.operatorChars); + return ret("operator", "operator"); + } + else if (ch == "[" || ch == "]") { + return ret("bracket", "bracket"); + } + else if (/\d/.test(ch)) { + stream.eatWhile(/\d/); + return ret("number", "number"); + } + else { + if (state.last == "variable") { + if (ch == "@") { + stream.eatWhile(regs.validIdentifier); + return ret("property", "property"); + } + else if (ch == "|") { + stream.eatWhile(regs.validIdentifier); + return ret("qualifier", "modifier"); + } + } + else if (state.last == "whitespace") { + stream.eatWhile(regs.validIdentifier); + return ret("attribute", "modifier"); + } + else if (state.last == "property") { + stream.eatWhile(regs.validIdentifier); + return ret("property", null); + } + else if (/\s/.test(ch)) { + last = "whitespace"; + return null; + } + + var str = ""; + if (ch != "/") { + str += ch; + } + var c = ""; + while ((c = stream.eat(regs.validIdentifier))) { + str += c; + } + var i, j; + for (i=0, j=keyFuncs.length; i + + + CodeMirror: SPARQL mode + + + + + + + +

CodeMirror: SPARQL mode

+
+ + +

MIME types defined: application/x-sparql-query.

+ + + diff --git a/conlite/external/codemirror/mode/sparql/sparql.js b/conlite/external/codemirror/mode/sparql/sparql.js new file mode 100644 index 0000000..ceb5294 --- /dev/null +++ b/conlite/external/codemirror/mode/sparql/sparql.js @@ -0,0 +1,143 @@ +CodeMirror.defineMode("sparql", function(config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", + "isblank", "isliteral", "union", "a"]); + var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe", + "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional", + "graph", "by", "asc", "desc"]); + var operatorChars = /[*+\-<>=&|]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "$" || ch == "?") { + stream.match(/^[\w\d]*/); + return "variable-2"; + } + else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } + else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return null; + } + else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return null; + } + else if (ch == ":") { + stream.eatWhile(/[\w\d\._\-]/); + return "atom"; + } + else { + stream.eatWhile(/[_\w\d]/); + if (stream.eat(":")) { + stream.eatWhile(/[\w\d_\-]/); + return "atom"; + } + var word = stream.current(), type; + if (ops.test(word)) + return null; + else if (keywords.test(word)) + return "keyword"; + else + return "variable"; + } + } + + function tokenLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + context: null, + indent: 0, + col: 0}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } + else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function(state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + } + }; +}); + +CodeMirror.defineMIME("application/x-sparql-query", "sparql"); diff --git a/conlite/external/codemirror/mode/stex/index.html b/conlite/external/codemirror/mode/stex/index.html new file mode 100644 index 0000000..e49289e --- /dev/null +++ b/conlite/external/codemirror/mode/stex/index.html @@ -0,0 +1,95 @@ + + + + CodeMirror: sTeX mode + + + + + + + +

CodeMirror: sTeX mode

+
+ + +

MIME types defined: text/x-stex.

+ + + diff --git a/conlite/external/codemirror/mode/stex/stex.js b/conlite/external/codemirror/mode/stex/stex.js new file mode 100644 index 0000000..2e2f026 --- /dev/null +++ b/conlite/external/codemirror/mode/stex/stex.js @@ -0,0 +1,182 @@ +/* + * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de) + * Licence: MIT + */ + +CodeMirror.defineMode("stex", function(cmCfg, modeCfg) +{ + function pushCommand(state, command) { + state.cmdState.push(command); + } + + function peekCommand(state) { + if (state.cmdState.length>0) + return state.cmdState[state.cmdState.length-1]; + else + return null; + } + + function popCommand(state) { + if (state.cmdState.length>0) { + var plug = state.cmdState.pop(); + plug.closeBracket(); + } + } + + function applyMostPowerful(state) { + var context = state.cmdState; + for (var i = context.length - 1; i >= 0; i--) { + var plug = context[i]; + if (plug.name=="DEFAULT") + continue; + return plug.styleIdentifier(); + } + return null; + } + + function addPluginPattern(pluginName, cmdStyle, brackets, styles) { + return function () { + this.name=pluginName; + this.bracketNo = 0; + this.style=cmdStyle; + this.styles = styles; + this.brackets = brackets; + + this.styleIdentifier = function(content) { + if (this.bracketNo<=this.styles.length) + return this.styles[this.bracketNo-1]; + else + return null; + }; + this.openBracket = function(content) { + this.bracketNo++; + return "bracket"; + }; + this.closeBracket = function(content) { + }; + } + } + + var plugins = new Array(); + + plugins["importmodule"] = addPluginPattern("importmodule", "tag", "{[", ["string", "builtin"]); + plugins["documentclass"] = addPluginPattern("documentclass", "tag", "{[", ["", "atom"]); + plugins["usepackage"] = addPluginPattern("documentclass", "tag", "[", ["atom"]); + plugins["begin"] = addPluginPattern("documentclass", "tag", "[", ["atom"]); + plugins["end"] = addPluginPattern("documentclass", "tag", "[", ["atom"]); + + plugins["DEFAULT"] = function () { + this.name="DEFAULT"; + this.style="tag"; + + this.styleIdentifier = function(content) { + }; + this.openBracket = function(content) { + }; + this.closeBracket = function(content) { + }; + }; + + function setState(state, f) { + state.f = f; + } + + function normal(source, state) { + if (source.match(/^\\[a-zA-Z@]+/)) { + var cmdName = source.current(); + cmdName = cmdName.substr(1, cmdName.length-1); + var plug; + if (plugins.hasOwnProperty(cmdName)) { + plug = plugins[cmdName]; + } else { + plug = plugins["DEFAULT"]; + } + plug = new plug(); + pushCommand(state, plug); + setState(state, beginParams); + return plug.style; + } + + // escape characters + if (source.match(/^\\[$&%#{}_]/)) { + return "tag"; + } + + // white space control characters + if (source.match(/^\\[,;!\/]/)) { + return "tag"; + } + + var ch = source.next(); + if (ch == "%") { + // special case: % at end of its own line; stay in same state + if (!source.eol()) { + setState(state, inCComment); + } + return "comment"; + } + else if (ch=='}' || ch==']') { + plug = peekCommand(state); + if (plug) { + plug.closeBracket(ch); + setState(state, beginParams); + } else + return "error"; + return "bracket"; + } else if (ch=='{' || ch=='[') { + plug = plugins["DEFAULT"]; + plug = new plug(); + pushCommand(state, plug); + return "bracket"; + } + else if (/\d/.test(ch)) { + source.eatWhile(/[\w.%]/); + return "atom"; + } + else { + source.eatWhile(/[\w-_]/); + return applyMostPowerful(state); + } + } + + function inCComment(source, state) { + source.skipToEnd(); + setState(state, normal); + return "comment"; + } + + function beginParams(source, state) { + var ch = source.peek(); + if (ch == '{' || ch == '[') { + var lastPlug = peekCommand(state); + var style = lastPlug.openBracket(ch); + source.eat(ch); + setState(state, normal); + return "bracket"; + } + if (/[ \t\r]/.test(ch)) { + source.eat(ch); + return null; + } + setState(state, normal); + lastPlug = peekCommand(state); + if (lastPlug) { + popCommand(state); + } + return normal(source, state); + } + + return { + startState: function() { return { f:normal, cmdState:[] }; }, + copyState: function(s) { return { f: s.f, cmdState: s.cmdState.slice(0, s.cmdState.length) }; }, + + token: function(stream, state) { + var t = state.f(stream, state); + var w = stream.current(); + return t; + } + }; +}); + +CodeMirror.defineMIME("text/x-stex", "stex"); +CodeMirror.defineMIME("text/x-latex", "stex"); diff --git a/conlite/external/codemirror/mode/stex/test.html b/conlite/external/codemirror/mode/stex/test.html new file mode 100644 index 0000000..a60f418 --- /dev/null +++ b/conlite/external/codemirror/mode/stex/test.html @@ -0,0 +1,263 @@ + + + + CodeMirror: sTeX mode + + + + + + + + +

Tests for the sTeX Mode

+

Basics

+ + +

Tags

+ + +

Comments

+ + +

Errors

+ + +

Character Escapes

+ + +

Spacing control

+ + + +

New Commands

+ + Should be able to define a new command that happens to be a method on Array + (e.g. pop): + + +

Summary

+ + + + + diff --git a/conlite/external/codemirror/mode/tiddlywiki/index.html b/conlite/external/codemirror/mode/tiddlywiki/index.html new file mode 100644 index 0000000..2f7da0e --- /dev/null +++ b/conlite/external/codemirror/mode/tiddlywiki/index.html @@ -0,0 +1,140 @@ + + + + CodeMirror: TiddlyWiki mode + + + + + + + + +

CodeMirror: TiddlyWiki mode

+ +
+ + + +

TiddlyWiki mode supports a single configuration.

+ +

MIME types defined: text/x-tiddlywiki.

+ + diff --git a/conlite/external/codemirror/mode/tiddlywiki/tiddlywiki.css b/conlite/external/codemirror/mode/tiddlywiki/tiddlywiki.css new file mode 100644 index 0000000..9a69b63 --- /dev/null +++ b/conlite/external/codemirror/mode/tiddlywiki/tiddlywiki.css @@ -0,0 +1,14 @@ +span.cm-underlined { + text-decoration: underline; +} +span.cm-strikethrough { + text-decoration: line-through; +} +span.cm-brace { + color: #170; + font-weight: bold; +} +span.cm-table { + color: blue; + font-weight: bold; +} diff --git a/conlite/external/codemirror/mode/tiddlywiki/tiddlywiki.js b/conlite/external/codemirror/mode/tiddlywiki/tiddlywiki.js new file mode 100644 index 0000000..74fcd49 --- /dev/null +++ b/conlite/external/codemirror/mode/tiddlywiki/tiddlywiki.js @@ -0,0 +1,384 @@ +/*** +|''Name''|tiddlywiki.js| +|''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror| +|''Author''|PMario| +|''Version''|0.1.7| +|''Status''|''stable''| +|''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| +|''Documentation''|http://codemirror.tiddlyspace.com/| +|''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]| +|''CoreVersion''|2.5.0| +|''Requires''|codemirror.js| +|''Keywords''|syntax highlighting color code mirror codemirror| +! Info +CoreVersion parameter is needed for TiddlyWiki only! +***/ +//{{{ +CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { + var indentUnit = config.indentUnit; + + // Tokenizer + var textwords = function () { + function kw(type) { + return { + type: type, + style: "text" + }; + } + return {}; + }(); + + var keywords = function () { + function kw(type) { + return { type: type, style: "macro"}; + } + return { + "allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'), + "newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'), + "permaview": kw('permaview'), "saveChanges": kw('saveChanges'), + "search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'), + "tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'), + "tiddler": kw('tiddler'), "timeline": kw('timeline'), + "today": kw('today'), "version": kw('version'), "option": kw('option'), + + "with": kw('with'), + "filter": kw('filter') + }; + }(); + + var isSpaceName = /[\w_\-]/i, + reHR = /^\-\-\-\-+$/, //
+ reWikiCommentStart = /^\/\*\*\*$/, // /*** + reWikiCommentStop = /^\*\*\*\/$/, // ***/ + reBlockQuote = /^<<<$/, + + reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start + reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop + reXmlCodeStart = /^$/, // xml block start + reXmlCodeStop = /^$/, // xml stop + + reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start + reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop + + reCodeStart = /\{\{\{/, // {{{ code span start + reUntilCodeStop = /.*?\}\}\}/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + // used for strings + function nextUntilUnescaped(stream, end) { + var escaped = false, + next; + while ((next = stream.next()) != null) { + if (next == end && !escaped) return false; + escaped = !escaped && next == "\\"; + } + return escaped; + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; + content = cont; + return style; + } + + function jsTokenBase(stream, state) { + var sol = stream.sol(), + ch, tch; + + state.block = false; // indicates the start of a code block. + + ch = stream.peek(); // don't eat, to make matching simpler + + // check start of blocks + if (sol && /[<\/\*{}\-]/.test(ch)) { + if (stream.match(reCodeBlockStart)) { + state.block = true; + return chain(stream, state, twTokenCode); + } + if (stream.match(reBlockQuote)) { + return ret('quote', 'quote'); + } + if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) { + return ret('code', 'comment'); + } + if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) { + return ret('code', 'comment'); + } + if (stream.match(reHR)) { + return ret('hr', 'hr'); + } + } // sol + ch = stream.next(); + + if (sol && /[\/\*!#;:>|]/.test(ch)) { + if (ch == "!") { // tw header + stream.skipToEnd(); + return ret("header", "header"); + } + if (ch == "*") { // tw list + stream.eatWhile('*'); + return ret("list", "comment"); + } + if (ch == "#") { // tw numbered list + stream.eatWhile('#'); + return ret("list", "comment"); + } + if (ch == ";") { // definition list, term + stream.eatWhile(';'); + return ret("list", "comment"); + } + if (ch == ":") { // definition list, description + stream.eatWhile(':'); + return ret("list", "comment"); + } + if (ch == ">") { // single line quote + stream.eatWhile(">"); + return ret("quote", "quote"); + } + if (ch == '|') { + return ret('table', 'header'); + } + } + + if (ch == '{' && stream.match(/\{\{/)) { + return chain(stream, state, twTokenCode); + } + + // rudimentary html:// file:// link matching. TW knows much more ... + if (/[hf]/i.test(ch)) { + if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) { + return ret("link", "link"); + } + } + // just a little string indicator, don't want to have the whole string covered + if (ch == '"') { + return ret('string', 'string'); + } + if (ch == '~') { // _no_ CamelCase indicator should be bold + return ret('text', 'brace'); + } + if (/[\[\]]/.test(ch)) { // check for [[..]] + if (stream.peek() == ch) { + stream.next(); + return ret('brace', 'brace'); + } + } + if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting + stream.eatWhile(isSpaceName); + return ret("link", "link"); + } + if (/\d/.test(ch)) { // numbers + stream.eatWhile(/\d/); + return ret("number", "number"); + } + if (ch == "/") { // tw invisible comment + if (stream.eat("%")) { + return chain(stream, state, twTokenComment); + } + else if (stream.eat("/")) { // + return chain(stream, state, twTokenEm); + } + } + if (ch == "_") { // tw underline + if (stream.eat("_")) { + return chain(stream, state, twTokenUnderline); + } + } + // strikethrough and mdash handling + if (ch == "-") { + if (stream.eat("-")) { + // if strikethrough looks ugly, change CSS. + if (stream.peek() != ' ') + return chain(stream, state, twTokenStrike); + // mdash + if (stream.peek() == ' ') + return ret('text', 'brace'); + } + } + if (ch == "'") { // tw bold + if (stream.eat("'")) { + return chain(stream, state, twTokenStrong); + } + } + if (ch == "<") { // tw macro + if (stream.eat("<")) { + return chain(stream, state, twTokenMacro); + } + } + else { + return ret(ch); + } + + // core macro handling + stream.eatWhile(/[\w\$_]/); + var word = stream.current(), + known = textwords.propertyIsEnumerable(word) && textwords[word]; + + return known ? ret(known.type, known.style, word) : ret("text", null, word); + + } // jsTokenBase() + + function twTokenString(quote) { + return function (stream, state) { + if (!nextUntilUnescaped(stream, quote)) state.tokenize = jsTokenBase; + return ret("string", "string"); + }; + } + + // tw invisible comment + function twTokenComment(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "%"); + } + return ret("comment", "comment"); + } + + // tw strong / bold + function twTokenStrong(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "'" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "'"); + } + return ret("text", "strong"); + } + + // tw code + function twTokenCode(stream, state) { + var ch, sb = state.block; + + if (sb && stream.current()) { + return ret("code", "comment"); + } + + if (!sb && stream.match(reUntilCodeStop)) { + state.tokenize = jsTokenBase; + return ret("code", "comment"); + } + + if (sb && stream.sol() && stream.match(reCodeBlockStop)) { + state.tokenize = jsTokenBase; + return ret("code", "comment"); + } + + ch = stream.next(); + return (sb) ? ret("code", "comment") : ret("code", "comment"); + } + + // tw em / italic + function twTokenEm(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "/"); + } + return ret("text", "em"); + } + + // tw underlined text + function twTokenUnderline(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "_" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "_"); + } + return ret("text", "underlined"); + } + + // tw strike through text looks ugly + // change CSS if needed + function twTokenStrike(stream, state) { + var maybeEnd = false, + ch, nr; + + while (ch = stream.next()) { + if (ch == "-" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "-"); + } + return ret("text", "strikethrough"); + } + + // macro + function twTokenMacro(stream, state) { + var ch, tmp, word, known; + + if (stream.current() == '<<') { + return ret('brace', 'macro'); + } + + ch = stream.next(); + if (!ch) { + state.tokenize = jsTokenBase; + return ret(ch); + } + if (ch == ">") { + if (stream.peek() == '>') { + stream.next(); + state.tokenize = jsTokenBase; + return ret("brace", "macro"); + } + } + + stream.eatWhile(/[\w\$_]/); + word = stream.current(); + known = keywords.propertyIsEnumerable(word) && keywords[word]; + + if (known) { + return ret(known.type, known.style, word); + } + else { + return ret("macro", null, word); + } + } + + // Interface + return { + startState: function (basecolumn) { + return { + tokenize: jsTokenBase, + indented: 0, + level: 0 + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + }, + + electricChars: "" + }; +}); + +CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki"); +//}}} diff --git a/conlite/external/codemirror/mode/tiki/index.html b/conlite/external/codemirror/mode/tiki/index.html new file mode 100644 index 0000000..bf80040 --- /dev/null +++ b/conlite/external/codemirror/mode/tiki/index.html @@ -0,0 +1,82 @@ + + + CodeMirror: Tiki wiki mode + + + + + + + + +

CodeMirror: Tiki wiki mode

+ +
+ + + + + diff --git a/conlite/external/codemirror/mode/tiki/tiki.css b/conlite/external/codemirror/mode/tiki/tiki.css new file mode 100644 index 0000000..e3c3c0f --- /dev/null +++ b/conlite/external/codemirror/mode/tiki/tiki.css @@ -0,0 +1,26 @@ +.cm-tw-syntaxerror { + color: #FFFFFF; + background-color: #990000; +} + +.cm-tw-deleted { + text-decoration: line-through; +} + +.cm-tw-header5 { + font-weight: bold; +} +.cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ + padding-left: 10px; +} + +.cm-tw-box { + border-top-width: 0px ! important; + border-style: solid; + border-width: 1px; + border-color: inherit; +} + +.cm-tw-underline { + text-decoration: underline; +} \ No newline at end of file diff --git a/conlite/external/codemirror/mode/tiki/tiki.js b/conlite/external/codemirror/mode/tiki/tiki.js new file mode 100644 index 0000000..350dd51 --- /dev/null +++ b/conlite/external/codemirror/mode/tiki/tiki.js @@ -0,0 +1,316 @@ +CodeMirror.defineMode('tiki', function(config, parserConfig) { + function inBlock(style, terminator, returnTokenizer) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + + if (returnTokenizer) state.tokenize = returnTokenizer; + + return style; + }; + } + + function inLine(style, terminator) { + return function(stream, state) { + while(!stream.eol()) { + stream.next() + } + state.tokenize = inText; + return style; + }; + } + + function inText(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } + + var sol = stream.sol(); + var ch = stream.next(); + + //non start of line + switch (ch) { //switch is generally much faster than if, so it is used here + case "{": //plugin + type = stream.eat("/") ? "closeTag" : "openTag"; + stream.eatSpace(); + tagName = ""; + var c; + while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; + state.tokenize = inPlugin; + return "tag"; + break; + case "_": //bold + if (stream.eat("_")) { + return chain(inBlock("strong", "__", inText)); + } + break; + case "'": //italics + if (stream.eat("'")) { + // Italic text + return chain(inBlock("em", "''", inText)); + } + break; + case "(":// Wiki Link + if (stream.eat("(")) { + return chain(inBlock("variable-2", "))", inText)); + } + break; + case "[":// Weblink + return chain(inBlock("variable-3", "]", inText)); + break; + case "|": //table + if (stream.eat("|")) { + return chain(inBlock("comment", "||")); + } + break; + case "-": + if (stream.eat("=")) {//titleBar + return chain(inBlock("header string", "=-", inText)); + } else if (stream.eat("-")) {//deleted + return chain(inBlock("error tw-deleted", "--", inText)); + } + break; + case "=": //underline + if (stream.match("==")) { + return chain(inBlock("tw-underline", "===", inText)); + } + break; + case ":": + if (stream.eat(":")) { + return chain(inBlock("comment", "::")); + } + break; + case "^": //box + return chain(inBlock("tw-box", "^")); + break; + case "~": //np + if (stream.match("np~")) { + return chain(inBlock("meta", "~/np~")); + } + break; + } + + //start of line types + if (sol) { + switch (ch) { + case "!": //header at start of line + if (stream.match('!!!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!')) { + return chain(inLine("header string")); + } else { + return chain(inLine("header string")); + } + break; + case "*": //unordered list line item, or
  • at start of line + case "#": //ordered list line item, or
  • at start of line + case "+": //ordered list line item, or
  • at start of line + return chain(inLine("tw-listitem bracket")); + break; + } + } + + //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki + return null; + } + + var indentUnit = config.indentUnit; + + // Return variables for tokenizers + var pluginName, type; + function inPlugin(stream, state) { + var ch = stream.next(); + var peek = stream.peek(); + + if (ch == "}") { + state.tokenize = inText; + //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin + return "tag"; + } else if (ch == "(" || ch == ")") { + return "bracket"; + } else if (ch == "=") { + type = "equals"; + + if (peek == ">") { + ch = stream.next(); + peek = stream.peek(); + } + + //here we detect values directly after equal character with no quotes + if (!/[\'\"]/.test(peek)) { + state.tokenize = inAttributeNoQuote(); + } + //end detect values + + return "operator"; + } else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + return state.tokenize(stream, state); + } else { + stream.eatWhile(/[^\s\u00a0=\"\'\/?]/); + return "keyword"; + } + } + + function inAttribute(quote) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inPlugin; + break; + } + } + return "string"; + }; + } + + function inAttributeNoQuote() { + return function(stream, state) { + while (!stream.eol()) { + var ch = stream.next(); + var peek = stream.peek(); + if (ch == " " || ch == "," || /[ )}]/.test(peek)) { + state.tokenize = inPlugin; + break; + } + } + return "string"; + }; + } + + var curState, setStyle; + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); + } + + function cont() { + pass.apply(null, arguments); + return true; + } + + function pushContext(pluginName, startOfLine) { + var noIndent = curState.context && curState.context.noIndent; + curState.context = { + prev: curState.context, + pluginName: pluginName, + indent: curState.indented, + startOfLine: startOfLine, + noIndent: noIndent + }; + } + + function popContext() { + if (curState.context) curState.context = curState.context.prev; + } + + function element(type) { + if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));} + else if (type == "closePlugin") { + var err = false; + if (curState.context) { + err = curState.context.pluginName != pluginName; + popContext(); + } else { + err = true; + } + if (err) setStyle = "error"; + return cont(endcloseplugin(err)); + } + else if (type == "string") { + if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata"); + if (curState.tokenize == inText) popContext(); + return cont(); + } + else return cont(); + } + + function endplugin(startOfLine) { + return function(type) { + if ( + type == "selfclosePlugin" || + type == "endPlugin" + ) + return cont(); + if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();} + return cont(); + }; + } + + function endcloseplugin(err) { + return function(type) { + if (err) setStyle = "error"; + if (type == "endPlugin") return cont(); + return pass(); + } + } + + function attributes(type) { + if (type == "keyword") {setStyle = "attribute"; return cont(attributes);} + if (type == "equals") return cont(attvalue, attributes); + return pass(); + } + function attvalue(type) { + if (type == "keyword") {setStyle = "string"; return cont();} + if (type == "string") return cont(attvaluemaybe); + return pass(); + } + function attvaluemaybe(type) { + if (type == "string") return cont(attvaluemaybe); + else return pass(); + } + return { + startState: function() { + return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null}; + }, + token: function(stream, state) { + if (stream.sol()) { + state.startOfLine = true; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + + setStyle = type = pluginName = null; + var style = state.tokenize(stream, state); + if ((style || type) && style != "comment") { + curState = state; + while (true) { + var comb = state.cc.pop() || element; + if (comb(type || style)) break; + } + } + state.startOfLine = false; + return setStyle || style; + }, + indent: function(state, textAfter) { + var context = state.context; + if (context && context.noIndent) return 0; + if (context && /^{\//.test(textAfter)) + context = context.prev; + while (context && !context.startOfLine) + context = context.prev; + if (context) return context.indent + indentUnit; + else return 0; + }, + compareStates: function(a, b) { + if (a.indented != b.indented || a.pluginName != b.pluginName) return false; + for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) { + if (!ca || !cb) return ca == cb; + if (ca.pluginName != cb.pluginName) return false; + } + }, + electricChars: "/" + }; +}); + +//I figure, why not +CodeMirror.defineMIME("text/tiki", "tiki"); diff --git a/conlite/external/codemirror/mode/vb/LICENSE.txt b/conlite/external/codemirror/mode/vb/LICENSE.txt new file mode 100644 index 0000000..6083970 --- /dev/null +++ b/conlite/external/codemirror/mode/vb/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2012 Codility Limited, 107 Cheapside, London EC2V 6DN, UK + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/conlite/external/codemirror/mode/vb/index.html b/conlite/external/codemirror/mode/vb/index.html new file mode 100644 index 0000000..7c42be4 --- /dev/null +++ b/conlite/external/codemirror/mode/vb/index.html @@ -0,0 +1,88 @@ + + + CodeMirror: VB.NET mode + + + + + + + + + +

    CodeMirror: VB.NET mode

    + + + +
    + +
    +
    
    +  

    MIME type defined: text/x-vb.

    + + diff --git a/conlite/external/codemirror/mode/vb/vb.js b/conlite/external/codemirror/mode/vb/vb.js new file mode 100644 index 0000000..01f9890 --- /dev/null +++ b/conlite/external/codemirror/mode/vb/vb.js @@ -0,0 +1,260 @@ +CodeMirror.defineMode("vb", function(conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"); + var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); + var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); + var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); + var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + + var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property']; + var middleKeywords = ['else','elseif','case']; + var endKeywords = ['next','loop']; + + var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']); + var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until', + 'goto', 'byval','byref','new','handles','property', 'return', + 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false']; + var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single']; + + var keywords = wordRegexp(commonkeywords); + var types = wordRegexp(commontypes); + var stringPrefixes = '"'; + + var opening = wordRegexp(openingKeywords); + var middle = wordRegexp(middleKeywords); + var closing = wordRegexp(endKeywords); + var doubleClosing = wordRegexp(['end']); + var doOpening = wordRegexp(['do']); + + var indentInfo = null; + + + + + function indent(stream, state) { + state.currentIndent++; + } + + function dedent(stream, state) { + state.currentIndent--; + } + // tokenizers + function tokenBase(stream, state) { + if (stream.eatSpace()) { + return null; + } + + var ch = stream.peek(); + + // Handle Comments + if (ch === "'") { + stream.skipToEnd(); + return 'comment'; + } + + + // Handle Number Literals + if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; } + else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; } + else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; } + + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; } + // Octal + else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; } + // Decimal + else if (stream.match(/^[1-9]\d*F?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return 'number'; + } + } + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + // Handle operators and Delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { + return null; + } + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return null; + } + if (stream.match(doOpening)) { + indent(stream,state); + state.doInCurrentLine = true; + return 'keyword'; + } + if (stream.match(opening)) { + if (! state.doInCurrentLine) + indent(stream,state); + else + state.doInCurrentLine = false; + return 'keyword'; + } + if (stream.match(middle)) { + return 'keyword'; + } + + if (stream.match(doubleClosing)) { + dedent(stream,state); + dedent(stream,state); + return 'keyword'; + } + if (stream.match(closing)) { + dedent(stream,state); + return 'keyword'; + } + + if (stream.match(types)) { + return 'keyword'; + } + + if (stream.match(keywords)) { + return 'keyword'; + } + + if (stream.match(identifiers)) { + return 'variable'; + } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenStringFactory(delimiter) { + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + return function tokenString(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"]/); + if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } + } + return OUTCLASS; + }; + } + + + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current === '.') { + style = state.tokenize(stream, state); + current = stream.current(); + if (style === 'variable') { + return 'variable'; + } else { + return ERRORCLASS; + } + } + + + var delimiter_index = '[({'.indexOf(current); + if (delimiter_index !== -1) { + indent(stream, state ); + } + if (indentInfo === 'dedent') { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + delimiter_index = '])}'.indexOf(current); + if (delimiter_index !== -1) { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + + return style; + } + + var external = { + electricChars:"dDpPtTfFeE ", + startState: function(basecolumn) { + return { + tokenize: tokenBase, + lastToken: null, + currentIndent: 0, + nextLineIndent: 0, + doInCurrentLine: false + + + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + state.currentIndent += state.nextLineIndent; + state.nextLineIndent = 0; + state.doInCurrentLine = 0; + } + var style = tokenLexer(stream, state); + + state.lastToken = {style:style, content: stream.current()}; + + + + return style; + }, + + indent: function(state, textAfter) { + var trueText = textAfter.replace(/^\s+|\s+$/g, '') ; + if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1); + if(state.currentIndent < 0) return 0; + return state.currentIndent * conf.indentUnit; + } + + }; + return external; +}); + +CodeMirror.defineMIME("text/x-vb", "vb"); + diff --git a/conlite/external/codemirror/mode/vbscript/index.html b/conlite/external/codemirror/mode/vbscript/index.html new file mode 100644 index 0000000..dd207ca --- /dev/null +++ b/conlite/external/codemirror/mode/vbscript/index.html @@ -0,0 +1,42 @@ + + + + CodeMirror: VBScript mode + + + + + + + +

    CodeMirror: VBScript mode

    + +
    + + + +

    MIME types defined: text/vbscript.

    + + + diff --git a/conlite/external/codemirror/mode/vbscript/vbscript.js b/conlite/external/codemirror/mode/vbscript/vbscript.js new file mode 100644 index 0000000..65d6c21 --- /dev/null +++ b/conlite/external/codemirror/mode/vbscript/vbscript.js @@ -0,0 +1,26 @@ +CodeMirror.defineMode("vbscript", function() { + var regexVBScriptKeyword = /^(?:Call|Case|CDate|Clear|CInt|CLng|Const|CStr|Description|Dim|Do|Each|Else|ElseIf|End|Err|Error|Exit|False|For|Function|If|LCase|Loop|LTrim|Next|Nothing|Now|Number|On|Preserve|Quit|ReDim|Resume|RTrim|Select|Set|Sub|Then|To|Trim|True|UBound|UCase|Until|VbCr|VbCrLf|VbLf|VbTab)$/im; + + return { + token: function(stream) { + if (stream.eatSpace()) return null; + var ch = stream.next(); + if (ch == "'") { + stream.skipToEnd(); + return "comment"; + } + if (ch == '"') { + stream.skipTo('"'); + return "string"; + } + + if (/\w/.test(ch)) { + stream.eatWhile(/\w/); + if (regexVBScriptKeyword.test(stream.current())) return "keyword"; + } + return null; + } + }; +}); + +CodeMirror.defineMIME("text/vbscript", "vbscript"); diff --git a/conlite/external/codemirror/mode/velocity/index.html b/conlite/external/codemirror/mode/velocity/index.html new file mode 100644 index 0000000..49dba38 --- /dev/null +++ b/conlite/external/codemirror/mode/velocity/index.html @@ -0,0 +1,103 @@ + + + + CodeMirror: Velocity mode + + + + + + + + +

    CodeMirror: Velocity mode

    +
    + + +

    MIME types defined: text/velocity.

    + + + diff --git a/conlite/external/codemirror/mode/velocity/velocity.js b/conlite/external/codemirror/mode/velocity/velocity.js new file mode 100644 index 0000000..0b80c75 --- /dev/null +++ b/conlite/external/codemirror/mode/velocity/velocity.js @@ -0,0 +1,146 @@ +CodeMirror.defineMode("velocity", function(config) { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var indentUnit = config.indentUnit + var keywords = parseWords("#end #else #break #stop #[[ #]] " + + "#{end} #{else} #{break} #{stop}"); + var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " + + "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}"); + var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent $velocityCount"); + var isOperatorChar = /[+\-*&%=<>!?:\/|]/; + var multiLineStrings =true; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + // start of string? + if ((ch == '"' || ch == "'") && state.inParams) + return chain(stream, state, tokenString(ch)); + // is it one of the special signs []{}().,;? Seperator? + else if (/[\[\]{}\(\),;\.]/.test(ch)) { + if (ch == "(" && beforeParams) state.inParams = true; + else if (ch == ")") state.inParams = false; + return null; + } + // start of a number value? + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + // multi line comment? + else if (ch == "#" && stream.eat("*")) { + return chain(stream, state, tokenComment); + } + // unparsed content? + else if (ch == "#" && stream.match(/ *\[ *\[/)) { + return chain(stream, state, tokenUnparsed); + } + // single line comment? + else if (ch == "#" && stream.eat("#")) { + stream.skipToEnd(); + return "comment"; + } + // variable? + else if (ch == "$") { + stream.eatWhile(/[\w\d\$_\.{}]/); + // is it one of the specials? + if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) { + return "keyword"; + } + else { + state.beforeParams = true; + return "builtin"; + } + } + // is it a operator? + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + else { + // get the whole word + stream.eatWhile(/[\w\$_{}]/); + var word = stream.current().toLowerCase(); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + // is it one of the listed functions? + if (functions && functions.propertyIsEnumerable(word) || + stream.current().match(/^#[a-z0-9_]+ *$/i) && stream.peek()=="(") { + state.beforeParams = true; + return "keyword"; + } + // default: just a "word" + return null; + } + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end) state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == "]") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; + } + return "meta"; + } + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME("text/velocity", "velocity"); diff --git a/conlite/external/codemirror/mode/verilog/index.html b/conlite/external/codemirror/mode/verilog/index.html new file mode 100644 index 0000000..775dd53 --- /dev/null +++ b/conlite/external/codemirror/mode/verilog/index.html @@ -0,0 +1,210 @@ + + + + CodeMirror: Verilog mode + + + + + + + +

    CodeMirror: Verilog mode

    + +
    + + + +

    Simple mode that tries to handle Verilog-like languages as well as it + can. Takes one configuration parameters: keywords, an + object whose property names are the keywords in the language.

    + +

    MIME types defined: text/x-verilog (Verilog code).

    + + diff --git a/conlite/external/codemirror/mode/verilog/verilog.js b/conlite/external/codemirror/mode/verilog/verilog.js new file mode 100644 index 0000000..62700ce --- /dev/null +++ b/conlite/external/codemirror/mode/verilog/verilog.js @@ -0,0 +1,194 @@ +CodeMirror.defineMode("verilog", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords || {}, + blockKeywords = parserConfig.blockKeywords || {}, + atoms = parserConfig.atoms || {}, + hooks = parserConfig.hooks || {}, + multiLineStrings = parserConfig.multiLineStrings; + var isOperatorChar = /[&|~> + + + CodeMirror: XML mode + + + + + + + +

    CodeMirror: XML mode

    +
    + +

    The XML mode supports two configuration parameters:

    +
    +
    htmlMode (boolean)
    +
    This switches the mode to parse HTML instead of XML. This + means attributes do not have to be quoted, and some elements + (such as br) do not require a closing tag.
    +
    alignCDATA (boolean)
    +
    Setting this to true will force the opening tag of CDATA + blocks to not be indented.
    +
    + +

    MIME types defined: application/xml, text/html.

    + + diff --git a/conlite/external/codemirror/mode/xml/xml.js b/conlite/external/codemirror/mode/xml/xml.js new file mode 100644 index 0000000..060dad1 --- /dev/null +++ b/conlite/external/codemirror/mode/xml/xml.js @@ -0,0 +1,326 @@ +CodeMirror.defineMode("xml", function(config, parserConfig) { + var indentUnit = config.indentUnit; + var Kludges = parserConfig.htmlMode ? { + autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, + 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, + 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, + 'track': true, 'wbr': true}, + implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, + 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, + 'th': true, 'tr': true}, + contextGrabbers: { + 'dd': {'dd': true, 'dt': true}, + 'dt': {'dd': true, 'dt': true}, + 'li': {'li': true}, + 'option': {'option': true, 'optgroup': true}, + 'optgroup': {'optgroup': true}, + 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, + 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, + 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, + 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, + 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, + 'rp': {'rp': true, 'rt': true}, + 'rt': {'rp': true, 'rt': true}, + 'tbody': {'tbody': true, 'tfoot': true}, + 'td': {'td': true, 'th': true}, + 'tfoot': {'tbody': true}, + 'th': {'td': true, 'th': true}, + 'thead': {'tbody': true, 'tfoot': true}, + 'tr': {'tr': true} + }, + doNotIndent: {"pre": true}, + allowUnquoted: true, + allowMissing: false + } : { + autoSelfClosers: {}, + implicitlyClosed: {}, + contextGrabbers: {}, + doNotIndent: {}, + allowUnquoted: false, + allowMissing: false + }; + var alignCDATA = parserConfig.alignCDATA; + + // Return variables for tokenizers + var tagName, type; + + function inText(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } + + var ch = stream.next(); + if (ch == "<") { + if (stream.eat("!")) { + if (stream.eat("[")) { + if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); + else return null; + } + else if (stream.match("--")) return chain(inBlock("comment", "-->")); + else if (stream.match("DOCTYPE", true, true)) { + stream.eatWhile(/[\w\._\-]/); + return chain(doctype(1)); + } + else return null; + } + else if (stream.eat("?")) { + stream.eatWhile(/[\w\._\-]/); + state.tokenize = inBlock("meta", "?>"); + return "meta"; + } + else { + type = stream.eat("/") ? "closeTag" : "openTag"; + stream.eatSpace(); + tagName = ""; + var c; + while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c; + state.tokenize = inTag; + return "tag"; + } + } + else if (ch == "&") { + var ok; + if (stream.eat("#")) { + if (stream.eat("x")) { + ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); + } else { + ok = stream.eatWhile(/[\d]/) && stream.eat(";"); + } + } else { + ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); + } + return ok ? "atom" : "error"; + } + else { + stream.eatWhile(/[^&<]/); + return null; + } + } + + function inTag(stream, state) { + var ch = stream.next(); + if (ch == ">" || (ch == "/" && stream.eat(">"))) { + state.tokenize = inText; + type = ch == ">" ? "endTag" : "selfcloseTag"; + return "tag"; + } + else if (ch == "=") { + type = "equals"; + return null; + } + else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + return state.tokenize(stream, state); + } + else { + stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/); + return "word"; + } + } + + function inAttribute(quote) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inTag; + break; + } + } + return "string"; + }; + } + + function inBlock(style, terminator) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + return style; + }; + } + function doctype(depth) { + return function(stream, state) { + var ch; + while ((ch = stream.next()) != null) { + if (ch == "<") { + state.tokenize = doctype(depth + 1); + return state.tokenize(stream, state); + } else if (ch == ">") { + if (depth == 1) { + state.tokenize = inText; + break; + } else { + state.tokenize = doctype(depth - 1); + return state.tokenize(stream, state); + } + } + } + return "meta"; + }; + } + + var curState, setStyle; + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); + } + function cont() { + pass.apply(null, arguments); + return true; + } + + function pushContext(tagName, startOfLine) { + var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent); + curState.context = { + prev: curState.context, + tagName: tagName, + indent: curState.indented, + startOfLine: startOfLine, + noIndent: noIndent + }; + } + function popContext() { + if (curState.context) curState.context = curState.context.prev; + } + + function element(type) { + if (type == "openTag") { + curState.tagName = tagName; + return cont(attributes, endtag(curState.startOfLine)); + } else if (type == "closeTag") { + var err = false; + if (curState.context) { + if (curState.context.tagName != tagName) { + if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) { + popContext(); + } + err = !curState.context || curState.context.tagName != tagName; + } + } else { + err = true; + } + if (err) setStyle = "error"; + return cont(endclosetag(err)); + } + return cont(); + } + function endtag(startOfLine) { + return function(type) { + if (type == "selfcloseTag" || + (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase()))) { + maybePopContext(curState.tagName.toLowerCase()); + return cont(); + } + if (type == "endTag") { + maybePopContext(curState.tagName.toLowerCase()); + pushContext(curState.tagName, startOfLine); + return cont(); + } + return cont(); + }; + } + function endclosetag(err) { + return function(type) { + if (err) setStyle = "error"; + if (type == "endTag") { popContext(); return cont(); } + setStyle = "error"; + return cont(arguments.callee); + } + } + function maybePopContext(nextTagName) { + var parentTagName; + while (true) { + if (!curState.context) { + return; + } + parentTagName = curState.context.tagName.toLowerCase(); + if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) || + !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { + return; + } + popContext(); + } + } + + function attributes(type) { + if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);} + if (type == "endTag" || type == "selfcloseTag") return pass(); + setStyle = "error"; + return cont(attributes); + } + function attribute(type) { + if (type == "equals") return cont(attvalue, attributes); + if (!Kludges.allowMissing) setStyle = "error"; + return (type == "endTag" || type == "selfcloseTag") ? pass() : cont(); + } + function attvalue(type) { + if (type == "string") return cont(attvaluemaybe); + if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();} + setStyle = "error"; + return (type == "endTag" || type == "selfCloseTag") ? pass() : cont(); + } + function attvaluemaybe(type) { + if (type == "string") return cont(attvaluemaybe); + else return pass(); + } + + return { + startState: function() { + return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null}; + }, + + token: function(stream, state) { + if (stream.sol()) { + state.startOfLine = true; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + + setStyle = type = tagName = null; + var style = state.tokenize(stream, state); + state.type = type; + if ((style || type) && style != "comment") { + curState = state; + while (true) { + var comb = state.cc.pop() || element; + if (comb(type || style)) break; + } + } + state.startOfLine = false; + return setStyle || style; + }, + + indent: function(state, textAfter, fullLine) { + var context = state.context; + if ((state.tokenize != inTag && state.tokenize != inText) || + context && context.noIndent) + return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; + if (alignCDATA && / + + + CodeMirror: Pure XML mode + + + + + + + +

    CodeMirror: XML mode

    +
    + + +

    This is my XML parser, based on the original:

    +
      +
    • No html mode - this is pure xml
    • +
    • Illegal attributes and element names are errors
    • +
    • Attributes must have a value
    • +
    • XML declaration supported (e.g.: <?xml version="1.0" encoding="utf-8" standalone="no" ?>)
    • +
    • CDATA and comment blocks are not indented (except for their start-tag)
    • +
    • Better handling of errors per line with the state object - provides good infrastructure for extending it
    • +
    + +

    What's missing:

    +
      +
    • Make sure only a single root element exists at the document level
    • +
    • Multi-line attributes should NOT indent
    • +
    • Start tags are not painted red when they have no matching end tags (is this really wrong?)
    • +
    + +

    MIME types defined: application/xml, text/xml.

    + +

    @author: Dror BG (deebug.dev[at]gmail.com)
    +

    @date: August, 2011
    +

    @github: https://github.com/deebugger/CodeMirror2

    + +

    MIME types defined: application/xml, text/xml.

    + + diff --git a/conlite/external/codemirror/mode/xmlpure/xmlpure.js b/conlite/external/codemirror/mode/xmlpure/xmlpure.js new file mode 100644 index 0000000..6102f51 --- /dev/null +++ b/conlite/external/codemirror/mode/xmlpure/xmlpure.js @@ -0,0 +1,485 @@ +/** + * xmlpure.js + * + * Building upon and improving the CodeMirror 2 XML parser + * @author: Dror BG (deebug.dev@gmail.com) + * @date: August, 2011 + */ + +CodeMirror.defineMode("xmlpure", function(config, parserConfig) { + // constants + var STYLE_ERROR = "error"; + var STYLE_INSTRUCTION = "comment"; + var STYLE_COMMENT = "comment"; + var STYLE_ELEMENT_NAME = "tag"; + var STYLE_ATTRIBUTE = "attribute"; + var STYLE_WORD = "string"; + var STYLE_TEXT = "atom"; + + var TAG_INSTRUCTION = "!instruction"; + var TAG_CDATA = "!cdata"; + var TAG_COMMENT = "!comment"; + var TAG_TEXT = "!text"; + + var doNotIndent = { + "!cdata": true, + "!comment": true, + "!text": true, + "!instruction": true + }; + + // options + var indentUnit = config.indentUnit; + + /////////////////////////////////////////////////////////////////////////// + // helper functions + + // chain a parser to another parser + function chain(stream, state, parser) { + state.tokenize = parser; + return parser(stream, state); + } + + // parse a block (comment, CDATA or text) + function inBlock(style, terminator, nextTokenize) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + popContext(state); + state.tokenize = nextTokenize; + break; + } + stream.next(); + } + return style; + }; + } + + // go down a level in the document + // (hint: look at who calls this function to know what the contexts are) + function pushContext(state, tagName) { + var noIndent = doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.doIndent); + var newContext = { + tagName: tagName, + prev: state.context, + indent: state.context ? state.context.indent + indentUnit : 0, + lineNumber: state.lineNumber, + indented: state.indented, + noIndent: noIndent + }; + state.context = newContext; + } + + // go up a level in the document + function popContext(state) { + if (state.context) { + var oldContext = state.context; + state.context = oldContext.prev; + return oldContext; + } + + // we shouldn't be here - it means we didn't have a context to pop + return null; + } + + // return true if the current token is seperated from the tokens before it + // which means either this is the start of the line, or there is at least + // one space or tab character behind the token + // otherwise returns false + function isTokenSeparated(stream) { + return stream.sol() || + stream.string.charAt(stream.start - 1) == " " || + stream.string.charAt(stream.start - 1) == "\t"; + } + + /////////////////////////////////////////////////////////////////////////// + // context: document + // + // an XML document can contain: + // - a single declaration (if defined, it must be the very first line) + // - exactly one root element + // @todo try to actually limit the number of root elements to 1 + // - zero or more comments + function parseDocument(stream, state) { + if(stream.eat("<")) { + if(stream.eat("?")) { + // processing instruction + pushContext(state, TAG_INSTRUCTION); + state.tokenize = parseProcessingInstructionStartTag; + return STYLE_INSTRUCTION; + } else if(stream.match("!--")) { + // new context: comment + pushContext(state, TAG_COMMENT); + return chain(stream, state, inBlock(STYLE_COMMENT, "-->", parseDocument)); + } else if(stream.eatSpace() || stream.eol() ) { + stream.skipToEnd(); + return STYLE_ERROR; + } else { + // element + state.tokenize = parseElementTagName; + return STYLE_ELEMENT_NAME; + } + } + + // error on line + stream.skipToEnd(); + return STYLE_ERROR; + } + + /////////////////////////////////////////////////////////////////////////// + // context: XML element start-tag or end-tag + // + // - element start-tag can contain attributes + // - element start-tag may self-close (or start an element block if it doesn't) + // - element end-tag can contain only the tag name + function parseElementTagName(stream, state) { + // get the name of the tag + var startPos = stream.pos; + if(stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*/)) { + // element start-tag + var tagName = stream.string.substring(startPos, stream.pos); + pushContext(state, tagName); + state.tokenize = parseElement; + return STYLE_ELEMENT_NAME; + } else if(stream.match(/^\/[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*>/)) { + // element end-tag + var endTagName = stream.string.substring(startPos + 1, stream.pos - 1).trim(); + var oldContext = popContext(state); + state.tokenize = state.context == null ? parseDocument : parseElementBlock; + if(oldContext == null || endTagName != oldContext.tagName) { + // the start and end tag names should match - error + return STYLE_ERROR; + } + return STYLE_ELEMENT_NAME; + } else { + // no tag name - error + state.tokenize = state.context == null ? parseDocument : parseElementBlock; + stream.eatWhile(/[^>]/); + stream.eat(">"); + return STYLE_ERROR; + } + + stream.skipToEnd(); + return null; + } + + function parseElement(stream, state) { + if(stream.match(/^\/>/)) { + // self-closing tag + popContext(state); + state.tokenize = state.context == null ? parseDocument : parseElementBlock; + return STYLE_ELEMENT_NAME; + } else if(stream.eat(/^>/)) { + state.tokenize = parseElementBlock; + return STYLE_ELEMENT_NAME; + } else if(isTokenSeparated(stream) && stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*=/)) { + // attribute + state.tokenize = parseAttribute; + return STYLE_ATTRIBUTE; + } + + // no other options - this is an error + state.tokenize = state.context == null ? parseDocument : parseDocument; + stream.eatWhile(/[^>]/); + stream.eat(">"); + return STYLE_ERROR; + } + + /////////////////////////////////////////////////////////////////////////// + // context: attribute + // + // attribute values may contain everything, except: + // - the ending quote (with ' or ") - this marks the end of the value + // - the character "<" - should never appear + // - ampersand ("&") - unless it starts a reference: a string that ends with a semi-colon (";") + // ---> note: this parser is lax in what may be put into a reference string, + // ---> consult http://www.w3.org/TR/REC-xml/#NT-Reference if you want to make it tighter + function parseAttribute(stream, state) { + var quote = stream.next(); + if(quote != "\"" && quote != "'") { + // attribute must be quoted + stream.skipToEnd(); + state.tokenize = parseElement; + return STYLE_ERROR; + } + + state.tokParams.quote = quote; + state.tokenize = parseAttributeValue; + return STYLE_WORD; + } + + // @todo: find out whether this attribute value spans multiple lines, + // and if so, push a context for it in order not to indent it + // (or something of the sort..) + function parseAttributeValue(stream, state) { + var ch = ""; + while(!stream.eol()) { + ch = stream.next(); + if(ch == state.tokParams.quote) { + // end quote found + state.tokenize = parseElement; + return STYLE_WORD; + } else if(ch == "<") { + // can't have less-than signs in an attribute value, ever + stream.skipToEnd() + state.tokenize = parseElement; + return STYLE_ERROR; + } else if(ch == "&") { + // reference - look for a semi-colon, or return error if none found + ch = stream.next(); + + // make sure that semi-colon isn't right after the ampersand + if(ch == ';') { + stream.skipToEnd() + state.tokenize = parseElement; + return STYLE_ERROR; + } + + // make sure no less-than characters slipped in + while(!stream.eol() && ch != ";") { + if(ch == "<") { + // can't have less-than signs in an attribute value, ever + stream.skipToEnd() + state.tokenize = parseElement; + return STYLE_ERROR; + } + ch = stream.next(); + } + if(stream.eol() && ch != ";") { + // no ampersand found - error + stream.skipToEnd(); + state.tokenize = parseElement; + return STYLE_ERROR; + } + } + } + + // attribute value continues to next line + return STYLE_WORD; + } + + /////////////////////////////////////////////////////////////////////////// + // context: element block + // + // a block can contain: + // - elements + // - text + // - CDATA sections + // - comments + function parseElementBlock(stream, state) { + if(stream.eat("<")) { + if(stream.match("?")) { + pushContext(state, TAG_INSTRUCTION); + state.tokenize = parseProcessingInstructionStartTag; + return STYLE_INSTRUCTION; + } else if(stream.match("!--")) { + // new context: comment + pushContext(state, TAG_COMMENT); + return chain(stream, state, inBlock(STYLE_COMMENT, "-->", + state.context == null ? parseDocument : parseElementBlock)); + } else if(stream.match("![CDATA[")) { + // new context: CDATA section + pushContext(state, TAG_CDATA); + return chain(stream, state, inBlock(STYLE_TEXT, "]]>", + state.context == null ? parseDocument : parseElementBlock)); + } else if(stream.eatSpace() || stream.eol() ) { + stream.skipToEnd(); + return STYLE_ERROR; + } else { + // element + state.tokenize = parseElementTagName; + return STYLE_ELEMENT_NAME; + } + } else { + // new context: text + pushContext(state, TAG_TEXT); + state.tokenize = parseText; + return null; + } + + state.tokenize = state.context == null ? parseDocument : parseElementBlock; + stream.skipToEnd(); + return null; + } + + function parseText(stream, state) { + stream.eatWhile(/[^<]/); + if(!stream.eol()) { + // we cannot possibly be in the document context, + // just inside an element block + popContext(state); + state.tokenize = parseElementBlock; + } + return STYLE_TEXT; + } + + /////////////////////////////////////////////////////////////////////////// + // context: XML processing instructions + // + // XML processing instructions (PIs) allow documents to contain instructions for applications. + // PI format: + // - 'name' can be anything other than 'xml' (case-insensitive) + // - 'data' can be anything which doesn't contain '?>' + // XML declaration is a special PI (see XML declaration context below) + function parseProcessingInstructionStartTag(stream, state) { + if(stream.match("xml", true, true)) { + // xml declaration + if(state.lineNumber > 1 || stream.pos > 5) { + state.tokenize = parseDocument; + stream.skipToEnd(); + return STYLE_ERROR; + } else { + state.tokenize = parseDeclarationVersion; + return STYLE_INSTRUCTION; + } + } + + // regular processing instruction + if(isTokenSeparated(stream) || stream.match("?>")) { + // we have a space after the start-tag, or nothing but the end-tag + // either way - error! + state.tokenize = parseDocument; + stream.skipToEnd(); + return STYLE_ERROR; + } + + state.tokenize = parseProcessingInstructionBody; + return STYLE_INSTRUCTION; + } + + function parseProcessingInstructionBody(stream, state) { + stream.eatWhile(/[^?]/); + if(stream.eat("?")) { + if(stream.eat(">")) { + popContext(state); + state.tokenize = state.context == null ? parseDocument : parseElementBlock; + } + } + return STYLE_INSTRUCTION; + } + + + /////////////////////////////////////////////////////////////////////////// + // context: XML declaration + // + // XML declaration is of the following format: + // + // - must start at the first character of the first line + // - may span multiple lines + // - must include 'version' + // - may include 'encoding' and 'standalone' (in that order after 'version') + // - attribute names must be lowercase + // - cannot contain anything else on the line + function parseDeclarationVersion(stream, state) { + state.tokenize = parseDeclarationEncoding; + + if(isTokenSeparated(stream) && stream.match(/^version( )*=( )*"([a-zA-Z0-9_.:]|\-)+"/)) { + return STYLE_INSTRUCTION; + } + stream.skipToEnd(); + return STYLE_ERROR; + } + + function parseDeclarationEncoding(stream, state) { + state.tokenize = parseDeclarationStandalone; + + if(isTokenSeparated(stream) && stream.match(/^encoding( )*=( )*"[A-Za-z]([A-Za-z0-9._]|\-)*"/)) { + return STYLE_INSTRUCTION; + } + return null; + } + + function parseDeclarationStandalone(stream, state) { + state.tokenize = parseDeclarationEndTag; + + if(isTokenSeparated(stream) && stream.match(/^standalone( )*=( )*"(yes|no)"/)) { + return STYLE_INSTRUCTION; + } + return null; + } + + function parseDeclarationEndTag(stream, state) { + state.tokenize = parseDocument; + + if(stream.match("?>") && stream.eol()) { + popContext(state); + return STYLE_INSTRUCTION; + } + stream.skipToEnd(); + return STYLE_ERROR; + } + + /////////////////////////////////////////////////////////////////////////// + // returned object + return { + electricChars: "/[", + + startState: function() { + return { + tokenize: parseDocument, + tokParams: {}, + lineNumber: 0, + lineError: false, + context: null, + indented: 0 + }; + }, + + token: function(stream, state) { + if(stream.sol()) { + // initialize a new line + state.lineNumber++; + state.lineError = false; + state.indented = stream.indentation(); + } + + // eat all (the spaces) you can + if(stream.eatSpace()) return null; + + // run the current tokenize function, according to the state + var style = state.tokenize(stream, state); + + // is there an error somewhere in the line? + state.lineError = (state.lineError || style == "error"); + + return style; + }, + + blankLine: function(state) { + // blank lines are lines too! + state.lineNumber++; + state.lineError = false; + }, + + indent: function(state, textAfter) { + if(state.context) { + if(state.context.noIndent == true) { + // do not indent - no return value at all + return; + } + if(textAfter.match(/^<\/.*/)) { + // end-tag - indent back to last context + return state.context.indent; + } + if(textAfter.match(/^ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/conlite/external/codemirror/mode/xquery/index.html b/conlite/external/codemirror/mode/xquery/index.html new file mode 100644 index 0000000..82f00d2 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/index.html @@ -0,0 +1,222 @@ + + + + + CodeMirror 2: JavaScript mode + + + + + + + + +

    CodeMirror 2: XQuery mode

    + +
    + +
    + + + +

    MIME types defined: application/xquery.

    + +

    Development of the CodeMirror XQuery mode was sponsored by + MarkLogic and developed by + Mike Brevoort. +

    + + + diff --git a/conlite/external/codemirror/mode/xquery/test/index.html b/conlite/external/codemirror/mode/xquery/test/index.html new file mode 100644 index 0000000..ba82e54 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/index.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + +

    XQuery CodeMirror Mode

    +

    +

    +
      +
    +
    + + diff --git a/conlite/external/codemirror/mode/xquery/test/testBase.js b/conlite/external/codemirror/mode/xquery/test/testBase.js new file mode 100644 index 0000000..d40e9ee --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/testBase.js @@ -0,0 +1,42 @@ + $(document).ready(function(){ + module("testBase"); + test("eviltest", function() { + expect(1); + + var input = 'xquery version "1.0-ml";\ + (: this is\ + : a \ + "comment" :)\ + let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x>\ + let $joe:=1\ + return element element {\ + attribute attribute { 1 },\ + element test { 'a' }, \ + attribute foo { "bar" },\ + fn:doc()[ foo/@bar eq $let ],\ + //x } \ + \ + (: a more \'evil\' test :)\ + (: Modified Blakeley example (: with nested comment :) ... :)\ + declare private function local:declare() {()};\ + declare private function local:private() {()};\ + declare private function local:function() {()};\ + declare private function local:local() {()};\ + let $let := <let>let $let := "let"</let>\ + return element element {\ + attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },\ + attribute fn:doc { "bar" castable as xs:string },\ + element text { text { "text" } },\ + fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],\ + //fn:doc\ + }'; + var expected = 'xquery version "1.0-ml"; (: this is : a "comment" :) let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x> let $joe:=1 return element element { attribute attribute { 1 }, element test { \'a\' }, attribute foo { "bar" }, fn:doc()[ foo/@bar eq $let ], //x } (: a more \'evil\' test :) (: Modified Blakeley example (: with nested comment :) ... :) declare private function local:declare() {()}; declare private function local:private() {()}; declare private function local:function() {()}; declare private function local:local() {()}; let $let := <let>let $let := "let"</let> return element element { attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, attribute fn:doc { "bar" castable as xs:string }, element text { text { "text" } }, fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ], //fn:doc }'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + }); diff --git a/conlite/external/codemirror/mode/xquery/test/testEmptySequenceKeyword.js b/conlite/external/codemirror/mode/xquery/test/testEmptySequenceKeyword.js new file mode 100644 index 0000000..39ed090 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/testEmptySequenceKeyword.js @@ -0,0 +1,16 @@ +$(document).ready(function(){ + module("testEmptySequenceKeyword"); + test("testEmptySequenceKeyword", function() { + expect(1); + + var input = '"foo" instance of empty-sequence()'; + var expected = '"foo" instance of empty-sequence()'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); +}); diff --git a/conlite/external/codemirror/mode/xquery/test/testMultiAttr.js b/conlite/external/codemirror/mode/xquery/test/testMultiAttr.js new file mode 100644 index 0000000..8e98c47 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/testMultiAttr.js @@ -0,0 +1,16 @@ + $(document).ready(function(){ + module("testMultiAttr"); + test("test1", function() { + expect(1); + + var expected = '<p a1="foo" a2="bar">hello world</p>'; + + $("#sandbox").html(''); + $("#editor").html('

    hello world

    '); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + }); \ No newline at end of file diff --git a/conlite/external/codemirror/mode/xquery/test/testNamespaces.js b/conlite/external/codemirror/mode/xquery/test/testNamespaces.js new file mode 100644 index 0000000..4efea63 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/testNamespaces.js @@ -0,0 +1,91 @@ +$(document).ready(function(){ + module("test namespaces"); + +// -------------------------------------------------------------------------------- +// this test is based on this: +//http://mbrevoort.github.com/CodeMirror2/#!exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-10.xq +// -------------------------------------------------------------------------------- + test("test namespaced variable", function() { + expect(1); + + var input = 'declare namespace e = "http://example.com/ANamespace";\ +declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; + + var expected = 'declare namespace e = "http://example.com/ANamespace";declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + + +// -------------------------------------------------------------------------------- +// this test is based on: +// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-002.xq +// -------------------------------------------------------------------------------- + test("test EQName variable", function() { + expect(1); + + var input = 'declare variable $"http://www.example.com/ns/my":var := 12;\ +{$"http://www.example.com/ns/my":var}'; + + var expected = 'declare variable $"http://www.example.com/ns/my":var := 12;<out>{$"http://www.example.com/ns/my":var}</out>'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + +// -------------------------------------------------------------------------------- +// this test is based on: +// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq +// -------------------------------------------------------------------------------- + test("test EQName function", function() { + expect(1); + + var input = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer {\ + $a + 2\ +};\ +{"http://www.example.com/ns/my":fn(12)}'; + + var expected = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer { $a + 2};<out>{"http://www.example.com/ns/my":fn(12)}</out>'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + +// -------------------------------------------------------------------------------- +// this test is based on: +// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq +// -------------------------------------------------------------------------------- + test("test EQName function with single quotes", function() { + expect(1); + + var input = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer {\ + $a + 2\ +};\ +{\'http://www.example.com/ns/my\':fn(12)}'; + + var expected = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer { $a + 2};<out>{\'http://www.example.com/ns/my\':fn(12)}</out>'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + +}); + + diff --git a/conlite/external/codemirror/mode/xquery/test/testProcessingInstructions.js b/conlite/external/codemirror/mode/xquery/test/testProcessingInstructions.js new file mode 100644 index 0000000..9b75305 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/testProcessingInstructions.js @@ -0,0 +1,16 @@ +$(document).ready(function(){ + module("testProcessingInstructions"); + test("testProcessingInstructions", function() { + expect(1); + + var input = 'data() instance of xs:string'; + var expected = 'data(<?target content?>) instance of xs:string'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); +}); diff --git a/conlite/external/codemirror/mode/xquery/test/testQuotes.js b/conlite/external/codemirror/mode/xquery/test/testQuotes.js new file mode 100644 index 0000000..79e5142 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/test/testQuotes.js @@ -0,0 +1,19 @@ + $(document).ready(function(){ + module("testQuoteEscape"); + test("testQuoteEscapeDouble", function() { + expect(1); + + var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\ +let $keysfolder := concat($rootfolder, "keys\\")\ +return\ +$keysfolder'; + var expected = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"let $keysfolder := concat($rootfolder, "keys\\")return$keysfolder'; + + $("#sandbox").html(''); + var editor = CodeMirror.fromTextArea($("#editor")[0]); + var result = $(".CodeMirror-lines div div pre")[0].innerHTML; + + equal(result, expected); + $("#editor").html(""); + }); + }); diff --git a/conlite/external/codemirror/mode/xquery/xquery.js b/conlite/external/codemirror/mode/xquery/xquery.js new file mode 100644 index 0000000..e29c7d8 --- /dev/null +++ b/conlite/external/codemirror/mode/xquery/xquery.js @@ -0,0 +1,448 @@ +/* +Copyright (C) 2011 by MarkLogic Corporation +Author: Mike Brevoort + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +CodeMirror.defineMode("xquery", function(config, parserConfig) { + + // The keywords object is set to the result of this self executing + // function. Each keyword is a property of the keywords object whose + // value is {type: atype, style: astyle} + var keywords = function(){ + // conveinence functions used to build keywords object + function kw(type) {return {type: type, style: "keyword"};} + var A = kw("keyword a") + , B = kw("keyword b") + , C = kw("keyword c") + , operator = kw("operator") + , atom = {type: "atom", style: "atom"} + , punctuation = {type: "punctuation", style: ""} + , qualifier = {type: "axis_specifier", style: "qualifier"}; + + // kwObj is what is return from this function at the end + var kwObj = { + 'if': A, 'switch': A, 'while': A, 'for': A, + 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B, + 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C, + 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C, + ',': punctuation, + 'null': atom, 'fn:false()': atom, 'fn:true()': atom + }; + + // a list of 'basic' keywords. For each add a property to kwObj with the value of + // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"} + var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before', + 'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self', + 'descending','document','document-node','element','else','eq','every','except','external','following', + 'following-sibling','follows','for','function','if','import','in','instance','intersect','item', + 'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding', + 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element', + 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where', + 'xquery', 'empty-sequence']; + for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i])}; + + // a list of types. For each add a property to kwObj with the value of + // {type: "atom", style: "atom"} + var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime', + 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary', + 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration']; + for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;}; + + // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"} + var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-']; + for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;}; + + // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"} + var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::", + "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"]; + for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; }; + + return kwObj; + }(); + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; content = cont; + return style; + } + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + // the primary mode tokenizer + function tokenBase(stream, state) { + var ch = stream.next(), + mightBeFunction = false, + isEQName = isEQNameAhead(stream); + + // an XML tag (if not in some sub, chained tokenizer) + if (ch == "<") { + if(stream.match("!--", true)) + return chain(stream, state, tokenXMLComment); + + if(stream.match("![CDATA", false)) { + state.tokenize = tokenCDATA; + return ret("tag", "tag"); + } + + if(stream.match("?", false)) { + return chain(stream, state, tokenPreProcessing); + } + + var isclose = stream.eat("/"); + stream.eatSpace(); + var tagName = "", c; + while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c; + + return chain(stream, state, tokenTag(tagName, isclose)); + } + // start code block + else if(ch == "{") { + pushStateStack(state,{ type: "codeblock"}); + return ret("", ""); + } + // end code block + else if(ch == "}") { + popStateStack(state); + return ret("", ""); + } + // if we're in an XML block + else if(isInXmlBlock(state)) { + if(ch == ">") + return ret("tag", "tag"); + else if(ch == "/" && stream.eat(">")) { + popStateStack(state); + return ret("tag", "tag"); + } + else + return ret("word", "variable"); + } + // if a number + else if (/\d/.test(ch)) { + stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/); + return ret("number", "atom"); + } + // comment start + else if (ch === "(" && stream.eat(":")) { + pushStateStack(state, { type: "comment"}); + return chain(stream, state, tokenComment); + } + // quoted string + else if ( !isEQName && (ch === '"' || ch === "'")) + return chain(stream, state, tokenString(ch)); + // variable + else if(ch === "$") { + return chain(stream, state, tokenVariable); + } + // assignment + else if(ch ===":" && stream.eat("=")) { + return ret("operator", "keyword"); + } + // open paren + else if(ch === "(") { + pushStateStack(state, { type: "paren"}); + return ret("", ""); + } + // close paren + else if(ch === ")") { + popStateStack(state); + return ret("", ""); + } + // open paren + else if(ch === "[") { + pushStateStack(state, { type: "bracket"}); + return ret("", ""); + } + // close paren + else if(ch === "]") { + popStateStack(state); + return ret("", ""); + } + else { + var known = keywords.propertyIsEnumerable(ch) && keywords[ch]; + + // if there's a EQName ahead, consume the rest of the string portion, it's likely a function + if(isEQName && ch === '\"') while(stream.next() !== '"'){} + if(isEQName && ch === '\'') while(stream.next() !== '\''){} + + // gobble up a word if the character is not known + if(!known) stream.eatWhile(/[\w\$_-]/); + + // gobble a colon in the case that is a lib func type call fn:doc + var foundColon = stream.eat(":") + + // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier + // which should get matched as a keyword + if(!stream.eat(":") && foundColon) { + stream.eatWhile(/[\w\$_-]/); + } + // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort) + if(stream.match(/^[ \t]*\(/, false)) { + mightBeFunction = true; + } + // is the word a keyword? + var word = stream.current(); + known = keywords.propertyIsEnumerable(word) && keywords[word]; + + // if we think it's a function call but not yet known, + // set style to variable for now for lack of something better + if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"}; + + // if the previous word was element, attribute, axis specifier, this word should be the name of that + if(isInXmlConstructor(state)) { + popStateStack(state); + return ret("word", "variable", word); + } + // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and + // push the stack so we know to look for it on the next word + if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"}); + + // if the word is known, return the details of that else just call this a generic 'word' + return known ? ret(known.type, known.style, word) : + ret("word", "variable", word); + } + } + + // handle comments, including nested + function tokenComment(stream, state) { + var maybeEnd = false, maybeNested = false, nestedCount = 0, ch; + while (ch = stream.next()) { + if (ch == ")" && maybeEnd) { + if(nestedCount > 0) + nestedCount--; + else { + popStateStack(state); + break; + } + } + else if(ch == ":" && maybeNested) { + nestedCount++; + } + maybeEnd = (ch == ":"); + maybeNested = (ch == "("); + } + + return ret("comment", "comment"); + } + + // tokenizer for string literals + // optionally pass a tokenizer function to set state.tokenize back to when finished + function tokenString(quote, f) { + return function(stream, state) { + var ch; + + if(isInString(state) && stream.current() == quote) { + popStateStack(state); + if(f) state.tokenize = f; + return ret("string", "string"); + } + + pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) }); + + // if we're in a string and in an XML block, allow an embedded code block + if(stream.match("{", false) && isInXmlAttributeBlock(state)) { + state.tokenize = tokenBase; + return ret("string", "string"); + } + + + while (ch = stream.next()) { + if (ch == quote) { + popStateStack(state); + if(f) state.tokenize = f; + break; + } + else { + // if we're in a string and in an XML block, allow an embedded code block in an attribute + if(stream.match("{", false) && isInXmlAttributeBlock(state)) { + state.tokenize = tokenBase; + return ret("string", "string"); + } + + } + } + + return ret("string", "string"); + }; + } + + // tokenizer for variables + function tokenVariable(stream, state) { + var isVariableChar = /[\w\$_-]/; + + // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote + if(stream.eat("\"")) { + while(stream.next() !== '\"'){}; + stream.eat(":"); + } else { + stream.eatWhile(isVariableChar); + if(!stream.match(":=", false)) stream.eat(":"); + } + stream.eatWhile(isVariableChar); + state.tokenize = tokenBase; + return ret("variable", "variable"); + } + + // tokenizer for XML tags + function tokenTag(name, isclose) { + return function(stream, state) { + stream.eatSpace(); + if(isclose && stream.eat(">")) { + popStateStack(state); + state.tokenize = tokenBase; + return ret("tag", "tag"); + } + // self closing tag without attributes? + if(!stream.eat("/")) + pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase}); + if(!stream.eat(">")) { + state.tokenize = tokenAttribute; + return ret("tag", "tag"); + } + else { + state.tokenize = tokenBase; + } + return ret("tag", "tag"); + } + } + + // tokenizer for XML attributes + function tokenAttribute(stream, state) { + var ch = stream.next(); + + if(ch == "/" && stream.eat(">")) { + if(isInXmlAttributeBlock(state)) popStateStack(state); + if(isInXmlBlock(state)) popStateStack(state); + return ret("tag", "tag"); + } + if(ch == ">") { + if(isInXmlAttributeBlock(state)) popStateStack(state); + return ret("tag", "tag"); + } + if(ch == "=") + return ret("", ""); + // quoted string + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch, tokenAttribute)); + + if(!isInXmlAttributeBlock(state)) + pushStateStack(state, { type: "attribute", name: name, tokenize: tokenAttribute}); + + stream.eat(/[a-zA-Z_:]/); + stream.eatWhile(/[-a-zA-Z0-9_:.]/); + stream.eatSpace(); + + // the case where the attribute has not value and the tag was closed + if(stream.match(">", false) || stream.match("/", false)) { + popStateStack(state); + state.tokenize = tokenBase; + } + + return ret("attribute", "attribute"); + } + + // handle comments, including nested + function tokenXMLComment(stream, state) { + while (ch = stream.next()) { + if (ch == "-" && stream.match("->", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + } + } + + + // handle CDATA + function tokenCDATA(stream, state) { + while (ch = stream.next()) { + if (ch == "]" && stream.match("]", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + } + } + + // handle preprocessing instructions + function tokenPreProcessing(stream, state) { + while (ch = stream.next()) { + if (ch == "?" && stream.match(">", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment meta"); + } + } + } + + + // functions to test the current context of the state + function isInXmlBlock(state) { return isIn(state, "tag"); } + function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); } + function isInCodeBlock(state) { return isIn(state, "codeblock"); } + function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); } + function isInString(state) { return isIn(state, "string"); } + + function isEQNameAhead(stream) { + // assume we've already eaten a quote (") + if(stream.current() === '"') + return stream.match(/^[^\"]+\"\:/, false); + else if(stream.current() === '\'') + return stream.match(/^[^\"]+\'\:/, false); + else + return false; + } + + function isIn(state, type) { + return (state.stack.length && state.stack[state.stack.length - 1].type == type); + } + + function pushStateStack(state, newState) { + state.stack.push(newState); + } + + function popStateStack(state) { + var popped = state.stack.pop(); + var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize + state.tokenize = reinstateTokenize || tokenBase; + } + + // the interface for the mode API + return { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + cc: [], + stack: [] + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + } + }; + +}); + +CodeMirror.defineMIME("application/xquery", "xquery"); diff --git a/conlite/external/codemirror/mode/yaml/index.html b/conlite/external/codemirror/mode/yaml/index.html new file mode 100644 index 0000000..7f2c792 --- /dev/null +++ b/conlite/external/codemirror/mode/yaml/index.html @@ -0,0 +1,67 @@ + + + + CodeMirror: YAML mode + + + + + + + +

    CodeMirror: YAML mode

    +
    + + +

    MIME types defined: text/x-yaml.

    + + + diff --git a/conlite/external/codemirror/mode/yaml/yaml.js b/conlite/external/codemirror/mode/yaml/yaml.js new file mode 100644 index 0000000..59e2641 --- /dev/null +++ b/conlite/external/codemirror/mode/yaml/yaml.js @@ -0,0 +1,95 @@ +CodeMirror.defineMode("yaml", function() { + + var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; + var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); + + return { + token: function(stream, state) { + var ch = stream.peek(); + var esc = state.escaped; + state.escaped = false; + /* comments */ + if (ch == "#") { stream.skipToEnd(); return "comment"; } + if (state.literal && stream.indentation() > state.keyCol) { + stream.skipToEnd(); return "string"; + } else if (state.literal) { state.literal = false; } + if (stream.sol()) { + state.keyCol = 0; + state.pair = false; + state.pairStart = false; + /* document start */ + if(stream.match(/---/)) { return "def"; } + /* document end */ + if (stream.match(/\.\.\./)) { return "def"; } + /* array list item */ + if (stream.match(/\s*-\s+/)) { return 'meta'; } + } + /* pairs (associative arrays) -> key */ + if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) { + state.pair = true; + state.keyCol = stream.indentation(); + return "atom"; + } + if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } + + /* inline pairs/lists */ + if (stream.match(/^(\{|\}|\[|\])/)) { + if (ch == '{') + state.inlinePairs++; + else if (ch == '}') + state.inlinePairs--; + else if (ch == '[') + state.inlineList++; + else + state.inlineList--; + return 'meta'; + } + + /* list seperator */ + if (state.inlineList > 0 && !esc && ch == ',') { + stream.next(); + return 'meta'; + } + /* pairs seperator */ + if (state.inlinePairs > 0 && !esc && ch == ',') { + state.keyCol = 0; + state.pair = false; + state.pairStart = false; + stream.next(); + return 'meta'; + } + + /* start of value of a pair */ + if (state.pairStart) { + /* block literals */ + if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; + /* references */ + if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } + /* numbers */ + if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } + if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } + /* keywords */ + if (stream.match(keywordRegex)) { return 'keyword'; } + } + + /* nothing found, continue */ + state.pairStart = false; + state.escaped = (ch == '\\'); + stream.next(); + return null; + }, + startState: function() { + return { + pair: false, + pairStart: false, + keyCol: 0, + inlinePairs: 0, + inlineList: 0, + literal: false, + escaped: false + }; + } + }; +}); + +CodeMirror.defineMIME("text/x-yaml", "yaml"); diff --git a/conlite/external/codemirror/theme/ambiance.css b/conlite/external/codemirror/theme/ambiance.css new file mode 100644 index 0000000..ef5f8d0 --- /dev/null +++ b/conlite/external/codemirror/theme/ambiance.css @@ -0,0 +1,81 @@ +/* ambiance theme for code-mirror */ + +/* Color scheme */ + +.cm-s-ambiance .cm-keyword { color: #cda869; } +.cm-s-ambiance .cm-atom { color: #CF7EA9; } +.cm-s-ambiance .cm-number { color: #78CF8A; } +.cm-s-ambiance .cm-def { color: #aac6e3; } +.cm-s-ambiance .cm-variable { color: #ffb795; } +.cm-s-ambiance .cm-variable-2 { color: #eed1b3; } +.cm-s-ambiance .cm-variable-3 { color: #faded3; } +.cm-s-ambiance .cm-property { color: #eed1b3; } +.cm-s-ambiance .cm-operator {color: #fa8d6a;} +.cm-s-ambiance .cm-comment { color: #555; font-style:italic; } +.cm-s-ambiance .cm-string { color: #8f9d6a; } +.cm-s-ambiance .cm-string-2 { color: #9d937c; } +.cm-s-ambiance .cm-meta { color: #D2A8A1; } +.cm-s-ambiance .cm-error { color: #AF2018; } +.cm-s-ambiance .cm-qualifier { color: yellow; } +.cm-s-ambiance .cm-builtin { color: #9999cc; } +.cm-s-ambiance .cm-bracket { color: #24C2C7; } +.cm-s-ambiance .cm-tag { color: #fee4ff } +.cm-s-ambiance .cm-attribute { color: #9B859D; } +.cm-s-ambiance .cm-header {color: blue;} +.cm-s-ambiance .cm-quote { color: #24C2C7; } +.cm-s-ambiance .cm-hr { color: pink; } +.cm-s-ambiance .cm-link { color: #F4C20B; } +.cm-s-ambiance .cm-special { color: #FF9D00; } + +.cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; } +.cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; } + +.cm-s-ambiance .CodeMirror-selected { + background: rgba(255, 255, 255, 0.15); +} +.CodeMirror-focused .cm-s-ambiance .CodeMirror-selected { + background: rgba(255, 255, 255, 0.10); +} + +/* Editor styling */ + +.cm-s-ambiance { + line-height: 1.40em; + font-family: Monaco, Menlo,"Andale Mono","lucida console","Courier New",monospace !important; + color: #E6E1DC; + background-color: #202020; + -webkit-box-shadow: inset 0 0 10px black; + -moz-box-shadow: inset 0 0 10px black; + -o-box-shadow: inset 0 0 10px black; + box-shadow: inset 0 0 10px black; +} + +.cm-s-ambiance .CodeMirror-gutter { + background: #3D3D3D; + padding: 0 5px; + text-shadow: #333 1px 1px; + border-right: 1px solid #4D4D4D; + box-shadow: 0 10px 20px black; +} + +.cm-s-ambiance .CodeMirror-gutter .CodeMirror-gutter-text { + text-shadow: 0px 1px 1px #4d4d4d; + color: #222; +} + +.cm-s-ambiance .CodeMirror-lines { + +} + +.cm-s-ambiance .CodeMirror-lines .CodeMirror-cursor { + border-left: 1px solid #7991E8; +} + +.cm-s-ambiance .activeline { + background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031); +} + +.cm-s-ambiance, +.cm-s-ambiance .CodeMirror-gutter { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC"); +} diff --git a/conlite/external/codemirror/theme/blackboard.css b/conlite/external/codemirror/theme/blackboard.css new file mode 100644 index 0000000..7b73a92 --- /dev/null +++ b/conlite/external/codemirror/theme/blackboard.css @@ -0,0 +1,25 @@ +/* Port of TextMate's Blackboard theme */ + +.cm-s-blackboard { background: #0C1021; color: #F8F8F8; } +.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } +.cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; } +.cm-s-blackboard .CodeMirror-gutter-text { color: #888; } +.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } + +.cm-s-blackboard .cm-keyword { color: #FBDE2D; } +.cm-s-blackboard .cm-atom { color: #D8FA3C; } +.cm-s-blackboard .cm-number { color: #D8FA3C; } +.cm-s-blackboard .cm-def { color: #8DA6CE; } +.cm-s-blackboard .cm-variable { color: #FF6400; } +.cm-s-blackboard .cm-operator { color: #FBDE2D;} +.cm-s-blackboard .cm-comment { color: #AEAEAE; } +.cm-s-blackboard .cm-string { color: #61CE3C; } +.cm-s-blackboard .cm-string-2 { color: #61CE3C; } +.cm-s-blackboard .cm-meta { color: #D8FA3C; } +.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } +.cm-s-blackboard .cm-builtin { color: #8DA6CE; } +.cm-s-blackboard .cm-tag { color: #8DA6CE; } +.cm-s-blackboard .cm-attribute { color: #8DA6CE; } +.cm-s-blackboard .cm-header { color: #FF6400; } +.cm-s-blackboard .cm-hr { color: #AEAEAE; } +.cm-s-blackboard .cm-link { color: #8DA6CE; } diff --git a/conlite/external/codemirror/theme/cobalt.css b/conlite/external/codemirror/theme/cobalt.css new file mode 100644 index 0000000..dbbb7e4 --- /dev/null +++ b/conlite/external/codemirror/theme/cobalt.css @@ -0,0 +1,18 @@ +.cm-s-cobalt { background: #002240; color: white; } +.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } +.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } +.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; } +.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-cobalt span.cm-comment { color: #08f; } +.cm-s-cobalt span.cm-atom { color: #845dc4; } +.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } +.cm-s-cobalt span.cm-keyword { color: #ffee80; } +.cm-s-cobalt span.cm-string { color: #3ad900; } +.cm-s-cobalt span.cm-meta { color: #ff9d00; } +.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } +.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } +.cm-s-cobalt span.cm-error { color: #9d1e15; } +.cm-s-cobalt span.cm-bracket { color: #d8d8d8; } +.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } +.cm-s-cobalt span.cm-link { color: #845dc4; } diff --git a/conlite/external/codemirror/theme/eclipse.css b/conlite/external/codemirror/theme/eclipse.css new file mode 100644 index 0000000..47d66a0 --- /dev/null +++ b/conlite/external/codemirror/theme/eclipse.css @@ -0,0 +1,25 @@ +.cm-s-eclipse span.cm-meta {color: #FF1717;} +.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } +.cm-s-eclipse span.cm-atom {color: #219;} +.cm-s-eclipse span.cm-number {color: #164;} +.cm-s-eclipse span.cm-def {color: #00f;} +.cm-s-eclipse span.cm-variable {color: black;} +.cm-s-eclipse span.cm-variable-2 {color: #0000C0;} +.cm-s-eclipse span.cm-variable-3 {color: #0000C0;} +.cm-s-eclipse span.cm-property {color: black;} +.cm-s-eclipse span.cm-operator {color: black;} +.cm-s-eclipse span.cm-comment {color: #3F7F5F;} +.cm-s-eclipse span.cm-string {color: #2A00FF;} +.cm-s-eclipse span.cm-string-2 {color: #f50;} +.cm-s-eclipse span.cm-error {color: #f00;} +.cm-s-eclipse span.cm-qualifier {color: #555;} +.cm-s-eclipse span.cm-builtin {color: #30a;} +.cm-s-eclipse span.cm-bracket {color: #cc7;} +.cm-s-eclipse span.cm-tag {color: #170;} +.cm-s-eclipse span.cm-attribute {color: #00c;} +.cm-s-eclipse span.cm-link {color: #219;} + +.cm-s-eclipse .CodeMirror-matchingbracket { + border:1px solid grey; + color:black !important;; +} diff --git a/conlite/external/codemirror/theme/elegant.css b/conlite/external/codemirror/theme/elegant.css new file mode 100644 index 0000000..d0ce0cb --- /dev/null +++ b/conlite/external/codemirror/theme/elegant.css @@ -0,0 +1,10 @@ +.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} +.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} +.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} +.cm-s-elegant span.cm-variable {color: black;} +.cm-s-elegant span.cm-variable-2 {color: #b11;} +.cm-s-elegant span.cm-qualifier {color: #555;} +.cm-s-elegant span.cm-keyword {color: #730;} +.cm-s-elegant span.cm-builtin {color: #30a;} +.cm-s-elegant span.cm-error {background-color: #fdd;} +.cm-s-elegant span.cm-link {color: #762;} diff --git a/conlite/external/codemirror/theme/erlang-dark.css b/conlite/external/codemirror/theme/erlang-dark.css new file mode 100644 index 0000000..486b1c4 --- /dev/null +++ b/conlite/external/codemirror/theme/erlang-dark.css @@ -0,0 +1,21 @@ +.cm-s-erlang-dark { background: #002240; color: white; } +.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } +.cm-s-erlang-dark .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } +.cm-s-erlang-dark .CodeMirror-gutter-text { color: #d0d0d0; } +.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-erlang-dark span.cm-atom { color: #845dc4; } +.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } +.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } +.cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; } +.cm-s-erlang-dark span.cm-comment { color: #7777ff; } +.cm-s-erlang-dark span.cm-def { color: #ee77aa; } +.cm-s-erlang-dark span.cm-error { color: #9d1e15; } +.cm-s-erlang-dark span.cm-keyword { color: #ffee80; } +.cm-s-erlang-dark span.cm-meta { color: #50fefe; } +.cm-s-erlang-dark span.cm-number { color: #ffd0d0; } +.cm-s-erlang-dark span.cm-operator { color: #dd1111; } +.cm-s-erlang-dark span.cm-string { color: #3ad900; } +.cm-s-erlang-dark span.cm-tag { color: #9effff; } +.cm-s-erlang-dark span.cm-variable { color: #50fe50; } +.cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; } diff --git a/conlite/external/codemirror/theme/lesser-dark.css b/conlite/external/codemirror/theme/lesser-dark.css new file mode 100644 index 0000000..ffa6a3f --- /dev/null +++ b/conlite/external/codemirror/theme/lesser-dark.css @@ -0,0 +1,44 @@ +/* +http://lesscss.org/ dark theme +Ported to CodeMirror by Peter Kroon +*/ +.cm-s-lesser-dark { + line-height: 1.3em; +} +.cm-s-lesser-dark { + font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; +} + +.cm-s-lesser-dark { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } +.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ +.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } +.cm-s-lesser-dark .CodeMirror-lines { margin-left:3px; margin-right:3px; }/*editable code holder*/ + +div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ + +.cm-s-lesser-dark .CodeMirror-gutter { background: #262626; border-right:1px solid #aaa; padding-right:3px; min-width:2.5em; } +.cm-s-lesser-dark .CodeMirror-gutter-text { color: #777; } + +.cm-s-lesser-dark span.cm-keyword { color: #599eff; } +.cm-s-lesser-dark span.cm-atom { color: #C2B470; } +.cm-s-lesser-dark span.cm-number { color: #B35E4D; } +.cm-s-lesser-dark span.cm-def {color: white;} +.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } +.cm-s-lesser-dark span.cm-variable-2 { color: #669199; } +.cm-s-lesser-dark span.cm-variable-3 { color: white; } +.cm-s-lesser-dark span.cm-property {color: #92A75C;} +.cm-s-lesser-dark span.cm-operator {color: #92A75C;} +.cm-s-lesser-dark span.cm-comment { color: #666; } +.cm-s-lesser-dark span.cm-string { color: #BCD279; } +.cm-s-lesser-dark span.cm-string-2 {color: #f50;} +.cm-s-lesser-dark span.cm-meta { color: #738C73; } +.cm-s-lesser-dark span.cm-error { color: #9d1e15; } +.cm-s-lesser-dark span.cm-qualifier {color: #555;} +.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } +.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } +.cm-s-lesser-dark span.cm-tag { color: #669199; } +.cm-s-lesser-dark span.cm-attribute {color: #00c;} +.cm-s-lesser-dark span.cm-header {color: #a0a;} +.cm-s-lesser-dark span.cm-quote {color: #090;} +.cm-s-lesser-dark span.cm-hr {color: #999;} +.cm-s-lesser-dark span.cm-link {color: #00c;} diff --git a/conlite/external/codemirror/theme/monokai.css b/conlite/external/codemirror/theme/monokai.css new file mode 100644 index 0000000..f01d066 --- /dev/null +++ b/conlite/external/codemirror/theme/monokai.css @@ -0,0 +1,28 @@ +/* Based on Sublime Text's Monokai theme */ + +.cm-s-monokai {background: #272822; color: #f8f8f2;} +.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} +.cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;} +.cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;} +.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} + +.cm-s-monokai span.cm-comment {color: #75715e;} +.cm-s-monokai span.cm-atom {color: #ae81ff;} +.cm-s-monokai span.cm-number {color: #ae81ff;} + +.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} +.cm-s-monokai span.cm-keyword {color: #f92672;} +.cm-s-monokai span.cm-string {color: #e6db74;} + +.cm-s-monokai span.cm-variable {color: #a6e22e;} +.cm-s-monokai span.cm-variable-2 {color: #9effff;} +.cm-s-monokai span.cm-def {color: #fd971f;} +.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} +.cm-s-monokai span.cm-bracket {color: #f8f8f2;} +.cm-s-monokai span.cm-tag {color: #f92672;} +.cm-s-monokai span.cm-link {color: #ae81ff;} + +.cm-s-monokai .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/conlite/external/codemirror/theme/neat.css b/conlite/external/codemirror/theme/neat.css new file mode 100644 index 0000000..8a307f8 --- /dev/null +++ b/conlite/external/codemirror/theme/neat.css @@ -0,0 +1,9 @@ +.cm-s-neat span.cm-comment { color: #a86; } +.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } +.cm-s-neat span.cm-string { color: #a22; } +.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } +.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } +.cm-s-neat span.cm-variable { color: black; } +.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } +.cm-s-neat span.cm-meta {color: #555;} +.cm-s-neat span.cm-link { color: #3a3; } diff --git a/conlite/external/codemirror/theme/night.css b/conlite/external/codemirror/theme/night.css new file mode 100644 index 0000000..9d51d95 --- /dev/null +++ b/conlite/external/codemirror/theme/night.css @@ -0,0 +1,21 @@ +/* Loosely based on the Midnight Textmate theme */ + +.cm-s-night { background: #0a001f; color: #f8f8f8; } +.cm-s-night div.CodeMirror-selected { background: #447 !important; } +.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; } +.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; } +.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-night span.cm-comment { color: #6900a1; } +.cm-s-night span.cm-atom { color: #845dc4; } +.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } +.cm-s-night span.cm-keyword { color: #599eff; } +.cm-s-night span.cm-string { color: #37f14a; } +.cm-s-night span.cm-meta { color: #7678e2; } +.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } +.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } +.cm-s-night span.cm-error { color: #9d1e15; } +.cm-s-night span.cm-bracket { color: #8da6ce; } +.cm-s-night span.cm-comment { color: #6900a1; } +.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } +.cm-s-night span.cm-link { color: #845dc4; } diff --git a/conlite/external/codemirror/theme/rubyblue.css b/conlite/external/codemirror/theme/rubyblue.css new file mode 100644 index 0000000..502817a --- /dev/null +++ b/conlite/external/codemirror/theme/rubyblue.css @@ -0,0 +1,21 @@ +.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ + +.cm-s-rubyblue { background: #112435; color: white; } +.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } +.cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; } +.cm-s-rubyblue .CodeMirror-gutter-text { color: white; } +.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } +.cm-s-rubyblue span.cm-atom { color: #F4C20B; } +.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } +.cm-s-rubyblue span.cm-keyword { color: #F0F; } +.cm-s-rubyblue span.cm-string { color: #F08047; } +.cm-s-rubyblue span.cm-meta { color: #F0F; } +.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } +.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } +.cm-s-rubyblue span.cm-error { color: #AF2018; } +.cm-s-rubyblue span.cm-bracket { color: #F0F; } +.cm-s-rubyblue span.cm-link { color: #F4C20B; } +.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } +.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } diff --git a/conlite/external/codemirror/theme/vibrant-ink.css b/conlite/external/codemirror/theme/vibrant-ink.css new file mode 100644 index 0000000..de5bc2c --- /dev/null +++ b/conlite/external/codemirror/theme/vibrant-ink.css @@ -0,0 +1,27 @@ +/* Taken from the popular Visual Studio Vibrant Ink Schema */ + +.cm-s-vibrant-ink { background: black; color: white; } +.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } + +.cm-s-vibrant-ink .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } +.cm-s-vibrant-ink .CodeMirror-gutter-text { color: #d0d0d0; } +.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-vibrant-ink .cm-keyword { color: #CC7832; } +.cm-s-vibrant-ink .cm-atom { color: #FC0; } +.cm-s-vibrant-ink .cm-number { color: #FFEE98; } +.cm-s-vibrant-ink .cm-def { color: #8DA6CE; } +.cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D } +.cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D } +.cm-s-vibrant-ink .cm-operator { color: #888; } +.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } +.cm-s-vibrant-ink .cm-string { color: #A5C25C } +.cm-s-vibrant-ink .cm-string-2 { color: red } +.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } +.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } +.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } +.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } +.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } +.cm-s-vibrant-ink .cm-header { color: #FF6400; } +.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } +.cm-s-vibrant-ink .cm-link { color: blue; } diff --git a/conlite/external/codemirror/theme/xq-dark.css b/conlite/external/codemirror/theme/xq-dark.css new file mode 100644 index 0000000..493e3a6 --- /dev/null +++ b/conlite/external/codemirror/theme/xq-dark.css @@ -0,0 +1,46 @@ +/* +Copyright (C) 2011 by MarkLogic Corporation +Author: Mike Brevoort + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; } +.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; } +.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; } +.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; } +.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-xq-dark span.cm-keyword {color: #FFBD40;} +.cm-s-xq-dark span.cm-atom {color: #6C8CD5;} +.cm-s-xq-dark span.cm-number {color: #164;} +.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} +.cm-s-xq-dark span.cm-variable {color: #FFF;} +.cm-s-xq-dark span.cm-variable-2 {color: #EEE;} +.cm-s-xq-dark span.cm-variable-3 {color: #DDD;} +.cm-s-xq-dark span.cm-property {} +.cm-s-xq-dark span.cm-operator {} +.cm-s-xq-dark span.cm-comment {color: gray;} +.cm-s-xq-dark span.cm-string {color: #9FEE00;} +.cm-s-xq-dark span.cm-meta {color: yellow;} +.cm-s-xq-dark span.cm-error {color: #f00;} +.cm-s-xq-dark span.cm-qualifier {color: #FFF700;} +.cm-s-xq-dark span.cm-builtin {color: #30a;} +.cm-s-xq-dark span.cm-bracket {color: #cc7;} +.cm-s-xq-dark span.cm-tag {color: #FFBD40;} +.cm-s-xq-dark span.cm-attribute {color: #FFF700;} diff --git a/conlite/includes/chains/include.chain.template.parsetemplate.php b/conlite/includes/chains/include.chain.template.parsetemplate.php new file mode 100644 index 0000000..fff8fea --- /dev/null +++ b/conlite/includes/chains/include.chain.template.parsetemplate.php @@ -0,0 +1,136 @@ + + * @copyright four for business AG + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + */ +defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.'); + +/** + * Does some replacements in the given template. + * Replaces some CONTENIDO specific placeholders against their values. + * + * @param string $template + * Template string to preprocess + * @param cTemplate $templateObj + * The current template instance + * + * @return string + * + * @throws cInvalidArgumentException + */ +function cecParseTemplate($template, $templateObj) { + + global $frame; + + // Autofill special placeholders like + // - Session id + // - Initial CONTENIDO scripts + + $prefix = "\n "; + + $cfg = cRegistry::getConfig(); + $sessid = (string) cRegistry::getBackendSessionId(); + $backendPath = cRegistry::getBackendUrl(); + $backendLang = cRegistry::getBackendLanguage(); + // Fixme: Creates an error on backend login form, since we have no language there, see main.loginform.php + // $oLanguage = cRegistry::getLanguage(); + // $encoding = $oLanguage->get("encoding"); + $languageid = cRegistry::getLanguageId(); + if ($languageid) { + $oLanguage = cRegistry::getLanguage(); + $encoding = $oLanguage->get('encoding'); + } else { + $encoding = 'utf-8'; + } + $frameNr = (!empty($frame) && is_numeric($frame)) ? $frame : 0; + + // Default meta tags + // @TODO Make this also configurable + $metaCon = ' + + + + '; + + // JavaScript configuration + $urlHelp = !empty($cfg['help_url']) ? $cfg['help_url'] : '#'; + $jsConfigurationAdded = false; + $jsConfiguration = ' + '; + + // Default CSS styles + $cssHeadCon = ''; + $files = $cfg['backend_template']['css_files']; + foreach ($files as $file) { + $cssHeadCon .= $prefix . ''; + } + $cssHeadCon = $prefix . "" . $cssHeadCon . $prefix . ""; + + // Default JavaScript files & JS code + $jsHeadCon = ''; + $files = $cfg['backend_template']['js_files']; + foreach ($files as $file) { + if ('_CONFIG_' === $file) { + $jsHeadCon .= $jsConfiguration; + $jsConfigurationAdded = true; + } else { + $jsHeadCon .= $prefix . ''; + } + } + + if (false === $jsConfigurationAdded) { + $jsHeadCon .= $jsConfiguration; + } + + $jsHeadCon = $prefix . "" . $jsHeadCon . $prefix . ""; + + // Placeholders to replace + $replacements = array( + '_SID_' => $sessid, + '_PATH_CONLITE_FULLHTML_' => $backendPath, + '_META_HEAD_CONLITE_' => $metaCon, + '_CSS_HEAD_CONLITE_' => str_replace('{basePath}', '', $cssHeadCon), + '_CSS_HEAD_CONLITE_FULLHTML_' => str_replace('{basePath}', $backendPath, $cssHeadCon), + '_JS_HEAD_CONLITE_' => str_replace('{basePath}', '', $jsHeadCon), + '_JS_HEAD_CONLITE_FULLHTML_' => str_replace('{basePath}', $backendPath, $jsHeadCon), + ); + + // Loop through all replacements and replace keys which are not in needles but found + // in the template + foreach ($replacements as $key => $value) { + $placeholder = '{' . $key . '}'; + if (!in_array($key, $templateObj->needles) && false !== cString::findFirstPos($template, $placeholder)) { + $template = str_replace($placeholder, $value, $template); + } + } + + return $template; +} diff --git a/conlite/includes/functions.file.php b/conlite/includes/functions.file.php index 40877fe..b6d9dd7 100644 --- a/conlite/includes/functions.file.php +++ b/conlite/includes/functions.file.php @@ -199,13 +199,12 @@ function updateFileInformation($iIdClient, $sFilename, $sType, $sAuthor, $sDescr */ function fileEdit($filename, $sCode, $path) { $oNot = new Contenido_Notification(); - // FIXME: fileValidateFilename does also the validation but display another message! if (strlen(trim($filename)) == 0) { $oNot->displayNotification("error", i18n("Please insert filename.")); return false; } - cFileHandler::validateFilename($filename); + cFileHandler::validateFilename(pathinfo($filename, PATHINFO_BASENAME)); if (is_writable($path . $filename)) { if (strlen(stripslashes(trim($sCode))) > 0) { @@ -247,8 +246,7 @@ function getFileContent($filename, $path) { * @return string Filetype */ function getFileType($filename) { - $aFileName = explode(".", $filename); - return $aFileName[count($aFileName) - 1]; + return pathinfo($filename, PATHINFO_EXTENSION); } /** @@ -263,7 +261,7 @@ function getFileType($filename) { function createFile($filename, $path) { $oNot = new Contenido_Notification(); - cFileHandler::validateFilename($filename); + cFileHandler::validateFilename(pathinfo($filename, PATHINFO_BASENAME)); if (cFileHandler::create($path . $filename)) { return true; diff --git a/conlite/includes/include.html_tpl_edit_form.php b/conlite/includes/include.html_tpl_edit_form.php index 15b78ff..eb9d240 100644 --- a/conlite/includes/include.html_tpl_edit_form.php +++ b/conlite/includes/include.html_tpl_edit_form.php @@ -1,208 +1,21 @@ - * @license http://www.contenido.org/license/LIZENZ.txt - * @link http://www.4fb.de - * @link http://www.contenido.org - * @since file available since contenido release <= 4.6 - * - * {@internal - * created 2004-07-14 - * modified 2008-06-27, Frederic Schneider, add security fix - * modified 2008-08-14, Timo Trautmann, Bilal Arslan - Functions for versionning and storing file meta data added - * - * $Id$: - * }} - * - */ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } -cInclude("external", "edit_area/class.edit_area.php"); -cInclude("includes", "functions.file.php"); +$editor = new cGuiSourceEditor($_REQUEST['tmp_file']); -$sFileType = "html"; +// Show notice message if backend_file_extension filter is active +if (empty($_REQUEST['tmp_file'])) { -$sActionCreate = 'htmltpl_create'; -$sActionEdit = 'htmltpl_edit'; + // Get system properties for extension filter + $backend_file_extensions = getSystemProperty('backend', 'backend_file_extensions'); -$page = new cPage; - -$tpl->reset(); - -if (!$perm->have_perm_area_action($area, $action)) { - $notification->displayNotification("error", i18n("Permission denied")); -} else if (!(int) $client > 0) { - #if there is no client selected, display empty page - $page->render(); -} else { - $path = $cfgClient[$client]["tpl"]["path"]; - $sTempFilename = stripslashes($_REQUEST['tmp_file']); - $sOrigFileName = $sTempFilename; - - if (getFileType($_REQUEST['file']) != $sFileType AND strlen(stripslashes(trim($_REQUEST['file']))) > 0) { - $sFilename .= stripslashes($_REQUEST['file']) . ".$sFileType"; - } else { - $sFilename .= stripslashes($_REQUEST['file']); + if($backend_file_extensions == "enabled") { + $editor->displayInfo(sprintf(i18n("Currently only files with the extension %s are displayed in the menu. If you create files with a different extension, they will not be shown on the left side!"), "html/tpl")); } - if (stripslashes($_REQUEST['file'])) { - $sReloadScript = ""; - } else { - $sReloadScript = ""; - } - - // Content Type is template - $sTypeContent = "templates"; - $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); - - # create new file - if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') { - $sTempFilename = $sFilename; - createFile($sFilename, $path); - $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path); - $sReloadScript .= ""; - updateFileInformation($client, $sFilename, 'templates', $auth->auth['uid'], $_REQUEST['description'], $db); - } - - # edit selected file - if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') { - if ($sFilename != $sTempFilename) { - $sTempFilename = renameFile($sTempFilename, $sFilename, $path); - $sReloadScript .= ""; - } else { - $sTempFilename = $sFilename; - } - - updateFileInformation($client, $sOrigFileName, 'templates', $auth->auth['uid'], $_REQUEST['description'], $db, $sFilename); - - /** - * START TRACK VERSION - * */ - $sTypeContent = "templates"; - - if ((count($aFileInfo) == 0) || ((int) $aFileInfo["idsfi"] == 0)) { - $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); - $aFileInfo['description'] = ''; - } - - if ((count($aFileInfo) > 0) && ($aFileInfo["idsfi"] != "")) { - $oVersion = new VersionFile($aFileInfo["idsfi"], $aFileInfo, $sFilename, $sTypeContent, $cfg, $cfgClient, $db, $client, $area, $frame, $sOrigFileName); - // Create new Layout Version in cms/version/css/ folder - $oVersion->createNewVersion(); - } - /** - * END TRACK VERSION - * */ - $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path); - } - - # generate edit form - if (isset($_REQUEST['action'])) { - $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action']; - - if ($_REQUEST['action'] == $sActionEdit) { - $sCode = getFileContent($sFilename, $path); - } else { - $sCode = $_REQUEST['code']; # stripslashes is required here in case of creating a new file - } - - /* Try to validate html */ - if (getEffectiveSetting("layout", "htmlvalidator", "true") == "true" && $sCode !== "") { - $v = new cHTMLValidator; - $v->validate($sCode); - $msg = ""; - - foreach ($v->missingNodes as $value) { - $idqualifier = ""; - - $attr = array(); - - if ($value["name"] != "") { - $attr["name"] = "name '" . $value["name"] . "'"; - } - - if ($value["id"] != "") { - $attr["id"] = "id '" . $value["id"] . "'"; - } - - $idqualifier = implode(", ", $attr); - - if ($idqualifier != "") { - $idqualifier = "($idqualifier)"; - } - $msg .= sprintf(i18n("Tag '%s' %s has no end tag (start tag is on line %s char %s)"), $value["tag"], $idqualifier, $value["line"], $value["char"]) . "
    "; - } - - if ($msg != "") { - $notis = $notification->returnNotification("warning", $msg) . "
    "; - } - } - - $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); - - $form = new UI_Table_Form("file_editor"); - $form->addHeader(i18n("Edit file")); - $form->setWidth("100%"); - $form->setVar("area", $area); - $form->setVar("action", $sAction); - $form->setVar("frame", $frame); - $form->setVar("status", 'send'); - $form->setVar("tmp_file", $sTempFilename); - - $tb_name = new cHTMLTextbox("file", $sFilename, 60); - $ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code"); - $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5); - - $ta_code->setStyle("font-family: monospace;width: 100%;"); - $descr->setStyle("font-family: monospace;width: 100%;"); - $ta_code->updateAttributes(array("wrap" => getEffectiveSetting('html_editor', 'wrap', 'off'))); - - $form->add(i18n("Name"), $tb_name); - $form->add(i18n("Description"), $descr->render()); - $form->add(i18n("Code"), $ta_code); - - $page->setContent($notis . $form->render()); - - $oEditArea = new EditArea('code', 'html', substr(strtolower($belang), 0, 2), true, $cfg); - $page->addScript('editarea', $oEditArea->renderScript()); - - $page->addScript('reload', $sReloadScript); - $page->render(); - } } -?> \ No newline at end of file + +// Render source editor +$editor->render(); \ No newline at end of file diff --git a/conlite/includes/include.html_tpl_edit_form_1.php b/conlite/includes/include.html_tpl_edit_form_1.php new file mode 100644 index 0000000..15b78ff --- /dev/null +++ b/conlite/includes/include.html_tpl_edit_form_1.php @@ -0,0 +1,208 @@ + + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + * @since file available since contenido release <= 4.6 + * + * {@internal + * created 2004-07-14 + * modified 2008-06-27, Frederic Schneider, add security fix + * modified 2008-08-14, Timo Trautmann, Bilal Arslan - Functions for versionning and storing file meta data added + * + * $Id$: + * }} + * + */ +if (!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + +cInclude("external", "edit_area/class.edit_area.php"); +cInclude("includes", "functions.file.php"); + +$sFileType = "html"; + +$sActionCreate = 'htmltpl_create'; +$sActionEdit = 'htmltpl_edit'; + +$page = new cPage; + +$tpl->reset(); + +if (!$perm->have_perm_area_action($area, $action)) { + $notification->displayNotification("error", i18n("Permission denied")); +} else if (!(int) $client > 0) { + #if there is no client selected, display empty page + $page->render(); +} else { + $path = $cfgClient[$client]["tpl"]["path"]; + $sTempFilename = stripslashes($_REQUEST['tmp_file']); + $sOrigFileName = $sTempFilename; + + if (getFileType($_REQUEST['file']) != $sFileType AND strlen(stripslashes(trim($_REQUEST['file']))) > 0) { + $sFilename .= stripslashes($_REQUEST['file']) . ".$sFileType"; + } else { + $sFilename .= stripslashes($_REQUEST['file']); + } + + if (stripslashes($_REQUEST['file'])) { + $sReloadScript = ""; + } else { + $sReloadScript = ""; + } + + // Content Type is template + $sTypeContent = "templates"; + $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); + + # create new file + if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') { + $sTempFilename = $sFilename; + createFile($sFilename, $path); + $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path); + $sReloadScript .= ""; + updateFileInformation($client, $sFilename, 'templates', $auth->auth['uid'], $_REQUEST['description'], $db); + } + + # edit selected file + if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') { + if ($sFilename != $sTempFilename) { + $sTempFilename = renameFile($sTempFilename, $sFilename, $path); + $sReloadScript .= ""; + } else { + $sTempFilename = $sFilename; + } + + updateFileInformation($client, $sOrigFileName, 'templates', $auth->auth['uid'], $_REQUEST['description'], $db, $sFilename); + + /** + * START TRACK VERSION + * */ + $sTypeContent = "templates"; + + if ((count($aFileInfo) == 0) || ((int) $aFileInfo["idsfi"] == 0)) { + $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); + $aFileInfo['description'] = ''; + } + + if ((count($aFileInfo) > 0) && ($aFileInfo["idsfi"] != "")) { + $oVersion = new VersionFile($aFileInfo["idsfi"], $aFileInfo, $sFilename, $sTypeContent, $cfg, $cfgClient, $db, $client, $area, $frame, $sOrigFileName); + // Create new Layout Version in cms/version/css/ folder + $oVersion->createNewVersion(); + } + /** + * END TRACK VERSION + * */ + $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path); + } + + # generate edit form + if (isset($_REQUEST['action'])) { + $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action']; + + if ($_REQUEST['action'] == $sActionEdit) { + $sCode = getFileContent($sFilename, $path); + } else { + $sCode = $_REQUEST['code']; # stripslashes is required here in case of creating a new file + } + + /* Try to validate html */ + if (getEffectiveSetting("layout", "htmlvalidator", "true") == "true" && $sCode !== "") { + $v = new cHTMLValidator; + $v->validate($sCode); + $msg = ""; + + foreach ($v->missingNodes as $value) { + $idqualifier = ""; + + $attr = array(); + + if ($value["name"] != "") { + $attr["name"] = "name '" . $value["name"] . "'"; + } + + if ($value["id"] != "") { + $attr["id"] = "id '" . $value["id"] . "'"; + } + + $idqualifier = implode(", ", $attr); + + if ($idqualifier != "") { + $idqualifier = "($idqualifier)"; + } + $msg .= sprintf(i18n("Tag '%s' %s has no end tag (start tag is on line %s char %s)"), $value["tag"], $idqualifier, $value["line"], $value["char"]) . "
    "; + } + + if ($msg != "") { + $notis = $notification->returnNotification("warning", $msg) . "
    "; + } + } + + $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); + + $form = new UI_Table_Form("file_editor"); + $form->addHeader(i18n("Edit file")); + $form->setWidth("100%"); + $form->setVar("area", $area); + $form->setVar("action", $sAction); + $form->setVar("frame", $frame); + $form->setVar("status", 'send'); + $form->setVar("tmp_file", $sTempFilename); + + $tb_name = new cHTMLTextbox("file", $sFilename, 60); + $ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code"); + $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5); + + $ta_code->setStyle("font-family: monospace;width: 100%;"); + $descr->setStyle("font-family: monospace;width: 100%;"); + $ta_code->updateAttributes(array("wrap" => getEffectiveSetting('html_editor', 'wrap', 'off'))); + + $form->add(i18n("Name"), $tb_name); + $form->add(i18n("Description"), $descr->render()); + $form->add(i18n("Code"), $ta_code); + + $page->setContent($notis . $form->render()); + + $oEditArea = new EditArea('code', 'html', substr(strtolower($belang), 0, 2), true, $cfg); + $page->addScript('editarea', $oEditArea->renderScript()); + + $page->addScript('reload', $sReloadScript); + $page->render(); + } +} +?> \ No newline at end of file diff --git a/conlite/includes/include.js_edit_form.php b/conlite/includes/include.js_edit_form.php index 3c663b1..69217fd 100644 --- a/conlite/includes/include.js_edit_form.php +++ b/conlite/includes/include.js_edit_form.php @@ -60,7 +60,11 @@ if (!$perm->have_perm_area_action($area, $action)) { } else { $sFilename .= stripslashes($_REQUEST['file']); } - + + if(!empty($_REQUEST['dirname']) && trim($_REQUEST['dirname']) != '.') { + $sFilename = stripslashes($_REQUEST['dirname']).DIRECTORY_SEPARATOR.$sFilename; + } + echo $sFilename; if (stripslashes($_REQUEST['file'])) { $sReloadScript = ""; + } else { + $sReloadScript = ""; + } +$sReloadScript = ""; + // Content Type is template + $sTypeContent = "js"; + $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); + + # create new file + if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') { + $sTempFilename = $sFilename; + createFile($sFilename, $path); + $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path); + updateFileInformation($client, $sFilename, 'js', $auth->auth['uid'], $_REQUEST['description'], $db); + $sReloadScript .= ""; + } + + # edit selected file + if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') { + if ($sFilename != $sTempFilename) { + $sTempFilename = renameFile($sTempFilename, $sFilename, $path); + $sReloadScript .= ""; + } else { + $sTempFilename = $sFilename; + } + + updateFileInformation($client, $sOrigFileName, 'js', $auth->auth['uid'], $_REQUEST['description'], $db, $sFilename); + + /** + * START TRACK VERSION + * */ + if ((count($aFileInfo) == 0) || ((int) $aFileInfo["idsfi"] == 0)) { + $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db); + $aFileInfo['description'] = ''; + } + + if (count($aFileInfo) > 0 && $aFileInfo["idsfi"] != "") { + $oVersion = new VersionFile($aFileInfo["idsfi"], $aFileInfo, $sFilename, $sTypeContent, $cfg, $cfgClient, $db, $client, $area, $frame, $sOrigFileName); + // Create new Jscript Version in cms/version/js/ folder + $oVersion->createNewVersion(); + } + + /** + * END TRACK VERSION + * */ + $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path); + } + + # generate edit form + if (isset($_REQUEST['action'])) { + $aFileInfo = getFileInformation($client, $sFilename, $sTypeContent, $db); + + $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action']; + + if ($_REQUEST['action'] == $sActionEdit) { + $sCode = getFileContent($sFilename, $path); + } else { + $sCode = $_REQUEST['code']; # stripslashes is required here in case of creating a new file + } + + $form = new UI_Table_Form("file_editor"); + $form->addHeader(i18n("Edit file")); + $form->setWidth("100%"); + $form->setVar("area", $area); + $form->setVar("action", $sAction); + $form->setVar("frame", $frame); + $form->setVar("status", 'send'); + $form->setVar("tmp_file", $sTempFilename); + print_r(pathinfo($sFilename)); + $tb_name = new cHTMLTextbox("file", pathinfo($sFilename, PATHINFO_BASENAME), 60); + $tb_path = new cHTMLHiddenField("dirname", pathinfo($sFilename, PATHINFO_DIRNAME)); + $ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code"); + $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5); + + $ta_code->setStyle("font-family: monospace;width: 100%;"); + $descr->setStyle("font-family: monospace;width: 100%;"); + $ta_code->updateAttributes(array("wrap" => getEffectiveSetting('script_editor', 'wrap', 'off'))); + + $form->add(i18n("Name"), $tb_name.$tb_path); + $form->add(i18n("Description"), $descr->render()); + $form->add(i18n("Code"), $ta_code); + + $page->setContent($form->render()); + + $oEditArea = new EditArea('code', 'js', substr(strtolower($belang), 0, 2), true, $cfg); + $page->addScript('editarea', $oEditArea->renderScript()); + + $page->addScript('reload', $sReloadScript); + $page->render(); + } +} +?> \ No newline at end of file diff --git a/conlite/includes/include.js_files_overview.php b/conlite/includes/include.js_files_overview.php index 611f761..f351b12 100644 --- a/conlite/includes/include.js_files_overview.php +++ b/conlite/includes/include.js_files_overview.php @@ -7,6 +7,13 @@ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } +if (!(int) $client > 0) { + #if there is no client selected, display empty page + $oPage = new cPage; + $oPage->render(); + return; +} + $oDirList = new cGuiFileList($cfgClient[$client]["js"]["path"], 'js'); $oDirList->scanDir(); diff --git a/conlite/includes/includes.zip b/conlite/includes/includes.zip new file mode 100644 index 0000000..b0905ef Binary files /dev/null and b/conlite/includes/includes.zip differ diff --git a/conlite/locale/conlite.pot b/conlite/locale/conlite.pot index 647fa0c..18dfa63 100644 --- a/conlite/locale/conlite.pot +++ b/conlite/locale/conlite.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-20 16:18+0200\n" +"POT-Creation-Date: 2021-07-02 13:08+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,11 +17,8 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: classes/con2con/class.filehandler.php:451 -msgid "Wrong file name." -msgstr "" - -#: classes/con2con/class.filehandler.php:467 +#: classes/con2con/class.filehandler.php:452 +#: classes/con2con/class.filehandler.php:464 msgid "Please insert file name." msgstr "" @@ -135,17 +132,17 @@ msgstr "" msgid "Note: This only affects the current history." msgstr "" -#: classes/contenido/class.module.php:389 includes/include.mod_edit_form.php:58 +#: classes/contenido/class.module.php:403 includes/include.mod_edit_form.php:58 msgid "- Unnamed Module -" msgstr "" -#: classes/contenido/class.module.php:910 +#: classes/contenido/class.module.php:922 msgid "" "Using old CamelCase for name of modulefolder. You may lowercase the name for " "modulefolder" msgstr "" -#: classes/contenido/class.module.php:913 +#: classes/contenido/class.module.php:925 msgid "" "Module uses Output- and/or InputFromFile. Editing and Saving may not be " "possible in backend." @@ -160,6 +157,10 @@ msgid "" "Layout uses LayFromFile. Editing and Saving may not be possible in backend." msgstr "" +#: classes/gui/class.file_list.php:55 +msgid "No files in directory." +msgstr "" + #: classes/class.notification.php:114 scripts/articleObject.js.php:228 #: scripts/articleObject.js.php:231 scripts/langref.php:14 msgid "Error" @@ -170,7 +171,6 @@ msgid "Warning" msgstr "" #: classes/class.notification.php:126 -#: templates/standard/template.mycontenido_lastarticles.html:67 msgid "Info" msgstr "" @@ -179,17 +179,12 @@ msgid "Notification" msgstr "" #: classes/class.navigation.php:332 classes/class.navigation.php:335 -#: templates/standard/template.log_main.html:18 -#: templates/standard/template.log_main.html:48 #: includes/include.system_purge.php:195 #: includes/include.con_editcontent.php:397 msgid "Client" msgstr "" #: classes/class.navigation.php:352 -#: templates/standard/template.symbolhelp.html:1823 -#: templates/standard/template.log_main.html:22 -#: templates/standard/template.log_main.html:50 msgid "User" msgstr "" @@ -208,7 +203,6 @@ msgid "Save changes" msgstr "" #: classes/class.request.password.php:247 -#: templates/standard/template.symbolhelp.html:196 msgid "Submit" msgstr "" @@ -265,14 +259,8 @@ msgid "No data found!" msgstr "" #: classes/class.ajax.php:153 classes/class.cms_teaser.php:594 -#: templates/standard/template.mycontenido_lastarticles.html:63 -#: templates/standard/template.symbolhelp.html:41 -#: templates/standard/template.symbolhelp.html:472 -#: templates/standard/template.log_main.html:52 -#: templates/standard/template.str_overview.html:124 -#: templates/standard/template.str_overview.html:224 #: includes/grouprights_str.inc.php:76 includes/include.con_editcontent.php:387 -#: includes/include.con_edit_form.php:510 includes/rights_con.inc.php:78 +#: includes/include.con_edit_form.php:474 includes/rights_con.inc.php:78 #: includes/include.note.popup.php:93 includes/grouprights_con.inc.php:78 #: includes/rights_str.inc.php:77 msgid "Category" @@ -287,9 +275,6 @@ msgid "idlang" msgstr "" #: classes/class.ajax.php:162 classes/class.ajax.php:179 -#: templates/standard/template.lay_edit_form.html:22 -#: templates/standard/template.tpl_edit_form.html:19 -#: templates/standard/template.mod_edit_form.html:23 #: includes/include.mod_package.php:235 includes/include.mod_package.php:253 #: includes/include.mod_package.php:422 includes/include.lay_edit_form.php:182 #: includes/include.mod_new.php:87 includes/include.lay_history.php:120 @@ -301,20 +286,18 @@ msgstr "" #: includes/include.html_tpl_history.php:163 #: includes/include.rights_left_top.php:116 #: includes/include.style_history.php:160 -#: includes/include.html_tpl_edit_form.php:213 -#: includes/include.style_edit_form.php:197 -#: includes/include.js_edit_form.php:175 +#: includes/include.html_tpl_edit_form.php:195 +#: includes/include.style_edit_form.php:183 +#: includes/include.js_edit_form.php:168 #: includes/include.rights_overview.php:209 includes/include.js_history.php:155 #: includes/include.clientsettings.php:95 #: includes/include.clientsettings.php:187 -#: includes/include.tpl_edit_form.php:151 includes/include.mod_history.php:131 +#: includes/include.tpl_edit_form.php:151 +#: includes/include.js_edit_form_1.php:175 includes/include.mod_history.php:131 msgid "Name" msgstr "" #: classes/class.ajax.php:170 classes/class.cms_teaser.php:595 -#: templates/standard/template.symbolhelp.html:38 -#: templates/standard/template.symbolhelp.html:283 -#: templates/standard/template.log_main.html:53 #: includes/include.con_editcontent.php:382 #: includes/include.con_art_overview.php:73 includes/include.con_subnav.php:104 #: backend_search.php:491 @@ -471,7 +454,7 @@ msgstr "" #: classes/class.cms_teaser.php:353 classes/class.cms_teaser.php:381 #: classes/class.cms_teaser.php:418 classes/class.cms_teaser.php:446 #: classes/class.cms_teaser.php:475 classes/class.cms_teaser.php:538 -#: includes/functions.general.php:1160 includes/functions.general.php:1200 +#: includes/functions.general.php:1155 includes/functions.general.php:1195 #: includes/include.str_overview.php:89 includes/include.CMS_LINK.php:215 #: includes/include.CMS_LINK.php:244 includes/include.CMS_LINK.php:273 #: includes/include.CMS_LINK.php:288 includes/include.CMS_LINK.php:304 @@ -664,12 +647,10 @@ msgid "Default Style" msgstr "" #: classes/class.cms_filelist.php:438 -#: templates/standard/template.upl_files_overview.html:82 msgid "Filename" msgstr "" #: classes/class.cms_filelist.php:441 -#: templates/standard/template.upl_files_overview.html:86 msgid "File size" msgstr "" @@ -692,7 +673,6 @@ msgid "Directories" msgstr "" #: classes/class.cms_filelist.php:722 -#: templates/standard/template.log_main.html:14 msgid "Filter" msgstr "" @@ -925,589 +905,6 @@ msgstr "" msgid "Clear contents" msgstr "" -#: templates/standard/template.info.html:15 -msgid "Concept and Implementation" -msgstr "" - -#: templates/standard/template.info.html:15 -msgid "Germany" -msgstr "" - -#: templates/standard/template.info.html:15 -msgid "Phone" -msgstr "" - -#: templates/standard/template.stat_overview.html:135 -#: includes/include.str_overview.php:572 includes/include.str_overview.php:573 -#: includes/include.str_overview.php:574 includes/include.con_left_top.php:428 -#: includes/include.con_str_overview.php:614 -msgid "Close all categories" -msgstr "" - -#: templates/standard/template.stat_overview.html:137 -#: includes/include.str_overview.php:578 includes/include.str_overview.php:579 -#: includes/include.str_overview.php:580 includes/include.con_left_top.php:429 -#: includes/include.con_str_overview.php:615 -msgid "Open all categories" -msgstr "" - -#: templates/standard/template.welcome.html:22 -msgid "Available clients" -msgstr "" - -#: templates/standard/template.welcome.html:42 -msgid "Currently" -msgstr "" - -#: templates/standard/template.welcome.html:42 -msgid "Users online" -msgstr "" - -#: templates/standard/template.welcome.html:50 -msgid "Contact System Administrators" -msgstr "" - -#: templates/standard/template.system_variables.html:16 -msgid "Your system configuration" -msgstr "" - -#: templates/standard/template.system_variables.html:21 -msgid "Variable" -msgstr "" - -#: templates/standard/template.system_variables.html:22 -msgid "Local value" -msgstr "" - -#: templates/standard/template.system_variables.html:37 -msgid "Contenido Error Log" -msgstr "" - -#: templates/standard/template.system_variables.html:50 -msgid "clear error log" -msgstr "" - -#: templates/standard/template.system_variables.html:58 -msgid "Contenido Upgrade Error Log" -msgstr "" - -#: templates/standard/template.system_variables.html:72 -msgid "clear upgrade error log" -msgstr "" - -#: templates/standard/template.mycontenido_lastarticles.html:35 -msgid "Your clients" -msgstr "" - -#: templates/standard/template.mycontenido_lastarticles.html:61 -#: includes/include.upl_artlist.php:81 -msgid "Start" -msgstr "" - -#: templates/standard/template.mycontenido_lastarticles.html:62 -#: includes/include.stat_overview.php:89 includes/include.con_edit_form.php:208 -#: includes/include.upl_artlist.php:81 includes/include.con_art_overview.php:74 -#: includes/include.con_art_overview.php:659 backend_search.php:492 -msgid "Title" -msgstr "" - -#: templates/standard/template.mycontenido_lastarticles.html:64 -#: includes/include.mycontenido.tasks.php:276 -#: includes/include.con_edit_form.php:284 includes/include.upl_artlist.php:81 -msgid "Created" -msgstr "" - -#: templates/standard/template.mycontenido_lastarticles.html:65 -#: includes/include.upl_artlist.php:81 -msgid "Modified" -msgstr "" - -#: templates/standard/template.mycontenido_lastarticles.html:66 -#: templates/standard/template.str_overview.html:230 -#: includes/include.con_art_overview.php:78 -#: includes/include.pretplcfg_edit_form.php:76 -#: includes/include.tplcfg_edit_form.php:276 backend_search.php:496 -msgid "Template" -msgstr "" - -#: templates/standard/template.rights_inc.html:24 -msgid "Client / Language" -msgstr "" - -#: templates/standard/template.lay_edit_form.html:32 -#: templates/standard/template.tpl_edit_form.html:29 -#: templates/standard/template.upl_files_overview.html:84 -#: templates/standard/template.mod_edit_form.html:33 scripts/langref.php:28 -#: includes/include.lay_edit_form.php:183 includes/include.mod_new.php:109 -#: includes/include.CMS_SIMPLELINK.php:153 includes/rights_lay.inc.php:76 -#: includes/grouprights_mod.inc.php:74 includes/include.todo.popup.php:70 -#: includes/include.lay_history.php:121 includes/include.mod_edit_form.php:385 -#: includes/include.html_tpl_history.php:164 -#: includes/include.style_history.php:161 includes/grouprights_lay.inc.php:86 -#: includes/include.html_tpl_edit_form.php:214 includes/include.upl_edit.php:95 -#: includes/include.style_edit_form.php:198 -#: includes/include.js_edit_form.php:176 includes/include.CMS_LINK.php:341 -#: includes/include.js_history.php:156 includes/rights_mod.inc.php:76 -#: includes/include.grouprights_overview.php:118 -#: includes/grouprights_tpl.inc.php:73 includes/rights_tpl.inc.php:74 -#: includes/include.CMS_IMG.php:278 includes/include.tpl_edit_form.php:154 -#: includes/include.mycontenido.tasks.edit.php:71 -#: includes/include.grouprights_create.php:112 -#: includes/include.mod_history.php:132 -msgid "Description" -msgstr "" - -#: templates/standard/template.con_edit_form.html:141 -#: includes/include.upl_edit.php:100 -msgid "Time control" -msgstr "" - -#: templates/standard/template.con_edit_form.html:144 -#: includes/include.upl_edit.php:209 -msgid "Use time control" -msgstr "" - -#: templates/standard/template.con_edit_form.html:146 -#: templates/standard/template.log_main.html:30 -#: includes/include.upl_edit.php:215 -msgid "Start date" -msgstr "" - -#: templates/standard/template.con_edit_form.html:150 -#: templates/standard/template.log_main.html:34 -#: includes/include.todo.popup.php:79 includes/include.upl_edit.php:219 -#: includes/include.mycontenido.tasks.edit.php:75 -msgid "End date" -msgstr "" - -#: templates/standard/template.con_edit_form.html:153 -msgid "When expired, move to category" -msgstr "" - -#: templates/standard/template.con_edit_form.html:155 -msgid "Make online after move" -msgstr "" - -#: templates/standard/template.con_edit_form.html:184 -msgid "Page title" -msgstr "" - -#: templates/standard/template.con_edit_form.html:190 -msgid "Meta tags" -msgstr "" - -#: templates/standard/template.symbolhelp.html:23 -msgid "Table of contents" -msgstr "" - -#: templates/standard/template.symbolhelp.html:29 -#: templates/standard/template.symbolhelp.html:135 -msgid "Common" -msgstr "" - -#: templates/standard/template.symbolhelp.html:35 -#: templates/standard/template.symbolhelp.html:277 -msgid "Content" -msgstr "" - -#: templates/standard/template.symbolhelp.html:44 -#: templates/standard/template.symbolhelp.html:740 -msgid "File management" -msgstr "" - -#: templates/standard/template.symbolhelp.html:50 -#: templates/standard/template.symbolhelp.html:816 -msgid "Style" -msgstr "" - -#: templates/standard/template.symbolhelp.html:53 -#: templates/standard/template.symbolhelp.html:822 -#: includes/include.mod_package.php:191 -msgid "Layouts" -msgstr "" - -#: templates/standard/template.symbolhelp.html:56 -#: templates/standard/template.symbolhelp.html:904 -msgid "Modules" -msgstr "" - -#: templates/standard/template.symbolhelp.html:59 -#: templates/standard/template.symbolhelp.html:985 -msgid "Templates" -msgstr "" - -#: templates/standard/template.symbolhelp.html:62 -#: templates/standard/template.symbolhelp.html:1055 -msgid "CSS editor" -msgstr "" - -#: templates/standard/template.symbolhelp.html:65 -#: templates/standard/template.symbolhelp.html:1110 -msgid "Script editor" -msgstr "" - -#: templates/standard/template.symbolhelp.html:68 -#: templates/standard/template.symbolhelp.html:1165 -msgid "Module Templates" -msgstr "" - -#: templates/standard/template.symbolhelp.html:74 -#: templates/standard/template.symbolhelp.html:1242 -msgid "Extras" -msgstr "" - -#: templates/standard/template.symbolhelp.html:77 -#: templates/standard/template.symbolhelp.html:1248 -msgid "Newsletter" -msgstr "" - -#: templates/standard/template.symbolhelp.html:80 -msgid "Recipients" -msgstr "" - -#: templates/standard/template.symbolhelp.html:86 -#: templates/standard/template.symbolhelp.html:1466 -msgid "Statistics" -msgstr "" - -#: templates/standard/template.symbolhelp.html:89 -#: templates/standard/template.symbolhelp.html:1472 -#: includes/include.stat_overview.php:92 -msgid "Hits" -msgstr "" - -#: templates/standard/template.symbolhelp.html:95 -#: templates/standard/template.symbolhelp.html:1548 -msgid "Administration" -msgstr "" - -#: templates/standard/template.symbolhelp.html:98 -#: templates/standard/template.symbolhelp.html:1554 -msgid "Users" -msgstr "" - -#: templates/standard/template.symbolhelp.html:101 -#: templates/standard/template.symbolhelp.html:1609 -msgid "Groups" -msgstr "" - -#: templates/standard/template.symbolhelp.html:104 -#: templates/standard/template.symbolhelp.html:1664 -msgid "Languages" -msgstr "" - -#: templates/standard/template.symbolhelp.html:107 -#: templates/standard/template.symbolhelp.html:1734 -msgid "Clients" -msgstr "" - -#: templates/standard/template.symbolhelp.html:129 -msgid "Table of Contents" -msgstr "" - -#: templates/standard/template.symbolhelp.html:166 -msgid "Execute query / Save" -msgstr "" - -#: templates/standard/template.symbolhelp.html:181 scripts/messageBox.js.php:79 -#: scripts/langref.php:21 includes/include.mod_package.php:311 -msgid "Cancel" -msgstr "" - -#: templates/standard/template.symbolhelp.html:208 -msgid "Change to MyContenido (Personal Settings)" -msgstr "" - -#: templates/standard/template.symbolhelp.html:220 -msgid "Information (Impressum)" -msgstr "" - -#: templates/standard/template.symbolhelp.html:235 -msgid "Logout" -msgstr "" - -#: templates/standard/template.symbolhelp.html:314 -#: templates/standard/template.symbolhelp.html:506 -#: templates/standard/template.str_overview.html:148 -#: includes/cfg_language_de.inc.php:132 includes/include.str_overview.php:1041 -#: includes/include.str_overview.php:1044 -msgid "Configure category" -msgstr "" - -#: templates/standard/template.symbolhelp.html:329 -#: includes/include.con_art_overview.php:887 -#: includes/include.con_art_overview.php:888 -msgid "Create new article" -msgstr "" - -#: templates/standard/template.symbolhelp.html:341 -msgid "Article is start article / is not start article" -msgstr "" - -#: templates/standard/template.symbolhelp.html:353 -#: templates/standard/template.symbolhelp.html:868 -#: templates/standard/template.symbolhelp.html:949 -msgid "Set template / Add to To-Do list" -msgstr "" - -#: templates/standard/template.symbolhelp.html:365 -msgid "Configure article properties" -msgstr "" - -#: templates/standard/template.symbolhelp.html:377 -#: includes/cfg_language_de.inc.php:110 backend_search.php:677 -msgid "Configure template" -msgstr "" - -#: templates/standard/template.symbolhelp.html:389 -msgid "Element is online / offline (change through click)" -msgstr "" - -#: templates/standard/template.symbolhelp.html:401 -msgid "Element is protected / accessible (change through click)" -msgstr "" - -#: templates/standard/template.symbolhelp.html:413 -#: includes/include.con_art_overview.php:503 backend_search.php:675 -msgid "Duplicate article" -msgstr "" - -#: templates/standard/template.symbolhelp.html:425 -#: includes/cfg_language_de.inc.php:106 -#: includes/include.con_art_overview.php:551 backend_search.php:678 -msgid "Delete article" -msgstr "" - -#: templates/standard/template.symbolhelp.html:439 -msgid "Lock / unlock folder (change through click)" -msgstr "" - -#: templates/standard/template.symbolhelp.html:451 -msgid "Set folder offline / online (change through click)" -msgstr "" - -#: templates/standard/template.symbolhelp.html:524 -#: includes/cfg_language_de.inc.php:120 -msgid "Rename category" -msgstr "" - -#: templates/standard/template.symbolhelp.html:542 -msgid "Create category" -msgstr "" - -#: templates/standard/template.symbolhelp.html:560 -msgid "Set category online / offline" -msgstr "" - -#: templates/standard/template.symbolhelp.html:578 -msgid "Category is online and unprotected / protected" -msgstr "" - -#: templates/standard/template.symbolhelp.html:596 -msgid "Category is offline and unprotected / protected" -msgstr "" - -#: templates/standard/template.symbolhelp.html:614 -msgid "Category is online, contains an error and is unprotected / protected" -msgstr "" - -#: templates/standard/template.symbolhelp.html:632 -msgid "Category is offline, contains an error and is unprotected / protected" -msgstr "" - -#: templates/standard/template.symbolhelp.html:650 -msgid "Move up one category" -msgstr "" - -#: templates/standard/template.symbolhelp.html:665 -#: includes/cfg_language_de.inc.php:129 -msgid "Move category" -msgstr "" - -#: templates/standard/template.symbolhelp.html:683 -msgid "Select move target" -msgstr "" - -#: templates/standard/template.symbolhelp.html:701 -#: includes/cfg_language_de.inc.php:131 -msgid "Duplicate category" -msgstr "" - -#: templates/standard/template.symbolhelp.html:716 -#: templates/standard/template.symbolhelp.html:880 -#: templates/standard/template.symbolhelp.html:961 -#: templates/standard/template.symbolhelp.html:1031 -#: templates/standard/template.symbolhelp.html:1086 -#: templates/standard/template.symbolhelp.html:1141 -#: templates/standard/template.symbolhelp.html:1196 -#: templates/standard/template.symbolhelp.html:1306 -#: templates/standard/template.symbolhelp.html:1421 -#: templates/standard/template.symbolhelp.html:1585 -#: templates/standard/template.symbolhelp.html:1640 -#: templates/standard/template.symbolhelp.html:1710 -#: templates/standard/template.symbolhelp.html:1765 -#: templates/standard/template.symbolhelp.html:1871 -msgid "Delete / Delete not available" -msgstr "" - -#: templates/standard/template.symbolhelp.html:762 -msgid "Root upload folder" -msgstr "" - -#: templates/standard/template.symbolhelp.html:780 -msgid "Regular folder" -msgstr "" - -#: templates/standard/template.symbolhelp.html:853 -msgid "Layout in use" -msgstr "" - -#: templates/standard/template.symbolhelp.html:934 -msgid "Module in use" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1016 -#: includes/include.tpl_overview.php:111 includes/cfg_language_de.inc.php:167 -#: includes/cfg_language_de.inc.php:168 -msgid "Duplicate template" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1279 -#: includes/cfg_language_de.inc.php:217 -msgid "Create newsletter" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1294 -msgid "Copy newsletter" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1330 -#: templates/standard/template.symbolhelp.html:1361 -msgid "Recipient" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1373 -#: includes/cfg_language_de.inc.php:229 -msgid "Create recipient" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1385 -msgid "Remove recipient" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1397 -msgid "Recipient group" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1409 -#: includes/cfg_language_de.inc.php:235 -msgid "Create recipient group" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1503 -msgid "Article is online / offline" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1695 -msgid "Language active / not active" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1835 -#: includes/include.rights_left_top.php:103 -#: includes/cfg_language_de.inc.php:171 includes/cfg_language_de.inc.php:174 -#: includes/include.frontend.left_top.php:178 -msgid "Create user" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1847 -msgid "User group" -msgstr "" - -#: templates/standard/template.symbolhelp.html:1859 -msgid "Create user group" -msgstr "" - -#: templates/standard/template.log_main.html:15 -#: includes/include.systemsettings.php:60 -#: includes/include.systemsettings.php:174 -#: includes/include.rights_create.php:147 includes/include.client_edit.php:226 -#: includes/include.rights_overview.php:200 -#: includes/include.rights_overview.php:354 -#: includes/include.grouprights_overview.php:109 -#: includes/include.grouprights_overview.php:210 -#: includes/include.clientsettings.php:95 -#: includes/include.clientsettings.php:191 -#: includes/include.grouprights_create.php:99 -msgid "Value" -msgstr "" - -#: templates/standard/template.log_main.html:26 -#: templates/standard/template.log_main.html:51 -#: includes/include.mod_package.php:254 -msgid "Action" -msgstr "" - -#: templates/standard/template.log_main.html:38 -#: templates/standard/template.recipient_menu.html:88 -msgid "Limit" -msgstr "" - -#: templates/standard/template.log_main.html:49 -msgid "Date" -msgstr "" - -#: templates/standard/template.tpl_edit_form.html:42 -#: includes/include.lay_overview.php:101 includes/include.tpl_edit_form.php:160 -msgid "Layout" -msgstr "" - -#: templates/standard/template.tpl_edit_form.html:55 -#: includes/include.tpl_edit_form.php:161 -msgid "Layout description" -msgstr "" - -#: templates/standard/template.upl_files_overview.html:61 -msgid "Sort files" -msgstr "" - -#: templates/standard/template.upl_files_overview.html:88 -msgid "Image size" -msgstr "" - -#: templates/standard/template.str_overview.html:133 -#: templates/standard/template.str_overview.html:227 -#: includes/include.con_edit_form.php:211 includes/include.str_overview.php:594 -msgid "Alias" -msgstr "" - -#: templates/standard/template.str_overview.html:139 -#: includes/cfg_language_de.inc.php:105 includes/cfg_language_de.inc.php:124 -#: includes/include.str_overview.php:1055 -#: includes/include.str_overview.php:1057 -msgid "Protect category" -msgstr "" - -#: templates/standard/template.str_overview.html:157 -msgid "Category is a tree" -msgstr "" - -#: templates/standard/template.str_overview.html:164 -msgid "Position of category" -msgstr "" - -#: templates/standard/template.str_overview.html:233 -#: includes/include.mycontenido.tasks.php:276 -#: includes/include.frontend.left_top.php:165 -#: includes/include.con_art_overview.php:79 -#: includes/include.upl_files_overview.php:530 backend_search.php:497 -msgid "Actions" -msgstr "" - -#: templates/standard/template.recipient_menu.html:92 -#: includes/include.con_left_top.php:237 -msgid "Search" -msgstr "" - #: scripts/iZoom.js.php:70 scripts/iZoom.js.php:73 scripts/rights.js.php:67 #: scripts/rights.js.php:70 scripts/langref.php:23 msgid "Click to close" @@ -1544,6 +941,11 @@ msgstr "" msgid "Confirm" msgstr "" +#: scripts/messageBox.js.php:79 scripts/langref.php:21 +#: includes/include.mod_package.php:311 +msgid "Cancel" +msgstr "" + #: scripts/messageBox.js.php:80 scripts/langref.php:22 msgid "Close window" msgstr "" @@ -1601,6 +1003,27 @@ msgstr "" msgid "Picture" msgstr "" +#: scripts/langref.php:28 includes/include.lay_edit_form.php:183 +#: includes/include.mod_new.php:109 includes/include.CMS_SIMPLELINK.php:153 +#: includes/rights_lay.inc.php:76 includes/grouprights_mod.inc.php:74 +#: includes/include.todo.popup.php:70 includes/include.lay_history.php:121 +#: includes/include.mod_edit_form.php:385 +#: includes/include.html_tpl_history.php:164 +#: includes/include.style_history.php:161 includes/grouprights_lay.inc.php:86 +#: includes/include.html_tpl_edit_form.php:196 includes/include.upl_edit.php:95 +#: includes/include.style_edit_form.php:184 +#: includes/include.js_edit_form.php:169 includes/include.CMS_LINK.php:341 +#: includes/include.js_history.php:156 includes/rights_mod.inc.php:76 +#: includes/include.grouprights_overview.php:118 +#: includes/grouprights_tpl.inc.php:73 includes/rights_tpl.inc.php:74 +#: includes/include.CMS_IMG.php:278 includes/include.tpl_edit_form.php:154 +#: includes/include.js_edit_form_1.php:176 +#: includes/include.mycontenido.tasks.edit.php:71 +#: includes/include.grouprights_create.php:112 +#: includes/include.mod_history.php:132 +msgid "Description" +msgstr "" + #: scripts/langref.php:29 msgid "Description / Standard" msgstr "" @@ -1617,17 +1040,31 @@ msgstr "" msgid "Frame" msgstr "" +#: includes/include.js_files_overview_1.php:104 #: includes/include.mod_package.php:111 -#: includes/include.js_files_overview.php:104 #: includes/include.html_tpl_files_overview.php:105 -#: includes/include.style_files_overview.php:104 +#: includes/include.style_files_overview.php:130 msgid "is not readable!" msgstr "" -#: includes/include.mod_package.php:123 -#: includes/include.js_files_overview.php:155 -#: includes/include.html_tpl_files_overview.php:156 +#: includes/include.js_files_overview_1.php:131 +#: includes/include.system_db_backup.php:293 +#: includes/include.html_tpl_files_overview.php:132 #: includes/include.style_files_overview.php:155 +msgid "Delete File" +msgstr "" + +#: includes/include.js_files_overview_1.php:132 +#: includes/include.html_tpl_files_overview.php:133 +#: includes/include.style_files_overview.php:156 +#, php-format +msgid "Do you really want to delete the following file:

    %s
    " +msgstr "" + +#: includes/include.js_files_overview_1.php:155 +#: includes/include.mod_package.php:123 +#: includes/include.html_tpl_files_overview.php:156 +#: includes/include.style_files_overview.php:175 msgid "Directory is not existing or readable!" msgstr "" @@ -1656,6 +1093,10 @@ msgstr "" msgid "Style files" msgstr "" +#: includes/include.mod_package.php:191 +msgid "Layouts" +msgstr "" + #: includes/include.mod_package.php:192 msgid "Translations" msgstr "" @@ -1705,6 +1146,10 @@ msgstr "" msgid "Status" msgstr "" +#: includes/include.mod_package.php:254 +msgid "Action" +msgstr "" + #: includes/include.mod_package.php:312 msgid "Import" msgstr "" @@ -1793,7 +1238,7 @@ msgstr "" msgid "Current user doesn't have any rights to any client/language." msgstr "" -#: includes/include.upl_dirs_overview.php:56 +#: includes/include.upl_dirs_overview.php:53 #: includes/grouprights_str.inc.php:215 includes/include.str_overview.php:162 #: includes/rights_con.inc.php:227 includes/functions.stat.php:313 #: includes/functions.stat.php:314 includes/functions.stat.php:644 @@ -1802,56 +1247,56 @@ msgstr "" msgid "Open category" msgstr "" -#: includes/include.upl_dirs_overview.php:60 +#: includes/include.upl_dirs_overview.php:56 #: includes/grouprights_str.inc.php:215 includes/include.str_overview.php:167 #: includes/rights_con.inc.php:227 includes/grouprights_con.inc.php:241 #: includes/rights_str.inc.php:221 msgid "Close category" msgstr "" -#: includes/include.upl_dirs_overview.php:153 +#: includes/include.upl_dirs_overview.php:132 msgid "Failed to delete the following files:" msgstr "" -#: includes/include.upl_dirs_overview.php:159 +#: includes/include.upl_dirs_overview.php:136 #, php-format msgid "Failed to remove directory %s" msgstr "" -#: includes/include.upl_dirs_overview.php:190 +#: includes/include.upl_dirs_overview.php:167 msgid "Upload directory" msgstr "" -#: includes/include.upl_dirs_overview.php:194 +#: includes/include.upl_dirs_overview.php:171 msgid "" "The following directories contains invalid characters and were ignored: " msgstr "" -#: includes/include.upl_dirs_overview.php:197 +#: includes/include.upl_dirs_overview.php:174 msgid "Please click here in order to rename automatically." msgstr "" -#: includes/include.upl_dirs_overview.php:319 +#: includes/include.upl_dirs_overview.php:272 msgid "Categories" msgstr "" -#: includes/include.upl_dirs_overview.php:400 -#: includes/include.upl_dirs_overview.php:547 +#: includes/include.upl_dirs_overview.php:347 +#: includes/include.upl_dirs_overview.php:479 msgid "Delete directory" msgstr "" -#: includes/include.upl_dirs_overview.php:400 -#: includes/include.upl_dirs_overview.php:547 +#: includes/include.upl_dirs_overview.php:347 +#: includes/include.upl_dirs_overview.php:479 msgid "Do you really want to delete the following directory:" msgstr "" -#: includes/include.upl_dirs_overview.php:405 -#: includes/include.upl_dirs_overview.php:552 +#: includes/include.upl_dirs_overview.php:350 +#: includes/include.upl_dirs_overview.php:482 msgid "Directory contains files" msgstr "" -#: includes/include.upl_dirs_overview.php:408 -#: includes/include.upl_dirs_overview.php:555 +#: includes/include.upl_dirs_overview.php:352 +#: includes/include.upl_dirs_overview.php:484 #: includes/include.lay_edit_form.php:41 includes/include.lay_edit_form.php:48 #: includes/include.lang_edit.php:122 includes/rights_lay.inc.php:57 #: includes/grouprights_mod.inc.php:54 includes/grouprights_str.inc.php:54 @@ -1859,12 +1304,12 @@ msgstr "" #: includes/include.rights_create.php:43 #: includes/include.html_tpl_history.php:59 #: includes/include.system_purge.php:37 includes/include.style_history.php:57 -#: includes/include.con_edit_form.php:764 includes/grouprights_lay.inc.php:55 +#: includes/include.con_edit_form.php:713 includes/grouprights_lay.inc.php:55 #: includes/grouprights_lay.inc.php:74 -#: includes/include.html_tpl_edit_form.php:50 +#: includes/include.html_tpl_edit_form.php:49 #: includes/grouprights_members.inc.php:41 includes/include.client_edit.php:46 -#: includes/include.style_edit_form.php:51 includes/include.logs.php:46 -#: includes/include.js_edit_form.php:50 includes/include.rights_overview.php:49 +#: includes/include.style_edit_form.php:50 includes/include.logs.php:46 +#: includes/include.js_edit_form.php:49 includes/include.rights_overview.php:49 #: includes/rights_con.inc.php:56 includes/include.js_history.php:55 #: includes/rights_mod.inc.php:55 includes/include.grouprights_overview.php:42 #: includes/grouprights_tpl.inc.php:53 includes/grouprights_area.inc.php:65 @@ -1875,12 +1320,13 @@ msgstr "" #: includes/include.con_art_overview.php:908 includes/rights_tpl.inc.php:55 #: includes/include.tpl_edit_form.php:39 #: includes/include.tplcfg_edit_form.php:144 includes/rights_str.inc.php:55 +#: includes/include.js_edit_form_1.php:50 #: includes/include.grouprights_create.php:42 #: includes/include.mod_history.php:52 msgid "Permission denied" msgstr "" -#: includes/include.upl_dirs_overview.php:454 +#: includes/include.upl_dirs_overview.php:394 msgid "Database Filesystem" msgstr "" @@ -1910,7 +1356,7 @@ msgid "" msgstr "" #: includes/include.lay_edit_form.php:154 -#: includes/include.html_tpl_edit_form.php:185 +#: includes/include.html_tpl_edit_form.php:168 #, php-format msgid "Tag '%s' %s has no end tag (start tag is on line %s char %s)" msgstr "" @@ -1927,9 +1373,10 @@ msgstr "" #: includes/include.lay_edit_form.php:195 includes/include.lay_history.php:122 #: includes/include.html_tpl_history.php:165 #: includes/include.style_history.php:162 -#: includes/include.html_tpl_edit_form.php:215 -#: includes/include.style_edit_form.php:199 -#: includes/include.js_edit_form.php:177 includes/include.js_history.php:157 +#: includes/include.html_tpl_edit_form.php:197 +#: includes/include.style_edit_form.php:185 +#: includes/include.js_edit_form.php:170 includes/include.js_history.php:157 +#: includes/include.js_edit_form_1.php:177 msgid "Code" msgstr "" @@ -2138,10 +1585,20 @@ msgstr "" msgid "Current" msgstr "" +#: includes/include.stat_overview.php:89 includes/include.con_edit_form.php:197 +#: includes/include.upl_artlist.php:81 includes/include.con_art_overview.php:74 +#: includes/include.con_art_overview.php:659 backend_search.php:492 +msgid "Title" +msgstr "" + #: includes/include.stat_overview.php:91 includes/functions.system.php:405 msgid "Number of articles" msgstr "" +#: includes/include.stat_overview.php:92 +msgid "Hits" +msgstr "" + #: includes/include.stat_overview.php:94 msgid "Hits in this language" msgstr "" @@ -2197,13 +1654,6 @@ msgstr "" msgid "File successfully deleted." msgstr "" -#: includes/include.system_db_backup.php:293 -#: includes/include.js_files_overview.php:131 -#: includes/include.html_tpl_files_overview.php:132 -#: includes/include.style_files_overview.php:131 -msgid "Delete File" -msgstr "" - #: includes/include.system_db_backup.php:300 msgid "Download File" msgstr "" @@ -2212,12 +1662,12 @@ msgstr "" msgid "Saterday" msgstr "" -#: includes/functions.general.php:2010 +#: includes/functions.general.php:2007 #, php-format msgid "MySQL Database not reachable for installation %s" msgstr "" -#: includes/functions.general.php:2013 +#: includes/functions.general.php:2010 #, php-format msgid "" "The MySQL Database for the installation %s is not reachable. Please check if " @@ -2268,6 +1718,11 @@ msgstr "" msgid "Reminder date" msgstr "" +#: includes/include.todo.popup.php:79 includes/include.upl_edit.php:219 +#: includes/include.mycontenido.tasks.edit.php:75 +msgid "End date" +msgstr "" + #: includes/include.todo.popup.php:80 msgid "eMail notification" msgstr "" @@ -2329,6 +1784,10 @@ msgstr "" msgid "Do you really want to delete the following layout:

    %s
    " msgstr "" +#: includes/include.lay_overview.php:101 includes/include.tpl_edit_form.php:160 +msgid "Layout" +msgstr "" + #: includes/include.lay_overview.php:118 #, php-format msgid "The layout '%s' is used for following templates" @@ -2402,6 +1861,11 @@ msgstr "" msgid "Day(s)" msgstr "" +#: includes/include.mycontenido.tasks.php:276 +#: includes/include.con_edit_form.php:268 includes/include.upl_artlist.php:81 +msgid "Created" +msgstr "" + #: includes/include.mycontenido.tasks.php:276 msgid "End Date" msgstr "" @@ -2420,6 +1884,13 @@ msgstr "" msgid "Due in" msgstr "" +#: includes/include.mycontenido.tasks.php:276 +#: includes/include.frontend.left_top.php:165 +#: includes/include.con_art_overview.php:79 +#: includes/include.upl_files_overview.php:530 backend_search.php:497 +msgid "Actions" +msgstr "" + #: includes/include.mycontenido.tasks.php:302 msgid "Unnamed item" msgstr "" @@ -2464,6 +1935,19 @@ msgstr "" msgid "Please set this property in systemsettings directly" msgstr "" +#: includes/include.systemsettings.php:60 +#: includes/include.systemsettings.php:174 +#: includes/include.rights_create.php:147 includes/include.client_edit.php:226 +#: includes/include.rights_overview.php:200 +#: includes/include.rights_overview.php:354 +#: includes/include.grouprights_overview.php:109 +#: includes/include.grouprights_overview.php:210 +#: includes/include.clientsettings.php:95 +#: includes/include.clientsettings.php:191 +#: includes/include.grouprights_create.php:99 +msgid "Value" +msgstr "" + #: includes/include.systemsettings.php:69 #: includes/include.systemsettings.php:73 includes/include.upl_edit.php:66 #: includes/include.clientsettings.php:110 @@ -2774,6 +2258,12 @@ msgstr "" msgid "Backend only" msgstr "" +#: includes/include.rights_left_top.php:103 +#: includes/cfg_language_de.inc.php:171 includes/cfg_language_de.inc.php:174 +#: includes/include.frontend.left_top.php:178 +msgid "Create user" +msgstr "" + #: includes/include.rights_left_top.php:115 #: includes/include.frontend.user_edit.php:185 msgid "User name" @@ -2853,7 +2343,7 @@ msgstr "" msgid "-- All Groups --" msgstr "" -#: includes/include.con_edit_form.php:134 +#: includes/include.con_edit_form.php:126 #: includes/include.tplcfg_edit_form.php:57 #: external/backendedit/front_content.php:484 #: external/frontend/front_content.php:494 @@ -2861,117 +2351,121 @@ msgstr "" msgid "Article is in use by %s (%s)" msgstr "" -#: includes/include.con_edit_form.php:238 +#: includes/include.con_edit_form.php:200 includes/include.str_overview.php:594 +msgid "Alias" +msgstr "" + +#: includes/include.con_edit_form.php:222 #: includes/include.client_artspec.php:163 msgid "No article specifications found!" msgstr "" -#: includes/include.con_edit_form.php:241 +#: includes/include.con_edit_form.php:225 #: includes/include.client_artspec.php:79 msgid "Article specification" msgstr "" -#: includes/include.con_edit_form.php:253 +#: includes/include.con_edit_form.php:237 msgid "Articlelink" msgstr "" -#: includes/include.con_edit_form.php:260 +#: includes/include.con_edit_form.php:244 msgid "Select an entry to display link" msgstr "" -#: includes/include.con_edit_form.php:261 +#: includes/include.con_edit_form.php:245 msgid "Article only" msgstr "" -#: includes/include.con_edit_form.php:262 +#: includes/include.con_edit_form.php:246 msgid "Article with Category" msgstr "" -#: includes/include.con_edit_form.php:263 +#: includes/include.con_edit_form.php:247 msgid "Article with Category and Language" msgstr "" -#: includes/include.con_edit_form.php:264 +#: includes/include.con_edit_form.php:248 msgid "Article with Language" msgstr "" -#: includes/include.con_edit_form.php:278 +#: includes/include.con_edit_form.php:262 msgid "Author (Creator)" msgstr "" -#: includes/include.con_edit_form.php:288 +#: includes/include.con_edit_form.php:272 msgid "Author (Modifier)" msgstr "" -#: includes/include.con_edit_form.php:289 +#: includes/include.con_edit_form.php:273 msgid "Last modified" msgstr "" -#: includes/include.con_edit_form.php:293 +#: includes/include.con_edit_form.php:277 msgid "Publishing date" msgstr "" -#: includes/include.con_edit_form.php:297 +#: includes/include.con_edit_form.php:281 #: includes/include.con_art_overview.php:309 msgid "not yet published" msgstr "" -#: includes/include.con_edit_form.php:300 +#: includes/include.con_edit_form.php:284 msgid "Publisher" msgstr "" -#: includes/include.con_edit_form.php:308 +#: includes/include.con_edit_form.php:292 msgid "Redirect" msgstr "" -#: includes/include.con_edit_form.php:324 +#: includes/include.con_edit_form.php:306 msgid "New Window" msgstr "" -#: includes/include.con_edit_form.php:350 +#: includes/include.con_edit_form.php:327 #: includes/include.con_art_overview.php:487 msgid "Start article" msgstr "" -#: includes/include.con_edit_form.php:354 +#: includes/include.con_edit_form.php:331 #: includes/include.con_art_overview.php:746 msgid "Sort key" msgstr "" -#: includes/include.con_edit_form.php:391 includes/cfg_language_de.inc.php:114 +#: includes/include.con_edit_form.php:364 includes/cfg_language_de.inc.php:114 msgid "Remove assignments" msgstr "" -#: includes/include.con_edit_form.php:393 +#: includes/include.con_edit_form.php:366 msgid "Remove multiple category assignments" msgstr "" -#: includes/include.con_edit_form.php:394 +#: includes/include.con_edit_form.php:367 msgid "" "Do you really want to remove the assignments to all categories except the " "current one?" msgstr "" -#: includes/include.con_edit_form.php:410 +#: includes/include.con_edit_form.php:382 msgid "" "Language parts of the articles are existing in other languages and are " "online. To change the category assignment, please set the other articles " "offline first." msgstr "" -#: includes/include.con_edit_form.php:549 +#: includes/include.con_edit_form.php:511 msgid "Choose Startdate" msgstr "" -#: includes/include.con_edit_form.php:550 +#: includes/include.con_edit_form.php:512 msgid "Choose Enddate" msgstr "" -#: includes/include.con_edit_form.php:648 +#: includes/include.con_edit_form.php:605 msgid "Select date" msgstr "" -#: includes/include.con_edit_form.php:685 +#: includes/include.con_edit_form.php:639 msgid "Summary" msgstr "" @@ -2988,18 +2482,16 @@ msgstr "" msgid "Template in use, cannot delete" msgstr "" +#: includes/include.tpl_overview.php:111 includes/cfg_language_de.inc.php:167 +#: includes/cfg_language_de.inc.php:168 +msgid "Duplicate template" +msgstr "" + #: includes/include.tpl_overview.php:128 #, php-format msgid "The template '%s' is used for following categories and articles" msgstr "" -#: includes/include.js_files_overview.php:132 -#: includes/include.html_tpl_files_overview.php:133 -#: includes/include.style_files_overview.php:132 -#, php-format -msgid "Do you really want to delete the following file:

    %s
    " -msgstr "" - #: includes/main.login.php:67 msgid "No Login Information available." msgstr "" @@ -3068,9 +2560,10 @@ msgstr "" msgid "Contenido Manual" msgstr "" -#: includes/include.html_tpl_edit_form.php:197 -#: includes/include.style_edit_form.php:180 -#: includes/include.js_edit_form.php:159 +#: includes/include.html_tpl_edit_form.php:179 +#: includes/include.style_edit_form.php:167 +#: includes/include.js_edit_form.php:151 +#: includes/include.js_edit_form_1.php:159 msgid "Edit file" msgstr "" @@ -3112,6 +2605,17 @@ msgstr "" msgid "Syncronize Article" msgstr "" +#: includes/cfg_language_de.inc.php:105 includes/cfg_language_de.inc.php:124 +#: includes/include.str_overview.php:1055 +#: includes/include.str_overview.php:1057 +msgid "Protect category" +msgstr "" + +#: includes/cfg_language_de.inc.php:106 +#: includes/include.con_art_overview.php:551 backend_search.php:678 +msgid "Delete article" +msgstr "" + #: includes/cfg_language_de.inc.php:107 msgid "Edit template configuration" msgstr "" @@ -3124,6 +2628,10 @@ msgstr "" msgid "Expand boxes" msgstr "" +#: includes/cfg_language_de.inc.php:110 backend_search.php:677 +msgid "Configure template" +msgstr "" + #: includes/cfg_language_de.inc.php:111 msgid "Create article" msgstr "" @@ -3148,6 +2656,10 @@ msgstr "" msgid "Help" msgstr "" +#: includes/cfg_language_de.inc.php:120 +msgid "Rename category" +msgstr "" + #: includes/cfg_language_de.inc.php:121 msgid "New category" msgstr "" @@ -3176,10 +2688,23 @@ msgstr "" msgid "Move category down" msgstr "" +#: includes/cfg_language_de.inc.php:129 +msgid "Move category" +msgstr "" + #: includes/cfg_language_de.inc.php:130 msgid "Create new tree" msgstr "" +#: includes/cfg_language_de.inc.php:131 +msgid "Duplicate category" +msgstr "" + +#: includes/cfg_language_de.inc.php:132 includes/include.str_overview.php:1041 +#: includes/include.str_overview.php:1044 +msgid "Configure category" +msgstr "" + #: includes/cfg_language_de.inc.php:133 msgid "Edit category" msgstr "" @@ -3381,6 +2906,10 @@ msgstr "" msgid "Edit newsletter" msgstr "" +#: includes/cfg_language_de.inc.php:217 +msgid "Create newsletter" +msgstr "" + #: includes/cfg_language_de.inc.php:218 msgid "Delete newsletter" msgstr "" @@ -3421,6 +2950,10 @@ msgstr "" msgid "Edit recipient" msgstr "" +#: includes/cfg_language_de.inc.php:229 +msgid "Create recipient" +msgstr "" + #: includes/cfg_language_de.inc.php:230 msgid "Delete recipient" msgstr "" @@ -3441,6 +2974,10 @@ msgstr "" msgid "Delete recipient group" msgstr "" +#: includes/cfg_language_de.inc.php:235 +msgid "Create recipient group" +msgstr "" + #: includes/cfg_language_de.inc.php:236 msgid "Delete recipient from group" msgstr "" @@ -3772,6 +3309,10 @@ msgstr "" msgid "Protection" msgstr "" +#: includes/include.upl_edit.php:100 +msgid "Time control" +msgstr "" + #: includes/include.upl_edit.php:101 #: includes/include.upl_search_results.php:286 #: includes/include.upl_files_overview.php:526 includes/include.CMS_IMG.php:283 @@ -3793,6 +3334,14 @@ msgstr "" msgid "Protected for non-logged in users" msgstr "" +#: includes/include.upl_edit.php:209 +msgid "Use time control" +msgstr "" + +#: includes/include.upl_edit.php:215 +msgid "Start date" +msgstr "" + #: includes/include.upl_edit.php:304 includes/include.upl_files_upload.php:67 #: includes/include.upl_files_overview.php:84 msgid "Directory not writable" @@ -3814,6 +3363,18 @@ msgstr "" msgid "none" msgstr "" +#: includes/include.str_overview.php:572 includes/include.str_overview.php:573 +#: includes/include.str_overview.php:574 includes/include.con_left_top.php:428 +#: includes/include.con_str_overview.php:614 +msgid "Close all categories" +msgstr "" + +#: includes/include.str_overview.php:578 includes/include.str_overview.php:579 +#: includes/include.str_overview.php:580 includes/include.con_left_top.php:429 +#: includes/include.con_str_overview.php:615 +msgid "Open all categories" +msgstr "" + #: includes/include.str_overview.php:596 #, php-format msgid "" @@ -3870,6 +3431,14 @@ msgstr "" msgid "Use this category" msgstr "" +#: includes/include.upl_artlist.php:81 +msgid "Start" +msgstr "" + +#: includes/include.upl_artlist.php:81 +msgid "Modified" +msgstr "" + #: includes/include.upl_artlist.php:81 msgid "Sort Order" msgstr "" @@ -4386,45 +3955,26 @@ msgstr "" msgid "Range" msgstr "" -#: includes/functions.file.php:206 +#: includes/functions.file.php:204 msgid "Please insert filename." msgstr "" -#: includes/functions.file.php:218 -#, php-format -msgid "Could not open file %s" -msgstr "" - -#: includes/functions.file.php:223 -#, php-format -msgid "Could not write file %s" -msgstr "" - -#: includes/functions.file.php:234 includes/functions.file.php:338 +#: includes/functions.file.php:220 includes/functions.file.php:298 #, php-format msgid "%s is not writable" msgstr "" -#: includes/functions.file.php:255 -#, php-format -msgid "Can not open file%s " -msgstr "" - -#: includes/functions.file.php:304 -msgid "Unable to change file access permission." -msgstr "" - -#: includes/functions.file.php:308 +#: includes/functions.file.php:269 #, php-format msgid "Unable to create file %s" msgstr "" -#: includes/functions.file.php:334 +#: includes/functions.file.php:294 #, php-format msgid "Can not rename file %s" msgstr "" -#: includes/functions.file.php:361 +#: includes/functions.file.php:320 msgid "Wrong filename." msgstr "" @@ -4489,7 +4039,7 @@ msgstr "" msgid "Path:" msgstr "" -#: includes/functions.mod.php:200 +#: includes/functions.mod.php:182 msgid "Please do not use short open Tags. (Use \n" "Language-Team: CL-Dev \n" "Language: de_DE\n" @@ -14,12 +14,10 @@ msgstr "" "X-Poedit-Keywords: i18n,trans\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Generator: Poedit 2.0.6\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: classes/con2con/class.filehandler.php:451 -msgid "Wrong file name." -msgstr "Falscher Dateiname." - -#: classes/con2con/class.filehandler.php:467 +#: classes/con2con/class.filehandler.php:452 +#: classes/con2con/class.filehandler.php:464 msgid "Please insert file name." msgstr "Bitte Dateinamen angeben." @@ -69,11 +67,11 @@ msgstr "Aktualisieren" #: classes/class.version.php:525 msgid "Clear layout history" -msgstr "Layouthistorie löschen" +msgstr "Layouthistorie löschen" #: classes/class.version.php:526 msgid "Do you really want to clear layout history?" -msgstr "Möchten Sie wirklich die Layouthistorie löschen?" +msgstr "Möchten Sie wirklich die Layouthistorie löschen?" #: classes/class.version.php:526 msgid "Note: This only affects the current layout." @@ -81,11 +79,11 @@ msgstr "Hinweis: Dies betrifft nur das aktuelle Layout." #: classes/class.version.php:529 msgid "Clear module history" -msgstr "Modulhistorie löschen" +msgstr "Modulhistorie löschen" #: classes/class.version.php:530 msgid "Do you really want to clear module history?" -msgstr "Möchte Sie wirklich die Modulhistorie löschen?" +msgstr "Möchte Sie wirklich die Modulhistorie löschen?" #: classes/class.version.php:530 msgid "Note: This only affects the current module." @@ -93,11 +91,11 @@ msgstr "Hinweis: Dies betrifft nur das aktuelle Modul." #: classes/class.version.php:533 msgid "Clear style history" -msgstr "Stylehistorie löschen" +msgstr "Stylehistorie löschen" #: classes/class.version.php:534 msgid "Do you really want to clear style history?" -msgstr "Möchten Sie wirklich die Stylehistorie löschen?" +msgstr "Möchten Sie wirklich die Stylehistorie löschen?" #: classes/class.version.php:534 msgid "Note: This only affects the current style." @@ -105,11 +103,11 @@ msgstr "Hinweis: Dies betrifft nur das aktuelle Style." #: classes/class.version.php:537 msgid "Clear Java-Script history" -msgstr "Java-Script Historie löschen" +msgstr "Java-Script Historie löschen" #: classes/class.version.php:538 msgid "Do you really want to clear Java-Script history?" -msgstr "Möchten Sie wirklich die Java-Script Historie löschen?" +msgstr "Möchten Sie wirklich die Java-Script Historie löschen?" #: classes/class.version.php:538 msgid "Note: This only affects the current Java-Script." @@ -117,11 +115,11 @@ msgstr "Hinweis: Dies betrifft nur das aktuelle Java-Script." #: classes/class.version.php:541 msgid "Clear HTML-Template history" -msgstr "HTML-Template Historie löschen" +msgstr "HTML-Template Historie löschen" #: classes/class.version.php:542 msgid "Do you really want to clear HTML-Template history?" -msgstr "Möchten Sie wirklich die HTML-Template Historie löschen?" +msgstr "Möchten Sie wirklich die HTML-Template Historie löschen?" #: classes/class.version.php:542 msgid "Note: This only the affects current HTML-Template." @@ -129,21 +127,21 @@ msgstr "Hinweis: Dies betrifft nur das aktuelle HTML-Template." #: classes/class.version.php:545 msgid "Clear history" -msgstr "Stylehistorie löschen" +msgstr "Stylehistorie löschen" #: classes/class.version.php:546 msgid "Do you really want to clear history?" -msgstr "Möchten Sie wirklich die Stylehistorie löschen?" +msgstr "Möchten Sie wirklich die Stylehistorie löschen?" #: classes/class.version.php:546 msgid "Note: This only affects the current history." msgstr "Hinweis: Dies betrifft nur die aktuelle Historie." -#: classes/contenido/class.module.php:389 includes/include.mod_edit_form.php:58 +#: classes/contenido/class.module.php:403 includes/include.mod_edit_form.php:58 msgid "- Unnamed Module -" msgstr "- Unbenanntes Modul -" -#: classes/contenido/class.module.php:910 +#: classes/contenido/class.module.php:922 msgid "" "Using old CamelCase for name of modulefolder. You may lowercase the name for " "modulefolder" @@ -151,7 +149,7 @@ msgstr "" "Using old CamelCase for name of modulefolder. You may lowercase the name for " "modulefolder" -#: classes/contenido/class.module.php:913 +#: classes/contenido/class.module.php:925 msgid "" "Module uses Output- and/or InputFromFile. Editing and Saving may not be " "possible in backend." @@ -170,6 +168,10 @@ msgstr "" "Das Layout liegt im Dateisystem. Das Bearbeiten und Speichern ist im Backend " "nicht möglich." +#: classes/gui/class.file_list.php:55 +msgid "No files in directory." +msgstr "Keine Dateien im Verzeichnis." + #: classes/class.notification.php:114 scripts/articleObject.js.php:228 #: scripts/articleObject.js.php:231 scripts/langref.php:14 msgid "Error" @@ -180,7 +182,6 @@ msgid "Warning" msgstr "Warnung" #: classes/class.notification.php:126 -#: templates/standard/template.mycontenido_lastarticles.html:67 msgid "Info" msgstr "Information" @@ -189,23 +190,18 @@ msgid "Notification" msgstr "Hinweis" #: classes/class.navigation.php:332 classes/class.navigation.php:335 -#: templates/standard/template.log_main.html:18 -#: templates/standard/template.log_main.html:48 #: includes/include.system_purge.php:195 #: includes/include.con_editcontent.php:397 msgid "Client" msgstr "Mandant" #: classes/class.navigation.php:352 -#: templates/standard/template.symbolhelp.html:1823 -#: templates/standard/template.log_main.html:22 -#: templates/standard/template.log_main.html:50 msgid "User" msgstr "Benutzer" #: classes/class.navigation.php:425 msgid "-- No Language available --" -msgstr "-- Keine Sprache verfügbar --" +msgstr "-- Keine Sprache verfügbar --" #: classes/class.ui.php:305 classes/widgets/class.widgets.views.php:73 #: classes/widgets/class.widgets.tableedit.php:174 @@ -218,7 +214,6 @@ msgid "Save changes" msgstr "Änderungen speichern" #: classes/class.request.password.php:247 -#: templates/standard/template.symbolhelp.html:196 msgid "Submit" msgstr "Absenden" @@ -233,7 +228,7 @@ msgstr "Fenster schliessen" #: classes/class.request.password.php:301 #, php-format msgid "Password requests are allowed every %s minutes." -msgstr "Passwörter können nur alle %s Minuten angefordert werden." +msgstr "Passwörter können nur alle %s Minuten angefordert werden." #: classes/class.request.password.php:309 #: classes/class.request.password.php:322 @@ -259,16 +254,15 @@ msgid "" msgstr "" "Lieber ConLite-User %s,\n" "\n" -"Ihr Passwort für das Login in das Content Management System ConLite " -"ist: %s\n" +"Ihr Passwort für das Login in das Content Management System ConLite ist: %s\n" "\n" -"Viele Grüße\n" +"Viele Grüße\n" "\n" "Ihr ConLite Systemadministrator" #: classes/class.request.password.php:374 msgid "Your new password for Contenido Backend" -msgstr "Ihr neues Passwort für das ConLite Backend" +msgstr "Ihr neues Passwort für das ConLite Backend" #: classes/class.cms_date.php:212 msgid "Please Choose Format" @@ -285,14 +279,8 @@ msgid "No data found!" msgstr "Keine Daten gefunden!" #: classes/class.ajax.php:153 classes/class.cms_teaser.php:594 -#: templates/standard/template.mycontenido_lastarticles.html:63 -#: templates/standard/template.symbolhelp.html:41 -#: templates/standard/template.symbolhelp.html:472 -#: templates/standard/template.log_main.html:52 -#: templates/standard/template.str_overview.html:124 -#: templates/standard/template.str_overview.html:224 #: includes/grouprights_str.inc.php:76 includes/include.con_editcontent.php:387 -#: includes/include.con_edit_form.php:510 includes/rights_con.inc.php:78 +#: includes/include.con_edit_form.php:474 includes/rights_con.inc.php:78 #: includes/include.note.popup.php:93 includes/grouprights_con.inc.php:78 #: includes/rights_str.inc.php:77 msgid "Category" @@ -307,9 +295,6 @@ msgid "idlang" msgstr "idlang" #: classes/class.ajax.php:162 classes/class.ajax.php:179 -#: templates/standard/template.lay_edit_form.html:22 -#: templates/standard/template.tpl_edit_form.html:19 -#: templates/standard/template.mod_edit_form.html:23 #: includes/include.mod_package.php:235 includes/include.mod_package.php:253 #: includes/include.mod_package.php:422 includes/include.lay_edit_form.php:182 #: includes/include.mod_new.php:87 includes/include.lay_history.php:120 @@ -321,20 +306,18 @@ msgstr "idlang" #: includes/include.html_tpl_history.php:163 #: includes/include.rights_left_top.php:116 #: includes/include.style_history.php:160 -#: includes/include.html_tpl_edit_form.php:213 -#: includes/include.style_edit_form.php:197 -#: includes/include.js_edit_form.php:175 +#: includes/include.html_tpl_edit_form.php:195 +#: includes/include.style_edit_form.php:183 +#: includes/include.js_edit_form.php:168 #: includes/include.rights_overview.php:209 includes/include.js_history.php:155 #: includes/include.clientsettings.php:95 #: includes/include.clientsettings.php:187 -#: includes/include.tpl_edit_form.php:151 includes/include.mod_history.php:131 +#: includes/include.tpl_edit_form.php:151 +#: includes/include.js_edit_form_1.php:175 includes/include.mod_history.php:131 msgid "Name" msgstr "Name" #: classes/class.ajax.php:170 classes/class.cms_teaser.php:595 -#: templates/standard/template.symbolhelp.html:38 -#: templates/standard/template.symbolhelp.html:283 -#: templates/standard/template.log_main.html:53 #: includes/include.con_editcontent.php:382 #: includes/include.con_art_overview.php:73 includes/include.con_subnav.php:104 #: backend_search.php:491 @@ -383,11 +366,11 @@ msgstr "Sofort" #: classes/class.todo.php:151 classes/class.todo.php:154 backend_search.php:674 msgid "Set reminder / add to todo list" -msgstr "Wiedervorlage setzen / zur Todo-Liste hinzufügen" +msgstr "Wiedervorlage setzen / zur Todo-Liste hinzufügen" #: classes/class.update.notifier.php:422 classes/class.update.notifier.php:427 msgid "Unable to check for new updates!" -msgstr "Update-Überprüfung kann nicht durchgeführt werden!" +msgstr "Update-Überprüfung kann nicht durchgeführt werden!" #: classes/class.update.notifier.php:422 msgid "Could not handle server response!" @@ -440,28 +423,27 @@ msgstr "mehr lesen" #: classes/class.update.notifier.php:718 classes/class.update.notifier.php:727 msgid "No RSS content available" -msgstr "Keine RSS-Inhalte verfügbar" +msgstr "Keine RSS-Inhalte verfügbar" #: classes/class.update.notifier.php:725 classes/class.update.notifier.php:743 msgid "" "Your webserver does not have write permissions for the directory /contenido/" "cache/!" msgstr "" -"Ihr Webserver hat keine Schreibberechtigungen für das Verzeichnis /" -"contenido/cache/!" +"Ihr Webserver hat keine Schreibberechtigungen für das Verzeichnis /contenido/" +"cache/!" #: classes/class.update.notifier.php:746 msgid "" "Update notification is disabled! For actual update information, please " "activate." msgstr "" -"Die Update-Benachrichtigung ist deaktiviert! Für aktuelle Update-" +"Die Update-Benachrichtigung ist deaktiviert! Für aktuelle Update-" "Nachrichten, bitte aktivieren." #: classes/class.update.notifier.php:751 msgid "You have an unknown or unsupported version of ConLite!" -msgstr "" -"Sie haben eine unbekannte oder nicht unterstützte Version von ConLite!" +msgstr "Sie haben eine unbekannte oder nicht unterstützte Version von ConLite!" #: classes/class.update.notifier.php:754 #, php-format @@ -470,9 +452,9 @@ msgid "" "updates. Please update to a higher version!
    Download now!" msgstr "" -"Ihre Version von ConLite wird nicht länger mit Updates unterstü" -"tzt. Bitte aktualisieren Sie auf eine höhere Version!
    Jetzt herunterladen!" +"Ihre Version von ConLite wird nicht länger mit Updates unterstützt. " +"Bitte aktualisieren Sie auf eine höhere Version!
    Jetzt herunterladen!" #: classes/class.update.notifier.php:758 #, php-format @@ -480,8 +462,8 @@ msgid "" "A new version of ConLite is available!
    Download %s now!" msgstr "" -"Eine neue Version von ConLite ist verfügbar!
    %s jetzt herunterladen!" +"Eine neue Version von ConLite ist verfügbar!
    %s jetzt herunterladen!" #: classes/class.update.notifier.php:761 #, php-format @@ -498,12 +480,12 @@ msgstr "Ihre Version von ConLite ist aktuell!" #: classes/class.note.php:305 classes/class.note.php:308 msgid "View notes / add note" -msgstr "Notizen anzeigen / hinzufügen" +msgstr "Notizen anzeigen / hinzufügen" #: classes/class.cms_teaser.php:353 classes/class.cms_teaser.php:381 #: classes/class.cms_teaser.php:418 classes/class.cms_teaser.php:446 #: classes/class.cms_teaser.php:475 classes/class.cms_teaser.php:538 -#: includes/functions.general.php:1160 includes/functions.general.php:1200 +#: includes/functions.general.php:1155 includes/functions.general.php:1195 #: includes/include.str_overview.php:89 includes/include.CMS_LINK.php:215 #: includes/include.CMS_LINK.php:244 includes/include.CMS_LINK.php:273 #: includes/include.CMS_LINK.php:288 includes/include.CMS_LINK.php:304 @@ -550,7 +532,7 @@ msgstr "Erstellungsdatum" #: classes/class.cms_teaser.php:485 msgid "Publisheddate" -msgstr "Veröffentlichungsdatum" +msgstr "Veröffentlichungsdatum" #: classes/class.cms_teaser.php:488 msgid "Modificationdate" @@ -562,7 +544,7 @@ msgstr "Teasereinstellungen" #: classes/class.cms_teaser.php:578 msgid "Teasertitle" -msgstr "Teaserüberschrift" +msgstr "Teaserüberschrift" #: classes/class.cms_teaser.php:579 msgid "Teaser Startarticle" @@ -641,7 +623,7 @@ msgstr "Eingebundene Artikel" #: classes/class.cms_teaser.php:601 msgid "Add Article" -msgstr "Artikel hinzufügen" +msgstr "Artikel hinzufügen" #: classes/class.cms_teaser.php:602 msgid "Manual Teaser Settings" @@ -653,7 +635,7 @@ msgstr "Manueller Teaser" #: classes/class.cms_teaser.php:606 msgid "Size Settings" -msgstr "Größeneinstellungen" +msgstr "Größeneinstellungen" #: classes/class.cms_teaser.php:607 msgid "Characterlength" @@ -665,7 +647,7 @@ msgstr "Bildbreite" #: classes/class.cms_teaser.php:609 msgid "Imageheight" -msgstr "Bildhöhe" +msgstr "Bildhöhe" #: classes/class.cms_teaser.php:610 msgid "Image Scale" @@ -673,19 +655,19 @@ msgstr "Bildskalierung" #: classes/class.cms_teaser.php:647 msgid "Add" -msgstr "Hinzufügen" +msgstr "Hinzufügen" #: classes/class.inuse.php:246 msgid "Click here if you want to override the lock" -msgstr "Hier klicken, um die Sperre zu übergehen" +msgstr "Hier klicken, um die Sperre zu übergehen" #: classes/class.inuse.php:250 msgid "Do you really want to override the lock?" -msgstr "Möchten Sie wirklich die Sperre übergehen?" +msgstr "Möchten Sie wirklich die Sperre übergehen?" #: classes/class.inuse.php:252 msgid "Override lock" -msgstr "Sperre übergehen" +msgstr "Sperre übergehen" #: classes/class.inuse.php:252 msgid "Hide notification" @@ -696,14 +678,12 @@ msgid "Default Style" msgstr "Standarddarstellung" #: classes/class.cms_filelist.php:438 -#: templates/standard/template.upl_files_overview.html:82 msgid "Filename" msgstr "Dateiname" #: classes/class.cms_filelist.php:441 -#: templates/standard/template.upl_files_overview.html:86 msgid "File size" -msgstr "Dateigröße" +msgstr "Dateigröße" #: classes/class.cms_filelist.php:444 includes/include.con_left_top.php:136 msgid "Date created" @@ -724,7 +704,6 @@ msgid "Directories" msgstr "Verzeichnisse" #: classes/class.cms_filelist.php:722 -#: templates/standard/template.log_main.html:14 msgid "Filter" msgstr "Filter" @@ -746,7 +725,7 @@ msgstr "Dateilistentitel" #: classes/class.cms_filelist.php:729 msgid "File size limit" -msgstr "Dateigrößenbeschränkung" +msgstr "Dateigrößenbeschränkung" #: classes/class.cms_filelist.php:730 msgid "Creation date limit" @@ -766,7 +745,7 @@ msgstr "Quellverzeichnis" #: classes/class.cms_filelist.php:735 msgid "Include subdirectories?" -msgstr "Unterverzeichnisse berücksichtigen?" +msgstr "Unterverzeichnisse berücksichtigen?" #: classes/class.cms_filelist.php:736 msgid "Include meta data?" @@ -817,7 +796,7 @@ msgstr "Ausgewählte Dateien" #: classes/class.cms_filelist.php:748 msgid "Add file" -msgstr "Datei hinzufügen" +msgstr "Datei hinzufügen" #: classes/class.cms_filelist.php:749 msgid "File count" @@ -957,593 +936,6 @@ msgstr "Letzte Seite" msgid "Clear contents" msgstr "Inhalt leeren" -#: templates/standard/template.info.html:15 -msgid "Concept and Implementation" -msgstr "Konzept und Implementierung" - -#: templates/standard/template.info.html:15 -msgid "Germany" -msgstr "Deutschland" - -#: templates/standard/template.info.html:15 -msgid "Phone" -msgstr "Telefon" - -#: templates/standard/template.stat_overview.html:135 -#: includes/include.str_overview.php:572 includes/include.str_overview.php:573 -#: includes/include.str_overview.php:574 includes/include.con_left_top.php:428 -#: includes/include.con_str_overview.php:614 -msgid "Close all categories" -msgstr "Alle Kategorien schließen" - -#: templates/standard/template.stat_overview.html:137 -#: includes/include.str_overview.php:578 includes/include.str_overview.php:579 -#: includes/include.str_overview.php:580 includes/include.con_left_top.php:429 -#: includes/include.con_str_overview.php:615 -msgid "Open all categories" -msgstr "Alle Kategorien öffnen" - -#: templates/standard/template.welcome.html:22 -msgid "Available clients" -msgstr "Verfügbare Mandanten" - -#: templates/standard/template.welcome.html:42 -msgid "Currently" -msgstr "Momentan" - -#: templates/standard/template.welcome.html:42 -msgid "Users online" -msgstr "Benutzer online" - -#: templates/standard/template.welcome.html:50 -msgid "Contact System Administrators" -msgstr "Kontakt Systemadministrator(en)" - -#: templates/standard/template.system_variables.html:16 -msgid "Your system configuration" -msgstr "Ihre Systemkonfiguration" - -#: templates/standard/template.system_variables.html:21 -msgid "Variable" -msgstr "Variable" - -#: templates/standard/template.system_variables.html:22 -msgid "Local value" -msgstr "Lokaler Wert" - -#: templates/standard/template.system_variables.html:37 -msgid "Contenido Error Log" -msgstr "Contenido Fehlerlog" - -#: templates/standard/template.system_variables.html:50 -msgid "clear error log" -msgstr "Fehlerlog leeren" - -#: templates/standard/template.system_variables.html:58 -msgid "Contenido Upgrade Error Log" -msgstr "Contenido Upgrade-Fehlerlog" - -#: templates/standard/template.system_variables.html:72 -msgid "clear upgrade error log" -msgstr "Upgrade-Fehlerlog leeren" - -#: templates/standard/template.mycontenido_lastarticles.html:35 -msgid "Your clients" -msgstr "Ihre Mandanten" - -#: templates/standard/template.mycontenido_lastarticles.html:61 -#: includes/include.upl_artlist.php:81 -msgid "Start" -msgstr "Start" - -#: templates/standard/template.mycontenido_lastarticles.html:62 -#: includes/include.stat_overview.php:89 includes/include.con_edit_form.php:208 -#: includes/include.upl_artlist.php:81 includes/include.con_art_overview.php:74 -#: includes/include.con_art_overview.php:659 backend_search.php:492 -msgid "Title" -msgstr "Titel" - -#: templates/standard/template.mycontenido_lastarticles.html:64 -#: includes/include.mycontenido.tasks.php:276 -#: includes/include.con_edit_form.php:284 includes/include.upl_artlist.php:81 -msgid "Created" -msgstr "Erstelldatum" - -#: templates/standard/template.mycontenido_lastarticles.html:65 -#: includes/include.upl_artlist.php:81 -msgid "Modified" -msgstr "Geändert" - -#: templates/standard/template.mycontenido_lastarticles.html:66 -#: templates/standard/template.str_overview.html:230 -#: includes/include.con_art_overview.php:78 -#: includes/include.pretplcfg_edit_form.php:76 -#: includes/include.tplcfg_edit_form.php:276 backend_search.php:496 -msgid "Template" -msgstr "Template" - -#: templates/standard/template.rights_inc.html:24 -msgid "Client / Language" -msgstr "Mandant / Sprache" - -#: templates/standard/template.lay_edit_form.html:32 -#: templates/standard/template.tpl_edit_form.html:29 -#: templates/standard/template.upl_files_overview.html:84 -#: templates/standard/template.mod_edit_form.html:33 scripts/langref.php:28 -#: includes/include.lay_edit_form.php:183 includes/include.mod_new.php:109 -#: includes/include.CMS_SIMPLELINK.php:153 includes/rights_lay.inc.php:76 -#: includes/grouprights_mod.inc.php:74 includes/include.todo.popup.php:70 -#: includes/include.lay_history.php:121 includes/include.mod_edit_form.php:385 -#: includes/include.html_tpl_history.php:164 -#: includes/include.style_history.php:161 includes/grouprights_lay.inc.php:86 -#: includes/include.html_tpl_edit_form.php:214 includes/include.upl_edit.php:95 -#: includes/include.style_edit_form.php:198 -#: includes/include.js_edit_form.php:176 includes/include.CMS_LINK.php:341 -#: includes/include.js_history.php:156 includes/rights_mod.inc.php:76 -#: includes/include.grouprights_overview.php:118 -#: includes/grouprights_tpl.inc.php:73 includes/rights_tpl.inc.php:74 -#: includes/include.CMS_IMG.php:278 includes/include.tpl_edit_form.php:154 -#: includes/include.mycontenido.tasks.edit.php:71 -#: includes/include.grouprights_create.php:112 -#: includes/include.mod_history.php:132 -msgid "Description" -msgstr "Beschreibung" - -#: templates/standard/template.con_edit_form.html:141 -#: includes/include.upl_edit.php:100 -msgid "Time control" -msgstr "Zeitsteuerung" - -#: templates/standard/template.con_edit_form.html:144 -#: includes/include.upl_edit.php:209 -msgid "Use time control" -msgstr "Zeitsteuerung aktivieren" - -#: templates/standard/template.con_edit_form.html:146 -#: templates/standard/template.log_main.html:30 -#: includes/include.upl_edit.php:215 -msgid "Start date" -msgstr "Startdatum" - -#: templates/standard/template.con_edit_form.html:150 -#: templates/standard/template.log_main.html:34 -#: includes/include.todo.popup.php:79 includes/include.upl_edit.php:219 -#: includes/include.mycontenido.tasks.edit.php:75 -msgid "End date" -msgstr "Enddatum" - -#: templates/standard/template.con_edit_form.html:153 -msgid "When expired, move to category" -msgstr "Nach Endzeitpunkt in diese Kategorie verschieben" - -#: templates/standard/template.con_edit_form.html:155 -msgid "Make online after move" -msgstr "Nach Verschieben Artikel online lassen" - -#: templates/standard/template.con_edit_form.html:184 -msgid "Page title" -msgstr "Seitentitel" - -#: templates/standard/template.con_edit_form.html:190 -msgid "Meta tags" -msgstr "Meta-Tags" - -#: templates/standard/template.symbolhelp.html:23 -msgid "Table of contents" -msgstr "Inhaltsverzeichnis" - -#: templates/standard/template.symbolhelp.html:29 -#: templates/standard/template.symbolhelp.html:135 -msgid "Common" -msgstr "Allgemeines" - -#: templates/standard/template.symbolhelp.html:35 -#: templates/standard/template.symbolhelp.html:277 -msgid "Content" -msgstr "Content" - -#: templates/standard/template.symbolhelp.html:44 -#: templates/standard/template.symbolhelp.html:740 -msgid "File management" -msgstr "Dateiverwaltung" - -#: templates/standard/template.symbolhelp.html:50 -#: templates/standard/template.symbolhelp.html:816 -msgid "Style" -msgstr "Style" - -#: templates/standard/template.symbolhelp.html:53 -#: templates/standard/template.symbolhelp.html:822 -#: includes/include.mod_package.php:191 -msgid "Layouts" -msgstr "Layouts" - -#: templates/standard/template.symbolhelp.html:56 -#: templates/standard/template.symbolhelp.html:904 -msgid "Modules" -msgstr "Module" - -#: templates/standard/template.symbolhelp.html:59 -#: templates/standard/template.symbolhelp.html:985 -msgid "Templates" -msgstr "Templates" - -#: templates/standard/template.symbolhelp.html:62 -#: templates/standard/template.symbolhelp.html:1055 -msgid "CSS editor" -msgstr "CSS-Editor" - -#: templates/standard/template.symbolhelp.html:65 -#: templates/standard/template.symbolhelp.html:1110 -msgid "Script editor" -msgstr "Scripteditor" - -#: templates/standard/template.symbolhelp.html:68 -#: templates/standard/template.symbolhelp.html:1165 -msgid "Module Templates" -msgstr "Modul-Templates" - -#: templates/standard/template.symbolhelp.html:74 -#: templates/standard/template.symbolhelp.html:1242 -msgid "Extras" -msgstr "Extras" - -#: templates/standard/template.symbolhelp.html:77 -#: templates/standard/template.symbolhelp.html:1248 -msgid "Newsletter" -msgstr "Newsletter" - -#: templates/standard/template.symbolhelp.html:80 -msgid "Recipients" -msgstr "Empfänger" - -#: templates/standard/template.symbolhelp.html:86 -#: templates/standard/template.symbolhelp.html:1466 -msgid "Statistics" -msgstr "Statistiken" - -#: templates/standard/template.symbolhelp.html:89 -#: templates/standard/template.symbolhelp.html:1472 -#: includes/include.stat_overview.php:92 -msgid "Hits" -msgstr "Hits" - -#: templates/standard/template.symbolhelp.html:95 -#: templates/standard/template.symbolhelp.html:1548 -msgid "Administration" -msgstr "Administration" - -#: templates/standard/template.symbolhelp.html:98 -#: templates/standard/template.symbolhelp.html:1554 -msgid "Users" -msgstr "Benutzer" - -#: templates/standard/template.symbolhelp.html:101 -#: templates/standard/template.symbolhelp.html:1609 -msgid "Groups" -msgstr "Gruppen" - -#: templates/standard/template.symbolhelp.html:104 -#: templates/standard/template.symbolhelp.html:1664 -msgid "Languages" -msgstr "Sprachen" - -#: templates/standard/template.symbolhelp.html:107 -#: templates/standard/template.symbolhelp.html:1734 -msgid "Clients" -msgstr "Mandanten" - -#: templates/standard/template.symbolhelp.html:129 -msgid "Table of Contents" -msgstr "Inhaltsverzeichnis" - -#: templates/standard/template.symbolhelp.html:166 -msgid "Execute query / Save" -msgstr "Anfrage senden / Speichern" - -#: templates/standard/template.symbolhelp.html:181 scripts/messageBox.js.php:79 -#: scripts/langref.php:21 includes/include.mod_package.php:311 -msgid "Cancel" -msgstr "Abbrechen" - -#: templates/standard/template.symbolhelp.html:208 -msgid "Change to MyContenido (Personal Settings)" -msgstr "Zu MyConLite wechseln (Persönliche Einstellungen)" - -#: templates/standard/template.symbolhelp.html:220 -msgid "Information (Impressum)" -msgstr "Information (Impressum)" - -#: templates/standard/template.symbolhelp.html:235 -msgid "Logout" -msgstr "Ausloggen" - -#: templates/standard/template.symbolhelp.html:314 -#: templates/standard/template.symbolhelp.html:506 -#: templates/standard/template.str_overview.html:148 -#: includes/cfg_language_de.inc.php:132 includes/include.str_overview.php:1041 -#: includes/include.str_overview.php:1044 -msgid "Configure category" -msgstr "Kategorie konfigurieren" - -#: templates/standard/template.symbolhelp.html:329 -#: includes/include.con_art_overview.php:887 -#: includes/include.con_art_overview.php:888 -msgid "Create new article" -msgstr "Neuen Artikel erstellen" - -#: templates/standard/template.symbolhelp.html:341 -msgid "Article is start article / is not start article" -msgstr "Artikel ist Startartikel / kein Startartikel" - -#: templates/standard/template.symbolhelp.html:353 -#: templates/standard/template.symbolhelp.html:868 -#: templates/standard/template.symbolhelp.html:949 -msgid "Set template / Add to To-Do list" -msgstr "Template setzen / zur Todo-Liste hinzufügen" - -#: templates/standard/template.symbolhelp.html:365 -msgid "Configure article properties" -msgstr "Artikeleigenschaften bearbeiten" - -#: templates/standard/template.symbolhelp.html:377 -#: includes/cfg_language_de.inc.php:110 backend_search.php:677 -msgid "Configure template" -msgstr "Template konfigurieren" - -#: templates/standard/template.symbolhelp.html:389 -msgid "Element is online / offline (change through click)" -msgstr "Element ist online / offline (Durch Klick ändern)" - -#: templates/standard/template.symbolhelp.html:401 -msgid "Element is protected / accessible (change through click)" -msgstr "Element ist geschützt / erreichbar (Ändern durch Klick)" - -#: templates/standard/template.symbolhelp.html:413 -#: includes/include.con_art_overview.php:503 backend_search.php:675 -msgid "Duplicate article" -msgstr "Artikel duplizieren" - -#: templates/standard/template.symbolhelp.html:425 -#: includes/cfg_language_de.inc.php:106 -#: includes/include.con_art_overview.php:551 backend_search.php:678 -msgid "Delete article" -msgstr "Artikel löschen" - -#: templates/standard/template.symbolhelp.html:439 -msgid "Lock / unlock folder (change through click)" -msgstr "Kategorie sperren / entsperren (Ändern durch Klick)" - -#: templates/standard/template.symbolhelp.html:451 -msgid "Set folder offline / online (change through click)" -msgstr "Ordner offline / online setzen (Ändern durch Klick)" - -#: templates/standard/template.symbolhelp.html:524 -#: includes/cfg_language_de.inc.php:120 -msgid "Rename category" -msgstr "Kategorie umbenennen" - -#: templates/standard/template.symbolhelp.html:542 -msgid "Create category" -msgstr "Kategorie erzeugen" - -#: templates/standard/template.symbolhelp.html:560 -msgid "Set category online / offline" -msgstr "Kategorie online / offline setzen" - -#: templates/standard/template.symbolhelp.html:578 -msgid "Category is online and unprotected / protected" -msgstr "Kategorie ist online und ungeschützt / geschützt" - -#: templates/standard/template.symbolhelp.html:596 -msgid "Category is offline and unprotected / protected" -msgstr "Kategorie ist offline und ungeschützt / geschützt" - -#: templates/standard/template.symbolhelp.html:614 -msgid "Category is online, contains an error and is unprotected / protected" -msgstr "" -"Kategorie ist online, enthält einen Fehler und ist ungeschützt / " -"geschützt" - -#: templates/standard/template.symbolhelp.html:632 -msgid "Category is offline, contains an error and is unprotected / protected" -msgstr "" -"Kategorie ist offline, ist fehlerhaft und ist ungeschützt / geschü" -"tzt" - -#: templates/standard/template.symbolhelp.html:650 -msgid "Move up one category" -msgstr "Eine Kategorie nach oben verschieben" - -#: templates/standard/template.symbolhelp.html:665 -#: includes/cfg_language_de.inc.php:129 -msgid "Move category" -msgstr "Kategorie verschieben" - -#: templates/standard/template.symbolhelp.html:683 -msgid "Select move target" -msgstr "Verschiebeziel auswählen" - -#: templates/standard/template.symbolhelp.html:701 -#: includes/cfg_language_de.inc.php:131 -msgid "Duplicate category" -msgstr "Kategorie duplizieren" - -#: templates/standard/template.symbolhelp.html:716 -#: templates/standard/template.symbolhelp.html:880 -#: templates/standard/template.symbolhelp.html:961 -#: templates/standard/template.symbolhelp.html:1031 -#: templates/standard/template.symbolhelp.html:1086 -#: templates/standard/template.symbolhelp.html:1141 -#: templates/standard/template.symbolhelp.html:1196 -#: templates/standard/template.symbolhelp.html:1306 -#: templates/standard/template.symbolhelp.html:1421 -#: templates/standard/template.symbolhelp.html:1585 -#: templates/standard/template.symbolhelp.html:1640 -#: templates/standard/template.symbolhelp.html:1710 -#: templates/standard/template.symbolhelp.html:1765 -#: templates/standard/template.symbolhelp.html:1871 -msgid "Delete / Delete not available" -msgstr "Löschen / Löschen nicht verfügbar" - -#: templates/standard/template.symbolhelp.html:762 -msgid "Root upload folder" -msgstr "Basis-Uploadverzeichnis" - -#: templates/standard/template.symbolhelp.html:780 -msgid "Regular folder" -msgstr "Normaler Ordner" - -#: templates/standard/template.symbolhelp.html:853 -msgid "Layout in use" -msgstr "Layout wird verwendet" - -#: templates/standard/template.symbolhelp.html:934 -msgid "Module in use" -msgstr "Modul wird verwendet" - -#: templates/standard/template.symbolhelp.html:1016 -#: includes/include.tpl_overview.php:111 includes/cfg_language_de.inc.php:167 -#: includes/cfg_language_de.inc.php:168 -msgid "Duplicate template" -msgstr "Template duplizieren" - -#: templates/standard/template.symbolhelp.html:1279 -#: includes/cfg_language_de.inc.php:217 -msgid "Create newsletter" -msgstr "Newsletter erzeugen" - -#: templates/standard/template.symbolhelp.html:1294 -msgid "Copy newsletter" -msgstr "Newsletter kopieren" - -#: templates/standard/template.symbolhelp.html:1330 -#: templates/standard/template.symbolhelp.html:1361 -msgid "Recipient" -msgstr "Empfänger" - -#: templates/standard/template.symbolhelp.html:1373 -#: includes/cfg_language_de.inc.php:229 -msgid "Create recipient" -msgstr "Empfänger erzeugen" - -#: templates/standard/template.symbolhelp.html:1385 -msgid "Remove recipient" -msgstr "Empfänger entfernen" - -#: templates/standard/template.symbolhelp.html:1397 -msgid "Recipient group" -msgstr "Empfängergruppe" - -#: templates/standard/template.symbolhelp.html:1409 -#: includes/cfg_language_de.inc.php:235 -msgid "Create recipient group" -msgstr "Empfängergruppe erstellen" - -#: templates/standard/template.symbolhelp.html:1503 -msgid "Article is online / offline" -msgstr "Artikel ist online / offline" - -#: templates/standard/template.symbolhelp.html:1695 -msgid "Language active / not active" -msgstr "Sprache ist aktiv / nicht aktiv" - -#: templates/standard/template.symbolhelp.html:1835 -#: includes/include.rights_left_top.php:103 -#: includes/cfg_language_de.inc.php:171 includes/cfg_language_de.inc.php:174 -#: includes/include.frontend.left_top.php:178 -msgid "Create user" -msgstr "Benutzer erstellen" - -#: templates/standard/template.symbolhelp.html:1847 -msgid "User group" -msgstr "Benutzergruppe" - -#: templates/standard/template.symbolhelp.html:1859 -msgid "Create user group" -msgstr "Benutzergruppe erzeugen" - -#: templates/standard/template.log_main.html:15 -#: includes/include.systemsettings.php:60 -#: includes/include.systemsettings.php:174 -#: includes/include.rights_create.php:147 includes/include.client_edit.php:226 -#: includes/include.rights_overview.php:200 -#: includes/include.rights_overview.php:354 -#: includes/include.grouprights_overview.php:109 -#: includes/include.grouprights_overview.php:210 -#: includes/include.clientsettings.php:95 -#: includes/include.clientsettings.php:191 -#: includes/include.grouprights_create.php:99 -msgid "Value" -msgstr "Wert" - -#: templates/standard/template.log_main.html:26 -#: templates/standard/template.log_main.html:51 -#: includes/include.mod_package.php:254 -msgid "Action" -msgstr "Aktion" - -#: templates/standard/template.log_main.html:38 -#: templates/standard/template.recipient_menu.html:88 -msgid "Limit" -msgstr "Beschränkung" - -#: templates/standard/template.log_main.html:49 -msgid "Date" -msgstr "Datum" - -#: templates/standard/template.tpl_edit_form.html:42 -#: includes/include.lay_overview.php:101 includes/include.tpl_edit_form.php:160 -msgid "Layout" -msgstr "Layout" - -#: templates/standard/template.tpl_edit_form.html:55 -#: includes/include.tpl_edit_form.php:161 -msgid "Layout description" -msgstr "Layoutbeschreibung" - -#: templates/standard/template.upl_files_overview.html:61 -msgid "Sort files" -msgstr "Dateisortierung" - -#: templates/standard/template.upl_files_overview.html:88 -msgid "Image size" -msgstr "Bildgröße" - -#: templates/standard/template.str_overview.html:133 -#: templates/standard/template.str_overview.html:227 -#: includes/include.con_edit_form.php:211 includes/include.str_overview.php:594 -msgid "Alias" -msgstr "Alias" - -#: templates/standard/template.str_overview.html:139 -#: includes/cfg_language_de.inc.php:105 includes/cfg_language_de.inc.php:124 -#: includes/include.str_overview.php:1055 -#: includes/include.str_overview.php:1057 -msgid "Protect category" -msgstr "Kategorie schützen" - -#: templates/standard/template.str_overview.html:157 -msgid "Category is a tree" -msgstr "Kategorie ist ein Baum" - -#: templates/standard/template.str_overview.html:164 -msgid "Position of category" -msgstr "Position der Kategorie" - -#: templates/standard/template.str_overview.html:233 -#: includes/include.mycontenido.tasks.php:276 -#: includes/include.frontend.left_top.php:165 -#: includes/include.con_art_overview.php:79 -#: includes/include.upl_files_overview.php:530 backend_search.php:497 -msgid "Actions" -msgstr "Aktionen" - -#: templates/standard/template.recipient_menu.html:92 -#: includes/include.con_left_top.php:237 -msgid "Search" -msgstr "Suche" - #: scripts/iZoom.js.php:70 scripts/iZoom.js.php:73 scripts/rights.js.php:67 #: scripts/rights.js.php:70 scripts/langref.php:23 msgid "Click to close" @@ -1565,7 +957,7 @@ msgstr "Online setzen" #: scripts/HTMLObj.js.php:248 scripts/langref.php:10 msgid "Protect" -msgstr "Schützen" +msgstr "Schützen" #: scripts/HTMLObj.js.php:251 scripts/langref.php:11 msgid "Remove protection" @@ -1580,6 +972,11 @@ msgstr "Template wählen" msgid "Confirm" msgstr "Bestätigen" +#: scripts/messageBox.js.php:79 scripts/langref.php:21 +#: includes/include.mod_package.php:311 +msgid "Cancel" +msgstr "Abbrechen" + #: scripts/messageBox.js.php:80 scripts/langref.php:22 msgid "Close window" msgstr "Fenster schliessen" @@ -1639,6 +1036,27 @@ msgstr "Text / Standard" msgid "Picture" msgstr "Bild" +#: scripts/langref.php:28 includes/include.lay_edit_form.php:183 +#: includes/include.mod_new.php:109 includes/include.CMS_SIMPLELINK.php:153 +#: includes/rights_lay.inc.php:76 includes/grouprights_mod.inc.php:74 +#: includes/include.todo.popup.php:70 includes/include.lay_history.php:121 +#: includes/include.mod_edit_form.php:385 +#: includes/include.html_tpl_history.php:164 +#: includes/include.style_history.php:161 includes/grouprights_lay.inc.php:86 +#: includes/include.html_tpl_edit_form.php:196 includes/include.upl_edit.php:95 +#: includes/include.style_edit_form.php:184 +#: includes/include.js_edit_form.php:169 includes/include.CMS_LINK.php:341 +#: includes/include.js_history.php:156 includes/rights_mod.inc.php:76 +#: includes/include.grouprights_overview.php:118 +#: includes/grouprights_tpl.inc.php:73 includes/rights_tpl.inc.php:74 +#: includes/include.CMS_IMG.php:278 includes/include.tpl_edit_form.php:154 +#: includes/include.js_edit_form_1.php:176 +#: includes/include.mycontenido.tasks.edit.php:71 +#: includes/include.grouprights_create.php:112 +#: includes/include.mod_history.php:132 +msgid "Description" +msgstr "Beschreibung" + #: scripts/langref.php:29 msgid "Description / Standard" msgstr "Beschreibung / Standard" @@ -1655,17 +1073,31 @@ msgstr "Link" msgid "Frame" msgstr "Frame" +#: includes/include.js_files_overview_1.php:104 #: includes/include.mod_package.php:111 -#: includes/include.js_files_overview.php:104 #: includes/include.html_tpl_files_overview.php:105 -#: includes/include.style_files_overview.php:104 +#: includes/include.style_files_overview.php:130 msgid "is not readable!" msgstr "Datei ist nicht lesbar!" -#: includes/include.mod_package.php:123 -#: includes/include.js_files_overview.php:155 -#: includes/include.html_tpl_files_overview.php:156 +#: includes/include.js_files_overview_1.php:131 +#: includes/include.system_db_backup.php:293 +#: includes/include.html_tpl_files_overview.php:132 #: includes/include.style_files_overview.php:155 +msgid "Delete File" +msgstr "Datei löschen" + +#: includes/include.js_files_overview_1.php:132 +#: includes/include.html_tpl_files_overview.php:133 +#: includes/include.style_files_overview.php:156 +#, php-format +msgid "Do you really want to delete the following file:

    %s
    " +msgstr "Möchten Sie die folgende Datei wirklich löschen:

    %s" + +#: includes/include.js_files_overview_1.php:155 +#: includes/include.mod_package.php:123 +#: includes/include.html_tpl_files_overview.php:156 +#: includes/include.style_files_overview.php:175 msgid "Directory is not existing or readable!" msgstr "Verzeichnis existiert nicht oder ist nicht lesbar!" @@ -1694,6 +1126,10 @@ msgstr "Modul-Template-Dateien" msgid "Style files" msgstr "Style-Dateien" +#: includes/include.mod_package.php:191 +msgid "Layouts" +msgstr "Layouts" + #: includes/include.mod_package.php:192 msgid "Translations" msgstr "Übersetzung" @@ -1710,7 +1146,7 @@ msgstr "Überspringen" #: includes/include.mod_package.php:238 msgid "Append" -msgstr "Hinzufügen" +msgstr "Hinzufügen" #: includes/include.mod_package.php:238 msgid "Overwrite" @@ -1743,6 +1179,10 @@ msgstr "- Auswählen -" msgid "Status" msgstr "Status" +#: includes/include.mod_package.php:254 +msgid "Action" +msgstr "Aktion" + #: includes/include.mod_package.php:312 msgid "Import" msgstr "Import" @@ -1750,8 +1190,8 @@ msgstr "Import" #: includes/include.mod_package.php:361 msgid "Import was not succesful, please check data and try again" msgstr "" -"Import nicht erfolgreich, bitte überprüfen Sie die Daten und " -"versuchen Sie es erneut" +"Import nicht erfolgreich, bitte überprüfen Sie die Daten und versuchen " +"Sie es erneut" #: includes/include.mod_package.php:362 msgid "Retry" @@ -1823,9 +1263,9 @@ msgid "" "specified in more detail." msgstr "" "Der gewählte Nutzer ist ein Systemadministrator. Ein " -"Systemadministrator verfügt über alle Rechte für alle " -"Mandanten in allen Sprachen, es können keine weiteren Einstellungen " -"für Rechte vorgenommen werden." +"Systemadministrator verfügt über alle Rechte für alle Mandanten in allen " +"Sprachen, es können keine weiteren Einstellungen für Rechte vorgenommen " +"werden." #: includes/rights.inc.php:348 msgid "" @@ -1833,9 +1273,9 @@ msgid "" "rights for a client and therefore rights can't be specified in more detail." msgstr "" "Der gewählte Nutzer ist als Administrator Mandanten zugeordnet. Ein " -"Administrator verfügt über alle Rechte für den oder die " -"zugeordneten Mandanten in allen Sprachen, es können keine weiteren " -"Einstellungen für Rechte vorgenommen werden." +"Administrator verfügt über alle Rechte für den oder die zugeordneten " +"Mandanten in allen Sprachen, es können keine weiteren Einstellungen für " +"Rechte vorgenommen werden." #: includes/rights.inc.php:352 msgid "Current user doesn't have any rights to any client/language." @@ -1843,68 +1283,68 @@ msgstr "" "Der aktuelle Benutzer hat keine Zugriffsrechte auf irgendeine(n) Sprache " "bzw. Mandant." -#: includes/include.upl_dirs_overview.php:56 +#: includes/include.upl_dirs_overview.php:53 #: includes/grouprights_str.inc.php:215 includes/include.str_overview.php:162 #: includes/rights_con.inc.php:227 includes/functions.stat.php:313 #: includes/functions.stat.php:314 includes/functions.stat.php:644 #: includes/functions.stat.php:645 includes/grouprights_con.inc.php:241 #: includes/rights_str.inc.php:221 msgid "Open category" -msgstr "Kategorie öffnen" +msgstr "Kategorie öffnen" -#: includes/include.upl_dirs_overview.php:60 +#: includes/include.upl_dirs_overview.php:56 #: includes/grouprights_str.inc.php:215 includes/include.str_overview.php:167 #: includes/rights_con.inc.php:227 includes/grouprights_con.inc.php:241 #: includes/rights_str.inc.php:221 msgid "Close category" msgstr "Kategorie schliessen" -#: includes/include.upl_dirs_overview.php:153 +#: includes/include.upl_dirs_overview.php:132 msgid "Failed to delete the following files:" -msgstr "Die folgenden Dateien konnten nicht gelöscht werden:" +msgstr "Die folgenden Dateien konnten nicht gelöscht werden:" -#: includes/include.upl_dirs_overview.php:159 +#: includes/include.upl_dirs_overview.php:136 #, php-format msgid "Failed to remove directory %s" msgstr "Folgendes Verzeichnis konnte nicht verschoben werden: %s" -#: includes/include.upl_dirs_overview.php:190 +#: includes/include.upl_dirs_overview.php:167 msgid "Upload directory" msgstr "Upload Verzeichnis" -#: includes/include.upl_dirs_overview.php:194 +#: includes/include.upl_dirs_overview.php:171 msgid "" "The following directories contains invalid characters and were ignored: " msgstr "" -"Die folgenden Verzeichnisnamen beinhalten ungültige Zeichen und wurden " -"daher ignoriert: " +"Die folgenden Verzeichnisnamen beinhalten ungültige Zeichen und wurden daher " +"ignoriert: " -#: includes/include.upl_dirs_overview.php:197 +#: includes/include.upl_dirs_overview.php:174 msgid "Please click here in order to rename automatically." msgstr "" "Bitte klicken Sie hier, um die Verzeichnisse automatisch umzubennennen." -#: includes/include.upl_dirs_overview.php:319 +#: includes/include.upl_dirs_overview.php:272 msgid "Categories" msgstr "Kategorien" -#: includes/include.upl_dirs_overview.php:400 -#: includes/include.upl_dirs_overview.php:547 +#: includes/include.upl_dirs_overview.php:347 +#: includes/include.upl_dirs_overview.php:479 msgid "Delete directory" -msgstr "Verzeichnis löschen" +msgstr "Verzeichnis löschen" -#: includes/include.upl_dirs_overview.php:400 -#: includes/include.upl_dirs_overview.php:547 +#: includes/include.upl_dirs_overview.php:347 +#: includes/include.upl_dirs_overview.php:479 msgid "Do you really want to delete the following directory:" -msgstr "Möchten Sie das folgende Verzeichnis wirklich löschen:" +msgstr "Möchten Sie das folgende Verzeichnis wirklich löschen:" -#: includes/include.upl_dirs_overview.php:405 -#: includes/include.upl_dirs_overview.php:552 +#: includes/include.upl_dirs_overview.php:350 +#: includes/include.upl_dirs_overview.php:482 msgid "Directory contains files" msgstr "Verzeichnis enthält Dateien" -#: includes/include.upl_dirs_overview.php:408 -#: includes/include.upl_dirs_overview.php:555 +#: includes/include.upl_dirs_overview.php:352 +#: includes/include.upl_dirs_overview.php:484 #: includes/include.lay_edit_form.php:41 includes/include.lay_edit_form.php:48 #: includes/include.lang_edit.php:122 includes/rights_lay.inc.php:57 #: includes/grouprights_mod.inc.php:54 includes/grouprights_str.inc.php:54 @@ -1912,12 +1352,12 @@ msgstr "Verzeichnis enthält Dateien" #: includes/include.rights_create.php:43 #: includes/include.html_tpl_history.php:59 #: includes/include.system_purge.php:37 includes/include.style_history.php:57 -#: includes/include.con_edit_form.php:764 includes/grouprights_lay.inc.php:55 +#: includes/include.con_edit_form.php:713 includes/grouprights_lay.inc.php:55 #: includes/grouprights_lay.inc.php:74 -#: includes/include.html_tpl_edit_form.php:50 +#: includes/include.html_tpl_edit_form.php:49 #: includes/grouprights_members.inc.php:41 includes/include.client_edit.php:46 -#: includes/include.style_edit_form.php:51 includes/include.logs.php:46 -#: includes/include.js_edit_form.php:50 includes/include.rights_overview.php:49 +#: includes/include.style_edit_form.php:50 includes/include.logs.php:46 +#: includes/include.js_edit_form.php:49 includes/include.rights_overview.php:49 #: includes/rights_con.inc.php:56 includes/include.js_history.php:55 #: includes/rights_mod.inc.php:55 includes/include.grouprights_overview.php:42 #: includes/grouprights_tpl.inc.php:53 includes/grouprights_area.inc.php:65 @@ -1928,12 +1368,13 @@ msgstr "Verzeichnis enthält Dateien" #: includes/include.con_art_overview.php:908 includes/rights_tpl.inc.php:55 #: includes/include.tpl_edit_form.php:39 #: includes/include.tplcfg_edit_form.php:144 includes/rights_str.inc.php:55 +#: includes/include.js_edit_form_1.php:50 #: includes/include.grouprights_create.php:42 #: includes/include.mod_history.php:52 msgid "Permission denied" msgstr "Zugriff verweigert" -#: includes/include.upl_dirs_overview.php:454 +#: includes/include.upl_dirs_overview.php:394 msgid "Database Filesystem" msgstr "Datenbank-Dateisystem" @@ -1943,7 +1384,7 @@ msgstr "-- Neues Layout --" #: includes/include.lay_edit_form.php:52 msgid "Layout deleted" -msgstr "Layout gelöscht" +msgstr "Layout gelöscht" #: includes/include.lay_edit_form.php:116 #, php-format @@ -1956,7 +1397,7 @@ msgid "" "site editing." msgstr "" "Der body-Tag existiert nicht in diesem Layout. Dies ist eine Voraussetzung " -"für das In-Site-Editing." +"für das In-Site-Editing." #: includes/include.lay_edit_form.php:132 msgid "" @@ -1964,10 +1405,10 @@ msgid "" "site editing." msgstr "" "Der head-Tag existiert nicht in diesem Layout. Dies ist eine Voraussetzung " -"für das In-Site-Editing." +"für das In-Site-Editing." #: includes/include.lay_edit_form.php:154 -#: includes/include.html_tpl_edit_form.php:185 +#: includes/include.html_tpl_edit_form.php:168 #, php-format msgid "Tag '%s' %s has no end tag (start tag is on line %s char %s)" msgstr "" @@ -1986,9 +1427,10 @@ msgstr "Beim Speichern alle Default-Module in neue Container zuweisen" #: includes/include.lay_edit_form.php:195 includes/include.lay_history.php:122 #: includes/include.html_tpl_history.php:165 #: includes/include.style_history.php:162 -#: includes/include.html_tpl_edit_form.php:215 -#: includes/include.style_edit_form.php:199 -#: includes/include.js_edit_form.php:177 includes/include.js_history.php:157 +#: includes/include.html_tpl_edit_form.php:197 +#: includes/include.style_edit_form.php:185 +#: includes/include.js_edit_form.php:170 includes/include.js_history.php:157 +#: includes/include.js_edit_form_1.php:177 msgid "Code" msgstr "Quelltext" @@ -2161,15 +1603,14 @@ msgstr "Datumsformat" #: includes/include.frontend.left_top.php:395 #, php-format msgid "Do you really want to delete the user %s?" -msgstr "" -"Möchten Sie den folgenden Benutzer %s wirklich löschen?" +msgstr "Möchten Sie den folgenden Benutzer %s wirklich löschen?" #: includes/include.rights_menu.php:135 #: includes/include.frontend.user_menu.php:275 #: includes/cfg_language_de.inc.php:172 #: includes/include.frontend.left_top.php:397 msgid "Delete user" -msgstr "Benutzer löschen" +msgstr "Benutzer löschen" #: includes/include.stat_overview.php:47 includes/include.stat_overview.php:60 msgid "Full statistics" @@ -2198,10 +1639,20 @@ msgstr "Jährlich" msgid "Current" msgstr "Aktuell" +#: includes/include.stat_overview.php:89 includes/include.con_edit_form.php:197 +#: includes/include.upl_artlist.php:81 includes/include.con_art_overview.php:74 +#: includes/include.con_art_overview.php:659 backend_search.php:492 +msgid "Title" +msgstr "Titel" + #: includes/include.stat_overview.php:91 includes/functions.system.php:405 msgid "Number of articles" msgstr "Anzahl der Artikel" +#: includes/include.stat_overview.php:92 +msgid "Hits" +msgstr "Hits" + #: includes/include.stat_overview.php:94 msgid "Hits in this language" msgstr "Hits in dieser Sprache" @@ -2209,7 +1660,7 @@ msgstr "Hits in dieser Sprache" #: includes/include.CMS_SIMPLELINK.php:139 includes/include.CMS_LINK.php:142 #, php-format msgid "Edit link for container %s" -msgstr "Link für Container %s bearbeiten" +msgstr "Link für Container %s bearbeiten" #: includes/include.system_db_backup.php:34 msgid "Backupfolder missing or not writable!" @@ -2255,14 +1706,7 @@ msgstr "Zurück zur Ãœbersicht" #: includes/include.system_db_backup.php:285 msgid "File successfully deleted." -msgstr "Datei erfolgreich gelöscht." - -#: includes/include.system_db_backup.php:293 -#: includes/include.js_files_overview.php:131 -#: includes/include.html_tpl_files_overview.php:132 -#: includes/include.style_files_overview.php:131 -msgid "Delete File" -msgstr "Datei löschen" +msgstr "Datei erfolgreich gelöscht." #: includes/include.system_db_backup.php:300 msgid "Download File" @@ -2272,20 +1716,20 @@ msgstr "Datei herunterladen" msgid "Saterday" msgstr "Samstag" -#: includes/functions.general.php:2010 +#: includes/functions.general.php:2007 #, php-format msgid "MySQL Database not reachable for installation %s" -msgstr "MySQL-Datenbank für die Installation %s ist nicht erreichbar" +msgstr "MySQL-Datenbank für die Installation %s ist nicht erreichbar" -#: includes/functions.general.php:2013 +#: includes/functions.general.php:2010 #, php-format msgid "" "The MySQL Database for the installation %s is not reachable. Please check if " "this is a temporary problem or if it is a real fault." msgstr "" -"Die MySQL-Datenbank für die Installation %s ist nicht erreichbar. Bitte " -"prüfen Sie, ob dies ein temporäres Problem oder ein wirklicher " -"Fehler ist." +"Die MySQL-Datenbank für die Installation %s ist nicht erreichbar. Bitte " +"prüfen Sie, ob dies ein temporäres Problem oder ein wirklicher Fehler " +"ist." #: includes/rights_lay.inc.php:75 includes/grouprights_lay.inc.php:85 msgid "Layout name" @@ -2309,8 +1753,8 @@ msgstr "Modulname" msgid "" "Apply rights for this category to all categories on the same level or above" msgstr "" -"Rechte dieser Kategorie allen Kategorien auf derselben Ebene oder darü" -"ber zuweisen" +"Rechte dieser Kategorie allen Kategorien auf derselben Ebene oder darüber " +"zuweisen" #: includes/grouprights_str.inc.php:213 includes/rights_con.inc.php:224 #: includes/grouprights_con.inc.php:238 includes/rights_str.inc.php:218 @@ -2321,7 +1765,7 @@ msgstr "" #: includes/include.todo.popup.php:58 msgid "Add TODO item" -msgstr "Todo Eintrag hinzufügen" +msgstr "Todo Eintrag hinzufügen" #: includes/include.todo.popup.php:67 #: includes/include.mycontenido.tasks.php:276 @@ -2334,6 +1778,11 @@ msgstr "Betreff" msgid "Reminder date" msgstr "Zeitpunkt Wiedervorlage" +#: includes/include.todo.popup.php:79 includes/include.upl_edit.php:219 +#: includes/include.mycontenido.tasks.edit.php:75 +msgid "End date" +msgstr "Enddatum" + #: includes/include.todo.popup.php:80 msgid "eMail notification" msgstr "E-Mail Benachrichtigung" @@ -2366,11 +1815,11 @@ msgstr "In die aktuelle Version kopieren" #: includes/include.style_history.php:182 includes/include.js_history.php:177 #: includes/include.mod_history.php:150 msgid "Version history was cleared" -msgstr "Die Versionshistorie wurde erfolgreich gelöscht" +msgstr "Die Versionshistorie wurde erfolgreich gelöscht" #: includes/include.lay_history.php:137 msgid "No layout history available" -msgstr "Keine Layout-Historie verfügbar" +msgstr "Keine Layout-Historie verfügbar" #: includes/include.lay_overview.php:78 includes/include.mod_edit_form.php:54 #: includes/include.str_overview.php:846 includes/include.mod_overview.php:209 @@ -2379,22 +1828,25 @@ msgstr "Kein Zugriff" #: includes/include.lay_overview.php:82 msgid "Layout is in use, cannot delete" -msgstr "Layout wird benutzt, löschen nicht möglich" +msgstr "Layout wird benutzt, löschen nicht möglich" #: includes/include.lay_overview.php:83 includes/include.tpl_overview.php:96 #: includes/include.mod_overview.php:196 msgid "Click for more information about usage" -msgstr "Klicken Sie für mehr Information über Verwendung" +msgstr "Klicken Sie für mehr Information über Verwendung" #: includes/include.lay_overview.php:92 includes/cfg_language_de.inc.php:147 msgid "Delete layout" -msgstr "Layout löschen" +msgstr "Layout löschen" #: includes/include.lay_overview.php:93 #, php-format msgid "Do you really want to delete the following layout:

    %s
    " -msgstr "" -"Möchten Sie das folgende Layout wirklich löschen:

    %s" +msgstr "Möchten Sie das folgende Layout wirklich löschen:

    %s" + +#: includes/include.lay_overview.php:101 includes/include.tpl_edit_form.php:160 +msgid "Layout" +msgstr "Layout" #: includes/include.lay_overview.php:118 #, php-format @@ -2472,6 +1924,11 @@ msgstr "Heute" msgid "Day(s)" msgstr "Tag(e)" +#: includes/include.mycontenido.tasks.php:276 +#: includes/include.con_edit_form.php:268 includes/include.upl_artlist.php:81 +msgid "Created" +msgstr "Erstelldatum" + #: includes/include.mycontenido.tasks.php:276 msgid "End Date" msgstr "Enddatum" @@ -2490,6 +1947,13 @@ msgstr "%% fertig" msgid "Due in" msgstr "Fällig in" +#: includes/include.mycontenido.tasks.php:276 +#: includes/include.frontend.left_top.php:165 +#: includes/include.con_art_overview.php:79 +#: includes/include.upl_files_overview.php:530 backend_search.php:497 +msgid "Actions" +msgstr "Aktionen" + #: includes/include.mycontenido.tasks.php:302 msgid "Unnamed item" msgstr "Unbenannter Eintrag" @@ -2504,7 +1968,7 @@ msgstr "Kein Status gesetzt" #: includes/include.mycontenido.tasks.php:338 msgid "Delete item" -msgstr "Element löschen" +msgstr "Element löschen" #: includes/include.mycontenido.tasks.php:345 msgid "Edit item" @@ -2534,6 +1998,19 @@ msgstr "Speichern und Editor schließen" msgid "Please set this property in systemsettings directly" msgstr "Bitte setzen Sie diese Einstellung direkt in den Systemeinstellungen" +#: includes/include.systemsettings.php:60 +#: includes/include.systemsettings.php:174 +#: includes/include.rights_create.php:147 includes/include.client_edit.php:226 +#: includes/include.rights_overview.php:200 +#: includes/include.rights_overview.php:354 +#: includes/include.grouprights_overview.php:109 +#: includes/include.grouprights_overview.php:210 +#: includes/include.clientsettings.php:95 +#: includes/include.clientsettings.php:191 +#: includes/include.grouprights_create.php:99 +msgid "Value" +msgstr "Wert" + #: includes/include.systemsettings.php:69 #: includes/include.systemsettings.php:73 includes/include.upl_edit.php:66 #: includes/include.clientsettings.php:110 @@ -2546,7 +2023,7 @@ msgstr "Bearbeiten" #: includes/include.clientsettings.php:104 #: includes/include.client_artspec.php:94 msgid "Delete" -msgstr "Löschen" +msgstr "Löschen" #: includes/include.systemsettings.php:153 #: includes/include.clientsettings.php:170 @@ -2556,7 +2033,7 @@ msgstr "Keine definierten Eigenschaften" #: includes/include.systemsettings.php:163 #: includes/include.clientsettings.php:179 msgid "Add new variable" -msgstr "Neue Variable hinzufügen" +msgstr "Neue Variable hinzufügen" #: includes/include.rights_create.php:53 msgid "Username can't be empty" @@ -2578,7 +2055,7 @@ msgstr "Unbekannter Fehler" #: includes/include.mycontenido_settings.php:62 #: includes/include.rights_overview.php:132 msgid "Passwords don't match" -msgstr "Passwörter stimmen nicht überein" +msgstr "Passwörter stimmen nicht überein" #: includes/include.rights_create.php:144 includes/include.client_edit.php:223 #: includes/include.rights_overview.php:197 @@ -2673,16 +2150,16 @@ msgstr "WYSIWYG-Editor benutzen" #: includes/include.rights_create.php:290 #: includes/include.rights_overview.php:399 msgid "Valid from" -msgstr "Gültig von" +msgstr "Gültig von" #: includes/include.rights_create.php:307 #: includes/include.rights_overview.php:420 msgid "Valid to" -msgstr "Gültig bis" +msgstr "Gültig bis" #: includes/include.lang_left_top.php:80 includes/cfg_language_de.inc.php:189 msgid "Create language" -msgstr "Sprache erstellen für" +msgstr "Sprache erstellen für" #: includes/include.html_tpl_history.php:129 #: includes/include.js_history.php:125 @@ -2692,7 +2169,7 @@ msgstr "JScript bearbeiten" #: includes/include.html_tpl_history.php:179 #: includes/include.html_tpl_history.php:187 msgid "No template history available" -msgstr "Keine Template-Historie verfügbar" +msgstr "Keine Template-Historie verfügbar" #: includes/include.system_purge.php:79 includes/include.system_purge.php:87 #: includes/include.system_purge.php:95 includes/include.system_purge.php:103 @@ -2704,7 +2181,7 @@ msgstr "Mandant " #: includes/include.system_purge.php:135 #, php-format msgid "The entries of %s table are not deleted!" -msgstr "Einträge von der Tabelle %s wurden nicht gelöscht!" +msgstr "Einträge von der Tabelle %s wurden nicht gelöscht!" #: includes/include.system_purge.php:88 #, php-format @@ -2713,7 +2190,7 @@ msgstr "Tabelle %s ist nicht akutalisiert!" #: includes/include.system_purge.php:96 msgid "The cache is not deleted!" -msgstr "Cache wurde nicht gelöscht!" +msgstr "Cache wurde nicht gelöscht!" #: includes/include.system_purge.php:104 msgid "The log is not deleted!" @@ -2721,7 +2198,7 @@ msgstr "Log-Datei wurde nicht geleert!" #: includes/include.system_purge.php:113 msgid "The history is not deleted!" -msgstr "Versionierung wurde nicht gelöscht!" +msgstr "Versionierung wurde nicht gelöscht!" #: includes/include.system_purge.php:143 msgid "The contenido log is not cleaned!" @@ -2729,7 +2206,7 @@ msgstr "ConLite Log-Datei wurde nicht geleert!" #: includes/include.system_purge.php:150 msgid "The contenido cache is not deleted!" -msgstr "ConLite Cache wurde nicht gelöscht!" +msgstr "ConLite Cache wurde nicht gelöscht!" #: includes/include.system_purge.php:157 msgid "The contenido cronjobs are not cleaned!" @@ -2741,12 +2218,11 @@ msgstr "Aktualisierung der Sequence Tabelle nicht komplett!" #: includes/include.system_purge.php:169 msgid "The changes were successfully executed." -msgstr "Die Änderungen wurden erfolgreich ausgeführt." +msgstr "Die Änderungen wurden erfolgreich ausgeführt." #: includes/include.system_purge.php:171 msgid "The changes were not all successfully completed." -msgstr "" -"Die Änderungen wurden teilweise nicht erfolgreich ausgeführt." +msgstr "Die Änderungen wurden teilweise nicht erfolgreich ausgeführt." #: includes/include.system_purge.php:190 includes/include.system_purge.php:214 msgid "System purge" @@ -2781,7 +2257,7 @@ msgstr "Code-Generierung in der Tabelle %s" #: includes/include.system_purge.php:202 msgid "Clear client cache" -msgstr "Cache-Dateien löschen" +msgstr "Cache-Dateien löschen" #: includes/include.system_purge.php:203 msgid "Clear client log file" @@ -2789,7 +2265,7 @@ msgstr "Log-Datei leeren" #: includes/include.system_purge.php:204 msgid "Clear client history" -msgstr "Versionierung löschen" +msgstr "Versionierung löschen" #: includes/include.system_purge.php:205 msgid "Keep last histories" @@ -2805,7 +2281,7 @@ msgstr "ConLite Log-Datei leeren" #: includes/include.system_purge.php:210 msgid "Clear contenido cache" -msgstr "ConLite Cache löschen" +msgstr "ConLite Cache löschen" #: includes/include.system_purge.php:211 msgid "Reset cronjobs" @@ -2817,11 +2293,11 @@ msgstr "Sequence-Tabelle aktualisiert" #: includes/include.system_purge.php:215 msgid "These changes can not be cancelled." -msgstr "Die Änderungen können Sie nicht rückgängig machen." +msgstr "Die Änderungen können Sie nicht rückgängig machen." #: includes/include.system_purge.php:215 msgid "Do you really want to complete it?" -msgstr "Wollen Sie diese Aktion wirklich ausführen?" +msgstr "Wollen Sie diese Aktion wirklich ausführen?" #: includes/include.system_purge.php:220 msgid "No action selected!" @@ -2847,6 +2323,12 @@ msgstr "Nur Frontend" msgid "Backend only" msgstr "Nur Backend" +#: includes/include.rights_left_top.php:103 +#: includes/cfg_language_de.inc.php:171 includes/cfg_language_de.inc.php:174 +#: includes/include.frontend.left_top.php:178 +msgid "Create user" +msgstr "Benutzer erstellen" + #: includes/include.rights_left_top.php:115 #: includes/include.frontend.user_edit.php:185 msgid "User name" @@ -2862,7 +2344,7 @@ msgstr "Editor schließen und Änderungen speichern" #: includes/include.con_editcontent.php:217 msgid "Do you want to save changes?" -msgstr "Möchten Sie die Änderungen speichern?" +msgstr "Möchten Sie die Änderungen speichern?" #: includes/include.con_editcontent.php:375 msgid "No template assigned to the category
    and/or the article" @@ -2870,8 +2352,7 @@ msgstr "Kein Template mit einer Kategorie
    und/oder einem Artikel assoziiert" #: includes/include.con_editcontent.php:376 msgid "The code for the following article
    couldnt be generated:" -msgstr "" -"Der Code für den folgenden Artikel
    konnte nicht erstellt werden:" +msgstr "Der Code für den folgenden Artikel
    konnte nicht erstellt werden:" #: includes/include.grouprights_left_top.php:90 #: includes/cfg_language_de.inc.php:181 @@ -2905,7 +2386,7 @@ msgstr "Style bearbeiten" #: includes/include.style_history.php:176 #: includes/include.style_history.php:184 includes/include.js_history.php:179 msgid "No style history available" -msgstr "Keine Style-Historie verfügbar" +msgstr "Keine Style-Historie verfügbar" #: includes/functions.con.php:331 includes/functions.con.php:518 msgid "Default title" @@ -2927,7 +2408,7 @@ msgstr "-- Alle Felder --" msgid "-- All Groups --" msgstr "-- Alle Gruppen --" -#: includes/include.con_edit_form.php:134 +#: includes/include.con_edit_form.php:126 #: includes/include.tplcfg_edit_form.php:57 #: external/backendedit/front_content.php:484 #: external/frontend/front_content.php:494 @@ -2935,100 +2416,104 @@ msgstr "-- Alle Gruppen --" msgid "Article is in use by %s (%s)" msgstr "Artikel wird benutzt von %s (%s)" -#: includes/include.con_edit_form.php:238 +#: includes/include.con_edit_form.php:200 includes/include.str_overview.php:594 +msgid "Alias" +msgstr "Alias" + +#: includes/include.con_edit_form.php:222 #: includes/include.client_artspec.php:163 msgid "No article specifications found!" msgstr "Keine Artikelspezifikation gefunden!" -#: includes/include.con_edit_form.php:241 +#: includes/include.con_edit_form.php:225 #: includes/include.client_artspec.php:79 msgid "Article specification" msgstr "Artikelspezifikation" -#: includes/include.con_edit_form.php:253 +#: includes/include.con_edit_form.php:237 msgid "Articlelink" msgstr "Artikellink" -#: includes/include.con_edit_form.php:260 +#: includes/include.con_edit_form.php:244 msgid "Select an entry to display link" msgstr "Eintrag wählen, um einen Link anzuzeigen" -#: includes/include.con_edit_form.php:261 +#: includes/include.con_edit_form.php:245 msgid "Article only" msgstr "Nur Artikel" -#: includes/include.con_edit_form.php:262 +#: includes/include.con_edit_form.php:246 msgid "Article with Category" msgstr "Artikel mit Kategorie" -#: includes/include.con_edit_form.php:263 +#: includes/include.con_edit_form.php:247 msgid "Article with Category and Language" msgstr "Artikel mit Kategorie und Sprache" -#: includes/include.con_edit_form.php:264 +#: includes/include.con_edit_form.php:248 msgid "Article with Language" msgstr "Artikel mit Sprache" -#: includes/include.con_edit_form.php:278 +#: includes/include.con_edit_form.php:262 msgid "Author (Creator)" msgstr "erstellt von" -#: includes/include.con_edit_form.php:288 +#: includes/include.con_edit_form.php:272 msgid "Author (Modifier)" -msgstr "verändert von" +msgstr "geändert von" -#: includes/include.con_edit_form.php:289 +#: includes/include.con_edit_form.php:273 msgid "Last modified" msgstr "Änderungsdatum" -#: includes/include.con_edit_form.php:293 +#: includes/include.con_edit_form.php:277 msgid "Publishing date" -msgstr "Veröffentlichungsdatum" +msgstr "Veröffentlichungsdatum" -#: includes/include.con_edit_form.php:297 +#: includes/include.con_edit_form.php:281 #: includes/include.con_art_overview.php:309 msgid "not yet published" -msgstr "noch nicht veröffentlicht" +msgstr "noch nicht veröffentlicht" -#: includes/include.con_edit_form.php:300 +#: includes/include.con_edit_form.php:284 msgid "Publisher" -msgstr "veröffentlicht von" +msgstr "veröffentlicht von" -#: includes/include.con_edit_form.php:308 +#: includes/include.con_edit_form.php:292 msgid "Redirect" msgstr "Weiterleitung" -#: includes/include.con_edit_form.php:324 +#: includes/include.con_edit_form.php:306 msgid "New Window" msgstr "Neues Fenster" -#: includes/include.con_edit_form.php:350 +#: includes/include.con_edit_form.php:327 #: includes/include.con_art_overview.php:487 msgid "Start article" msgstr "Startartikel" -#: includes/include.con_edit_form.php:354 +#: includes/include.con_edit_form.php:331 #: includes/include.con_art_overview.php:746 msgid "Sort key" -msgstr "Sortierschlüssel" +msgstr "Sortierschlüssel" -#: includes/include.con_edit_form.php:391 includes/cfg_language_de.inc.php:114 +#: includes/include.con_edit_form.php:364 includes/cfg_language_de.inc.php:114 msgid "Remove assignments" msgstr "Zuweisungen entfernen" -#: includes/include.con_edit_form.php:393 +#: includes/include.con_edit_form.php:366 msgid "Remove multiple category assignments" msgstr "Mehrfachzuordnung entfernen" -#: includes/include.con_edit_form.php:394 +#: includes/include.con_edit_form.php:367 msgid "" "Do you really want to remove the assignments to all categories except the " "current one?" msgstr "" -"Möchten Sie wirklich alle Zuweisungen zu allen Kategorien außer " -"der aktuellen entfernen?" +"Möchten Sie wirklich alle Zuweisungen zu allen Kategorien außer der " +"aktuellen entfernen?" -#: includes/include.con_edit_form.php:410 +#: includes/include.con_edit_form.php:382 msgid "" "Language parts of the articles are existing in other languages and are " "online. To change the category assignment, please set the other articles " @@ -3038,53 +2523,48 @@ msgstr "" "und sind online. Um die Kategoriezuweisung zu verändern, setzen Sie die " "anderen sprachabhängigen Teile zuerst offline." -#: includes/include.con_edit_form.php:549 +#: includes/include.con_edit_form.php:511 msgid "Choose Startdate" msgstr "Startzeitpunkt wählen" -#: includes/include.con_edit_form.php:550 +#: includes/include.con_edit_form.php:512 msgid "Choose Enddate" msgstr "Endzeitpunkt wählen" -#: includes/include.con_edit_form.php:648 +#: includes/include.con_edit_form.php:605 msgid "Select date" msgstr "Datum auswählen" -#: includes/include.con_edit_form.php:685 +#: includes/include.con_edit_form.php:639 msgid "Summary" msgstr "Zusammenfassung" #: includes/include.tpl_overview.php:99 includes/cfg_language_de.inc.php:164 msgid "Delete template" -msgstr "Template löschen" +msgstr "Template löschen" #: includes/include.tpl_overview.php:100 #, php-format msgid "Do you really want to delete the following template:

    %s
    " -msgstr "" -"Möchten Sie das folgende Template wirklich löschen:

    %s" +msgstr "Möchten Sie das folgende Template wirklich löschen:

    %s" #: includes/include.tpl_overview.php:105 msgid "Template in use, cannot delete" -msgstr "Template wird benutzt, löschen nicht möglich" +msgstr "Template wird benutzt, löschen nicht möglich" + +#: includes/include.tpl_overview.php:111 includes/cfg_language_de.inc.php:167 +#: includes/cfg_language_de.inc.php:168 +msgid "Duplicate template" +msgstr "Template duplizieren" #: includes/include.tpl_overview.php:128 #, php-format msgid "The template '%s' is used for following categories and articles" msgstr "Das Template '%s' wird bei folgenden Kategorien und Artikeln benutzt" -#: includes/include.js_files_overview.php:132 -#: includes/include.html_tpl_files_overview.php:133 -#: includes/include.style_files_overview.php:132 -#, php-format -msgid "Do you really want to delete the following file:

    %s
    " -msgstr "" -"Möchten Sie die folgende Datei wirklich löschen:

    %s" - #: includes/main.login.php:67 msgid "No Login Information available." -msgstr "Keine Login-Informationen verfügbar." +msgstr "Keine Login-Informationen verfügbar." #: includes/main.login.php:74 msgid "" @@ -3098,8 +2578,8 @@ msgid "" "The setup directory still exists. Please remove the setup directory before " "you continue." msgstr "" -"Das Setupverzeichnis existiert noch. Bitte löschen Sie das " -"Setupverzeichnis, bevor Sie fortfahren." +"Das Setupverzeichnis existiert noch. Bitte löschen Sie das Setupverzeichnis, " +"bevor Sie fortfahren." #: includes/main.login.php:95 msgid "" @@ -3128,7 +2608,7 @@ msgstr "Mandant wechseln" #: includes/main.login.php:153 msgid "No clients available!" -msgstr "Keine Mandanten verfügbar!" +msgstr "Keine Mandanten verfügbar!" #: includes/main.login.php:205 #, php-format @@ -3156,22 +2636,22 @@ msgstr "Symbolhilfe" msgid "Contenido Manual" msgstr "Contenido Redakteurshandbuch" -#: includes/include.html_tpl_edit_form.php:197 -#: includes/include.style_edit_form.php:180 -#: includes/include.js_edit_form.php:159 +#: includes/include.html_tpl_edit_form.php:179 +#: includes/include.style_edit_form.php:167 +#: includes/include.js_edit_form.php:151 +#: includes/include.js_edit_form_1.php:159 msgid "Edit file" msgstr "Datei bearbeiten" #: includes/include.frontend.group_menu.php:51 msgid "Delete frontend group" -msgstr "Frontend-Gruppe löschen" +msgstr "Frontend-Gruppe löschen" #: includes/include.frontend.group_menu.php:52 #, php-format msgid "Do you really want to delete the following frontend group:
    %s" msgstr "" -"Möchten Sie die folgende Frontend-Gruppe wirklich löschen:
    " -"%s" +"Möchten Sie die folgende Frontend-Gruppe wirklich löschen:
    %s" #: includes/cfg_language_de.inc.php:98 #: includes/include.con_art_overview.php:384 backend_search.php:661 @@ -3202,6 +2682,17 @@ msgstr "Kategorie synchronisieren" msgid "Syncronize Article" msgstr "Artikel synchronisieren" +#: includes/cfg_language_de.inc.php:105 includes/cfg_language_de.inc.php:124 +#: includes/include.str_overview.php:1055 +#: includes/include.str_overview.php:1057 +msgid "Protect category" +msgstr "Kategorie schützen" + +#: includes/cfg_language_de.inc.php:106 +#: includes/include.con_art_overview.php:551 backend_search.php:678 +msgid "Delete article" +msgstr "Artikel löschen" + #: includes/cfg_language_de.inc.php:107 msgid "Edit template configuration" msgstr "Template-Konfiguration bearbeiten" @@ -3214,6 +2705,10 @@ msgstr "Artikel duplizieren" msgid "Expand boxes" msgstr "Boxen ausklappen/einklappen" +#: includes/cfg_language_de.inc.php:110 backend_search.php:677 +msgid "Configure template" +msgstr "Template konfigurieren" + #: includes/cfg_language_de.inc.php:111 msgid "Create article" msgstr "Neuen Artikel erstellen" @@ -3238,6 +2733,10 @@ msgstr "Artikeleigenschaften bearbeiten" msgid "Help" msgstr "Hilfe" +#: includes/cfg_language_de.inc.php:120 +msgid "Rename category" +msgstr "Kategorie umbenennen" + #: includes/cfg_language_de.inc.php:121 msgid "New category" msgstr "Neue Kategorie" @@ -3248,7 +2747,7 @@ msgstr "Kategorie on- oder offline setzen" #: includes/cfg_language_de.inc.php:123 msgid "Disable category" -msgstr "Kategorie schützen" +msgstr "Kategorie schützen" #: includes/cfg_language_de.inc.php:125 msgid "Frontend access" @@ -3256,7 +2755,7 @@ msgstr "Frontend-Zugriff" #: includes/cfg_language_de.inc.php:126 msgid "Delete category" -msgstr "Kategorie löschen" +msgstr "Kategorie löschen" #: includes/cfg_language_de.inc.php:127 msgid "Move category up" @@ -3266,10 +2765,23 @@ msgstr "Eine Kategorie nach oben verschieben" msgid "Move category down" msgstr "Eine Kategorie nach unten verschieben" +#: includes/cfg_language_de.inc.php:129 +msgid "Move category" +msgstr "Kategorie verschieben" + #: includes/cfg_language_de.inc.php:130 msgid "Create new tree" msgstr "Neuen Baum anlegen" +#: includes/cfg_language_de.inc.php:131 +msgid "Duplicate category" +msgstr "Kategorie duplizieren" + +#: includes/cfg_language_de.inc.php:132 includes/include.str_overview.php:1041 +#: includes/include.str_overview.php:1044 +msgid "Configure category" +msgstr "Kategorie konfigurieren" + #: includes/cfg_language_de.inc.php:133 msgid "Edit category" msgstr "Kategorie bearbeiten" @@ -3285,11 +2797,11 @@ msgstr "Dateien hochladen" #: includes/cfg_language_de.inc.php:137 msgid "Delete files" -msgstr "Dateien löschen" +msgstr "Dateien löschen" #: includes/cfg_language_de.inc.php:138 msgid "Remove directory" -msgstr "Verzeichnis löschen" +msgstr "Verzeichnis löschen" #: includes/cfg_language_de.inc.php:139 msgid "Rename directory" @@ -3305,7 +2817,7 @@ msgstr "Datei umbenennen" #: includes/cfg_language_de.inc.php:142 msgid "Multidelete Files" -msgstr "Mehrfachlöschung" +msgstr "Mehrfachlöschung" #: includes/cfg_language_de.inc.php:143 #: includes/include.upl_files_overview.php:752 @@ -3330,11 +2842,11 @@ msgstr "Historie verwalten" #: includes/cfg_language_de.inc.php:202 includes/cfg_language_de.inc.php:208 #: includes/cfg_language_de.inc.php:214 msgid "Truncate History" -msgstr "Historie löschen" +msgstr "Historie löschen" #: includes/cfg_language_de.inc.php:154 includes/include.mod_overview.php:204 msgid "Delete module" -msgstr "Modul löschen" +msgstr "Modul löschen" #: includes/cfg_language_de.inc.php:158 msgid "Create module" @@ -3346,7 +2858,7 @@ msgstr "Modul importieren/exportieren" #: includes/cfg_language_de.inc.php:160 msgid "Translate modules" -msgstr "Modul übersetzen" +msgstr "Modul übersetzen" #: includes/cfg_language_de.inc.php:161 msgid "Translation import/export" @@ -3383,11 +2895,11 @@ msgstr "Benutzer bearbeiten" #: includes/cfg_language_de.inc.php:178 msgid "Delete group members" -msgstr "Gruppenmitglieder löschen" +msgstr "Gruppenmitglieder löschen" #: includes/cfg_language_de.inc.php:179 msgid "Add group members" -msgstr "Gruppenmitglied hinzufügen" +msgstr "Gruppenmitglied hinzufügen" #: includes/cfg_language_de.inc.php:180 #: includes/include.frontend.group_edit.php:275 @@ -3397,7 +2909,7 @@ msgstr "Gruppe bearbeiten" #: includes/cfg_language_de.inc.php:182 #: includes/include.grouprights_menu.php:196 msgid "Delete group" -msgstr "Gruppe löschen" +msgstr "Gruppe löschen" #: includes/cfg_language_de.inc.php:184 msgid "Show statistics" @@ -3417,7 +2929,7 @@ msgstr "Sprache umbenennen" #: includes/cfg_language_de.inc.php:190 includes/include.lang_overview.php:78 msgid "Delete language" -msgstr "Sprache löschen" +msgstr "Sprache löschen" #: includes/cfg_language_de.inc.php:193 msgid "Linkchecker" @@ -3441,7 +2953,7 @@ msgstr "CSS erstellen" #: includes/cfg_language_de.inc.php:200 msgid "Delete CSS" -msgstr "CSS löschen" +msgstr "CSS löschen" #: includes/cfg_language_de.inc.php:204 msgid "Edit script" @@ -3449,7 +2961,7 @@ msgstr "Script bearbeiten" #: includes/cfg_language_de.inc.php:205 msgid "Delete script" -msgstr "Script löschen" +msgstr "Script löschen" #: includes/cfg_language_de.inc.php:206 includes/include.js_left_top.php:50 msgid "Create script" @@ -3465,15 +2977,19 @@ msgstr "HTML-Template erstellen" #: includes/cfg_language_de.inc.php:212 msgid "Delete HTML-Template" -msgstr "HTML-Template löschen" +msgstr "HTML-Template löschen" #: includes/cfg_language_de.inc.php:216 msgid "Edit newsletter" msgstr "Newsletter bearbeiten" +#: includes/cfg_language_de.inc.php:217 +msgid "Create newsletter" +msgstr "Newsletter erzeugen" + #: includes/cfg_language_de.inc.php:218 msgid "Delete newsletter" -msgstr "Newsletter löschen" +msgstr "Newsletter löschen" #: includes/cfg_language_de.inc.php:219 msgid "Duplicate newsletter" @@ -3493,7 +3009,7 @@ msgstr "Test-Newsletter versenden (an Gruppen)" #: includes/cfg_language_de.inc.php:223 msgid "Delete dispatch job" -msgstr "Newsletter Versand-Job löschen" +msgstr "Newsletter Versand-Job löschen" #: includes/cfg_language_de.inc.php:224 msgid "Remove recipient from dispatch job" @@ -3501,7 +3017,7 @@ msgstr "Empfänger aus Newsletter-Job herausnehmen" #: includes/cfg_language_de.inc.php:225 msgid "Run job" -msgstr "Job ausführen" +msgstr "Job ausführen" #: includes/cfg_language_de.inc.php:226 msgid "View dispatch job details" @@ -3511,9 +3027,13 @@ msgstr "Newsletter Versand-Job-Details ansehen" msgid "Edit recipient" msgstr "Empfänger bearbeiten" +#: includes/cfg_language_de.inc.php:229 +msgid "Create recipient" +msgstr "Empfänger erzeugen" + #: includes/cfg_language_de.inc.php:230 msgid "Delete recipient" -msgstr "Empfänger löschen" +msgstr "Empfänger löschen" #: includes/cfg_language_de.inc.php:231 msgid "Purge recipients" @@ -3525,11 +3045,15 @@ msgstr "Empfänger importieren" #: includes/cfg_language_de.inc.php:233 msgid "Execute recipients import" -msgstr "Empfänger-Import ausführen" +msgstr "Empfänger-Import ausführen" #: includes/cfg_language_de.inc.php:234 msgid "Delete recipient group" -msgstr "Empfängergruppe löschen" +msgstr "Empfängergruppe löschen" + +#: includes/cfg_language_de.inc.php:235 +msgid "Create recipient group" +msgstr "Empfängergruppe erstellen" #: includes/cfg_language_de.inc.php:236 msgid "Delete recipient from group" @@ -3545,7 +3069,7 @@ msgstr "Eigene MyConLite-Einstellungen bearbeiten" #: includes/cfg_language_de.inc.php:240 msgid "Delete reminder item" -msgstr "Wiedervorlage löschen" +msgstr "Wiedervorlage löschen" #: includes/cfg_language_de.inc.php:241 msgid "Save todo item" @@ -3561,11 +3085,11 @@ msgstr "Mandant bearbeiten" #: includes/cfg_language_de.inc.php:245 msgid "Remove client" -msgstr "Mandant löschen" +msgstr "Mandant löschen" #: includes/cfg_language_de.inc.php:246 msgid "Delete clientsetting" -msgstr "Mandanteneinstellungen löschen" +msgstr "Mandanteneinstellungen löschen" #: includes/cfg_language_de.inc.php:247 msgid "Edit clientsetting" @@ -3581,7 +3105,7 @@ msgstr "Artikelspezifikation erstellen/bearbeiten" #: includes/cfg_language_de.inc.php:250 msgid "Delete articlespecifications" -msgstr "Artikelspezifikation löschen" +msgstr "Artikelspezifikation löschen" #: includes/cfg_language_de.inc.php:251 msgid "Define default articlespecification" @@ -3605,11 +3129,11 @@ msgstr "Frontendbenutzer erstellen" #: includes/cfg_language_de.inc.php:257 includes/cfg_language_de.inc.php:263 msgid "Delete frontenduser" -msgstr "Frontendbenutzer löschen" +msgstr "Frontendbenutzer löschen" #: includes/cfg_language_de.inc.php:258 msgid "Delete frontendgroup" -msgstr "Frontendbenutzergruppe löschen" +msgstr "Frontendbenutzergruppe löschen" #: includes/cfg_language_de.inc.php:259 msgid "Save frontendgroup" @@ -3621,7 +3145,7 @@ msgstr "Frontendbenutzergruppe erstellen" #: includes/cfg_language_de.inc.php:262 msgid "Add frontendusers" -msgstr "Frontendbenutzer hinzufügen" +msgstr "Frontendbenutzer hinzufügen" #: includes/cfg_language_de.inc.php:264 msgid "Save frontendgroup permissions" @@ -3629,7 +3153,7 @@ msgstr "Frontendbenutzergruppe-Berechtigungen speichern" #: includes/cfg_language_de.inc.php:266 msgid "Delete system property" -msgstr "Systemeinstellung löschen" +msgstr "Systemeinstellung löschen" #: includes/cfg_language_de.inc.php:267 msgid "Edit system property" @@ -3649,7 +3173,7 @@ msgstr "Systemkonfiguration bearbeiten" #: includes/cfg_language_de.inc.php:272 msgid "Do system purge" -msgstr "Systembereinigung ausführen" +msgstr "Systembereinigung ausführen" #: includes/cfg_language_de.inc.php:274 msgid "Show log" @@ -3665,7 +3189,7 @@ msgstr "Passwort vergessen?" #: includes/cfg_language_de.inc.php:279 msgid "Delete note" -msgstr "Notiz löschen" +msgstr "Notiz löschen" #: includes/cfg_language_de.inc.php:280 msgid "Save note" @@ -3711,7 +3235,7 @@ msgstr "Passwort geändert" #: includes/include.mycontenido_settings.php:97 #, php-format msgid "Settings for %s" -msgstr "Einstellungen für %s" +msgstr "Einstellungen für %s" #: includes/include.mycontenido_settings.php:115 msgid "Old password" @@ -3723,7 +3247,7 @@ msgstr "WYSIWYG-Editor benutzen" #: includes/include.mycontenido_settings.php:129 msgid "The format is equal to PHP's date() function." -msgstr "Das Format stimmt mit dem der PHP date()-Funktion überein." +msgstr "Das Format stimmt mit dem der PHP date()-Funktion überein." #: includes/include.mycontenido_settings.php:131 msgid "Common date formattings" @@ -3731,14 +3255,14 @@ msgstr "Gebräuchliche Datumsformatierungen" #: includes/include.client_edit.php:49 msgid "No client ID passed" -msgstr "Keine ClientID übergeben" +msgstr "Keine ClientID übergeben" #: includes/include.client_edit.php:59 msgid "" "Notice: In order to use this client, you must create a new language for it." msgstr "" -"Hinweis: Um den neuen Mandanten zu nutzen, müssen Sie eine neue Sprache " -"dafür anlegen." +"Hinweis: Um den neuen Mandanten zu nutzen, müssen Sie eine neue Sprache " +"dafür anlegen." #: includes/include.client_edit.php:63 #, php-format @@ -3856,7 +3380,7 @@ msgstr "Medienname" #: includes/include.upl_edit.php:96 msgid "Keywords" -msgstr "Schlüsselwörter" +msgstr "Schlüsselwörter" #: includes/include.upl_edit.php:97 msgid "Internal notes" @@ -3870,6 +3394,10 @@ msgstr "Copyright" msgid "Protection" msgstr "Schutz" +#: includes/include.upl_edit.php:100 +msgid "Time control" +msgstr "Zeitsteuerung" + #: includes/include.upl_edit.php:101 #: includes/include.upl_search_results.php:286 #: includes/include.upl_files_overview.php:526 includes/include.CMS_IMG.php:283 @@ -3889,7 +3417,15 @@ msgstr "Zuletzt geändert von" #: includes/include.upl_edit.php:200 msgid "Protected for non-logged in users" -msgstr "Geschützt für nichteingeloggte Benutzer" +msgstr "Geschützt für nichteingeloggte Benutzer" + +#: includes/include.upl_edit.php:209 +msgid "Use time control" +msgstr "Zeitsteuerung aktivieren" + +#: includes/include.upl_edit.php:215 +msgid "Start date" +msgstr "Startdatum" #: includes/include.upl_edit.php:304 includes/include.upl_files_upload.php:67 #: includes/include.upl_files_overview.php:84 @@ -3912,6 +3448,18 @@ msgstr "Konnte Datei %s nicht laden" msgid "none" msgstr "kein" +#: includes/include.str_overview.php:572 includes/include.str_overview.php:573 +#: includes/include.str_overview.php:574 includes/include.con_left_top.php:428 +#: includes/include.con_str_overview.php:614 +msgid "Close all categories" +msgstr "Alle Kategorien schließen" + +#: includes/include.str_overview.php:578 includes/include.str_overview.php:579 +#: includes/include.str_overview.php:580 includes/include.con_left_top.php:429 +#: includes/include.con_str_overview.php:615 +msgid "Open all categories" +msgstr "Alle Kategorien öffnen" + #: includes/include.str_overview.php:596 #, php-format msgid "" @@ -3926,9 +3474,7 @@ msgstr "" #: includes/include.str_overview.php:598 #, php-format msgid "Do you really want to delete the following category:

    %s" -msgstr "" -"Möchten Sie die folgende Kategorie wirklich löschen:

    %s" +msgstr "Möchten Sie die folgende Kategorie wirklich löschen:

    %s" #: includes/include.str_overview.php:1013 msgid "Create new category" @@ -3973,6 +3519,14 @@ msgstr "Layout nicht vorhanden" msgid "Use this category" msgstr "Diese Kategorie verwenden" +#: includes/include.upl_artlist.php:81 +msgid "Start" +msgstr "Start" + +#: includes/include.upl_artlist.php:81 +msgid "Modified" +msgstr "Geändert" + #: includes/include.upl_artlist.php:81 msgid "Sort Order" msgstr "Sortierreihenfolge" @@ -4004,7 +3558,7 @@ msgstr "" msgid "Could not set new password: Passwords don't match" msgstr "" "Konnte neues Passwort nicht setzen: Passwort und Bestätigung stimmen " -"nicht überein" +"nicht überein" #: includes/include.frontend.user_edit.php:187 msgid "New password (again)" @@ -4020,13 +3574,13 @@ msgid "" "The plugin %s delivered an array for the displayed titles, but did not " "return an array for the contents." msgstr "" -"Das Plugin %s lieferte ein Array für die angezeigten Titel, aber " -"lieferte kein Array für die Inhalte." +"Das Plugin %s lieferte ein Array für die angezeigten Titel, aber lieferte " +"kein Array für die Inhalte." #: includes/include.frontend.user_edit.php:240 #: includes/include.rights_overview.php:460 msgid "Group membership" -msgstr "Gruppenzugehörigkeit" +msgstr "Gruppenzugehörigkeit" #: includes/functions.system.php:55 msgid "Can't clear install error log : Access is denied!" @@ -4178,15 +3732,15 @@ msgstr "Bug Report abgeschickt" #: includes/functions.system.php:649 msgid "please fill out all mandatory fields" -msgstr "Bitte alle Pflichtfelder ausfüllen" +msgstr "Bitte alle Pflichtfelder ausfüllen" #: includes/functions.system.php:653 msgid "please enter a valid E-Mail adress" -msgstr "Bitte geben Sie eine gültige E-Mail Adresse an" +msgstr "Bitte geben Sie eine gültige E-Mail Adresse an" #: includes/functions.system.php:657 msgid "you must agree the declaration of consent" -msgstr "Sie müssen der Vereinbarung zustimmen" +msgstr "Sie müssen der Vereinbarung zustimmen" #: includes/include.system_configuration.php:93 msgid "Versioning activated" @@ -4200,7 +3754,7 @@ msgstr "Versionierung" #: includes/include.system_configuration.php:94 msgid "Serverpath to version files" -msgstr "Serverpfad für Versionierungsdateien" +msgstr "Serverpfad für Versionierungsdateien" #: includes/include.system_configuration.php:95 msgid "Maximum number of stored versions" @@ -4208,7 +3762,7 @@ msgstr "Maximale Anzahl gespeicherter Versionen" #: includes/include.system_configuration.php:96 msgid "Check for updates" -msgstr "Auf Aktualisierungen prüfen" +msgstr "Auf Aktualisierungen prüfen" #: includes/include.system_configuration.php:96 #: includes/include.system_configuration.php:97 @@ -4226,7 +3780,7 @@ msgstr "Aktualisierungsperiode (Minuten)" #: includes/include.system_configuration.php:99 msgid "Clickable menu in backend" -msgstr "Hauptmenüwechsel bei Klick" +msgstr "Hauptmenüwechsel bei Klick" #: includes/include.system_configuration.php:99 #: includes/include.system_configuration.php:100 @@ -4247,7 +3801,7 @@ msgstr "Wartungsmodus aktiviert" #: includes/include.system_configuration.php:102 msgid "Use editarea for code highlighting" -msgstr "Editarea für Syntaxhighlighting verwenden" +msgstr "Editarea für Syntaxhighlighting verwenden" #: includes/include.system_configuration.php:103 msgid "Use TinyMce as insight editor" @@ -4286,7 +3840,7 @@ msgstr "Entwicklung" #: includes/include.system_configuration.php:110 msgid "Use image magic (if available)" -msgstr "Image magic benutzen (wenn verfügbar)" +msgstr "Image magic benutzen (wenn verfügbar)" #: includes/include.system_configuration.php:123 msgid "Update check period must be at least 60 minutes." @@ -4302,7 +3856,7 @@ msgstr "Zugriff verweigert" #: includes/include.rights_overview.php:75 msgid "User deleted" -msgstr "Benutzer gelöscht" +msgstr "Benutzer gelöscht" #: includes/include.rights_overview.php:144 #: includes/include.rights_overview.php:149 @@ -4370,15 +3924,15 @@ msgstr "Zielframe" #: includes/include.CMS_LINK.php:353 msgid "Open link in new window" -msgstr "Link in neues Fenster öffnen" +msgstr "Link in neues Fenster öffnen" #: includes/include.CMS_LINK.php:375 msgid "Open in new window" -msgstr "In neues Fenster öffnen" +msgstr "In neues Fenster öffnen" #: includes/include.js_history.php:171 msgid "No jscript history available" -msgstr "Keine JavaScript-Historie verfügbar" +msgstr "Keine JavaScript-Historie verfügbar" #: includes/include.upl_search_results.php:190 #: includes/include.upl_search_results.php:195 @@ -4396,7 +3950,7 @@ msgstr "Dateiname / Beschreibung" #: includes/include.upl_files_overview.php:462 #: includes/include.upl_files_overview.php:464 msgid "Size" -msgstr "Größe" +msgstr "Größe" #: includes/include.upl_search_results.php:246 #: includes/include.upl_search_results.php:251 @@ -4435,7 +3989,7 @@ msgstr "Neuer Dateiname" #: includes/include.note.popup.php:63 msgid "Add note" -msgstr "Notiz hinzufügen" +msgstr "Notiz hinzufügen" #: includes/include.note.popup.php:75 msgid "No category" @@ -4447,11 +4001,11 @@ msgstr "Notiz" #: includes/functions.stat.php:44 msgid "Info about article" -msgstr "Info über Artikel" +msgstr "Info über Artikel" #: includes/functions.stat.php:46 msgid "Info about directory" -msgstr "Info über Verzeichnis" +msgstr "Info über Verzeichnis" #: includes/functions.stat.php:285 msgid "Category is online" @@ -4479,7 +4033,7 @@ msgstr "Aktuelle Statistik" #: includes/include.stat_menu.php:45 msgid "Statistics Overview" -msgstr "Statistikübersicht" +msgstr "Statistikübersicht" #: includes/include.stat_menu.php:56 msgid "Archived Statistics" @@ -4497,56 +4051,37 @@ msgstr "Sprachunabhängig" msgid "Range" msgstr "Bereich" -#: includes/functions.file.php:206 +#: includes/functions.file.php:204 msgid "Please insert filename." msgstr "Bitte Dateinamen angeben." -#: includes/functions.file.php:218 -#, php-format -msgid "Could not open file %s" -msgstr "Konnte Datei %s nicht öffnen" - -#: includes/functions.file.php:223 -#, php-format -msgid "Could not write file %s" -msgstr "Konnte Datei %s nicht schreiben" - -#: includes/functions.file.php:234 includes/functions.file.php:338 +#: includes/functions.file.php:220 includes/functions.file.php:298 #, php-format msgid "%s is not writable" msgstr "%s ist nicht schreibbar" -#: includes/functions.file.php:255 -#, php-format -msgid "Can not open file%s " -msgstr "Kann Datei %s nicht öffnen " - -#: includes/functions.file.php:304 -msgid "Unable to change file access permission." -msgstr "Konnte die Dateisystem-Berechtigungen nicht ändern." - -#: includes/functions.file.php:308 +#: includes/functions.file.php:269 #, php-format msgid "Unable to create file %s" msgstr "Konnte Datei %s nicht erstellen" -#: includes/functions.file.php:334 +#: includes/functions.file.php:294 #, php-format msgid "Can not rename file %s" msgstr "Konnte Datei %s nicht umbenennen" -#: includes/functions.file.php:361 +#: includes/functions.file.php:320 msgid "Wrong filename." msgstr "Falscher Dateiname." #: includes/include.frontend.group_rights.php:47 msgid "Invalid plugin" -msgstr "Ungültiges Plugin" +msgstr "Ungültiges Plugin" #: includes/include.frontend.group_rights.php:96 #, php-format msgid "Permissions for plugin '%s'" -msgstr "Rechte für Plugin '%s'" +msgstr "Rechte für Plugin '%s'" #: includes/include.frontend.group_rights.php:101 msgid "(All)" @@ -4570,7 +4105,7 @@ msgstr "" #: includes/functions.lang.php:585 msgid "Could not delete language" -msgstr "Konnte Sprache nicht löschen" +msgstr "Konnte Sprache nicht löschen" #: includes/include.tpl_new.php:39 msgid "New template" @@ -4602,7 +4137,7 @@ msgstr "Hochladen" msgid "Path:" msgstr "Pfad:" -#: includes/functions.mod.php:200 +#: includes/functions.mod.php:182 msgid "Please do not use short open Tags. (Use
    %s" -msgstr "" -"Möchten Sie den folgenden Artikel wirklich löschen:

    %s" +msgstr "Möchten Sie den folgenden Artikel wirklich löschen:

    %s" #: includes/include.con_art_overview.php:683 #: includes/include.con_art_overview.php:686 @@ -4752,7 +4295,7 @@ msgstr "Letzte Änderung" #: includes/include.con_art_overview.php:745 msgid "Published date" -msgstr "Veröffentlichungsdatum" +msgstr "Veröffentlichungsdatum" #: includes/include.con_art_overview.php:764 msgid "Sort articles:" @@ -4762,6 +4305,11 @@ msgstr "Sortierung:" msgid "Items per page:" msgstr "Elemente/Seite:" +#: includes/include.con_art_overview.php:887 +#: includes/include.con_art_overview.php:888 +msgid "Create new article" +msgstr "Neuen Artikel erstellen" + #: includes/functions.upl.php:723 msgid "OpenOffice.org Presentation" msgstr "OpenOffice.org Präsentation" @@ -4976,17 +4524,17 @@ msgstr "Datei verwenden" #: includes/include.upl_files_overview.php:480 msgid "Delete Files" -msgstr "Dateien löschen" +msgstr "Dateien löschen" #: includes/include.upl_files_overview.php:480 msgid "Are you sure you want to delete the selected files?" msgstr "" -"Sind Sie sich sicher, dass Sie die gewählten Dateien wirklich lö" -"schen wollen?" +"Sind Sie sich sicher, dass Sie die gewählten Dateien wirklich löschen " +"wollen?" #: includes/include.upl_files_overview.php:481 msgid "Delete selected files" -msgstr "Markierte Dateien löschen" +msgstr "Markierte Dateien löschen" #: includes/include.upl_files_overview.php:497 msgid "Flip Selection" @@ -5002,7 +4550,7 @@ msgstr "Eigenschaften anzeigen" #: includes/include.upl_files_overview.php:753 msgid "Do you really want to delete the following file:
    " -msgstr "Möchten Sie wirklich die folgende Datei löschen:
    " +msgstr "Möchten Sie wirklich die folgende Datei löschen:
    " #: includes/include.pretplcfg_edit_form.php:101 #, php-format @@ -5034,10 +4582,14 @@ msgstr "-- Neues Template --" msgid "Default" msgstr "Standard" +#: includes/include.tpl_edit_form.php:161 +msgid "Layout description" +msgstr "Layoutbeschreibung" + #: includes/include.mod_translate.php:138 #, php-format msgid "Translate module '%s'" -msgstr "Modul übersetzen \"%s\"" +msgstr "Modul übersetzen \"%s\"" #: includes/include.mod_translate.php:147 msgid "Translated Name" @@ -5045,20 +4597,20 @@ msgstr "Übersetzter Name" #: includes/include.mod_translate.php:157 msgid "Original module string" -msgstr "Ursprünglicher Modulstring" +msgstr "Ursprünglicher Modulstring" #: includes/include.mod_translate.php:157 #, php-format msgid "Translation for %s" -msgstr "Übersetzung für %s" +msgstr "Übersetzung für %s" #: includes/include.mod_translate.php:165 msgid "" "Hint: Hit ALT+SHIFT+S to save the translated entry and advance to the next " "string." msgstr "" -"Hinweis: Drücken Sie ALT+SHIFT+S, um den aktuellen Eintrag zu speichern " -"und zur nächsten Zeichenkette zu springen." +"Hinweis: Drücken Sie ALT+SHIFT+S, um den aktuellen Eintrag zu speichern und " +"zur nächsten Zeichenkette zu springen." #: includes/include.mod_translate.php:166 msgid "String list" @@ -5127,12 +4679,16 @@ msgstr "Ignorieren" #: includes/include.con_left_top.php:138 msgid "Date published" -msgstr "Veröffentlichungsdatum" +msgstr "Veröffentlichungsdatum" #: includes/include.con_left_top.php:141 msgid "Article Search" msgstr "Artikelsuche" +#: includes/include.con_left_top.php:237 +msgid "Search" +msgstr "Suche" + #: includes/include.con_left_top.php:250 msgid "Title/Content" msgstr "Titel/Inhalt" @@ -5183,7 +4739,7 @@ msgstr "Online / Offline" #: includes/include.con_left_top.php:410 includes/include.con_left_top.php:411 msgid "Lock / Unlock" -msgstr "Schützen / Freigeben" +msgstr "Schützen / Freigeben" #: includes/include.con_left_top.php:428 msgid "close all" @@ -5191,7 +4747,7 @@ msgstr "alle schließen" #: includes/include.con_left_top.php:429 msgid "open all" -msgstr "alle öffnen" +msgstr "alle öffnen" #: includes/include.con_left_top.php:439 msgid "Synchronize from" @@ -5208,13 +4764,12 @@ msgstr "Unterkategorien mit kopieren" #: includes/include.grouprights_menu.php:178 #, php-format msgid "Do you really want to delete the group %s?" -msgstr "Möchten Sie die Gruppe %s wirklich löschen?" +msgstr "Möchten Sie die Gruppe %s wirklich löschen?" #: includes/include.grouprights_menu.php:197 #, php-format msgid "Do you really want to delete the following group:

    %s
    " -msgstr "" -"Möchten Sie die folgende Gruppe wirklich löschen:

    %s" +msgstr "Möchten Sie die folgende Gruppe wirklich löschen:

    %s" #: includes/functions.lay.php:66 msgid "-- Unnamed Layout --" @@ -5222,14 +4777,12 @@ msgstr "-- Unbenanntes Layout --" #: includes/include.client_menu.php:80 msgid "Delete client" -msgstr "Mandant löschen" +msgstr "Mandant löschen" #: includes/include.client_menu.php:81 #, php-format msgid "Do you really want to delete the following client:

    %s
    " -msgstr "" -"Möchten Sie den folgenden Mandant wirklich löschen:

    %s" +msgstr "Möchten Sie den folgenden Mandant wirklich löschen:

    %s" #: includes/include.grouprights_create.php:57 msgid "New Group" @@ -5261,11 +4814,11 @@ msgstr "Code Output" #: includes/include.mod_history.php:152 msgid "No module history available" -msgstr "Keine Modul-Historie verfügbar" +msgstr "Keine Modul-Historie verfügbar" #: includes/include.mod_overview.php:198 msgid "Module in use, cannot delete" -msgstr "Modul wird benutzt, löschen nicht möglich" +msgstr "Modul wird benutzt, löschen nicht möglich" #: includes/include.mod_overview.php:200 msgid "Module in filesystem, cannot delete" @@ -5274,8 +4827,7 @@ msgstr "Modul liegt im Dateisystem und kann nicht gelöscht werden" #: includes/include.mod_overview.php:205 #, php-format msgid "Do you really want to delete the following module:

    %s
    " -msgstr "" -"Möchten Sie das folgende Modul wirklich löschen:

    %s" +msgstr "Möchten Sie das folgende Modul wirklich löschen:

    %s" #: includes/include.mod_overview.php:271 #, php-format @@ -5287,15 +4839,15 @@ msgstr "Das Modul '%s' wird bei folgenden Templates benutzt" #: external/frontend/front_content.php:348 #: external/frontend/front_content.php:396 msgid "No start article for this category" -msgstr "Kein Startartikel für diese Kategorie" +msgstr "Kein Startartikel für diese Kategorie" #: main.loginform.php:70 msgid "" "Contenido is in maintenance mode. Only sysadmins are allowed to login. " "Please try again later." msgstr "" -"Contenido befindet sich im Wartungsmodus. Nur Systemadministratoren kö" -"nnen sich einloggen. Bitte versuchen Sie es zu einem späteren Zeitpunkt " +"Contenido befindet sich im Wartungsmodus. Nur Systemadministratoren können " +"sich einloggen. Bitte versuchen Sie es zu einem späteren Zeitpunkt " "erneut." #: main.loginform.php:158 @@ -5312,7 +4864,7 @@ msgstr "Passwort" #: backend_search.php:328 msgid "Thank you for saving this search from extinction !" -msgstr "Vielen Dank für die Speicherung dieser Suche!" +msgstr "Vielen Dank für die Speicherung dieser Suche!" #: backend_search.php:490 msgid "Search results" @@ -5332,7 +4884,7 @@ msgstr "Erinnerung" #: backend_search.php:679 msgid "Do you really want to delete following article" -msgstr "Möchten Sie wirklich die folgende Datei löschen:
    " +msgstr "Möchten Sie wirklich die folgende Datei löschen:
    " #: backend_search.php:765 msgid "Search Name" @@ -5358,1220 +4910,7 @@ msgid "" msgstr "" "Hallo %s,\n" "\n" -"Du hast eine Wiedervorlage erhalten für den Mandanten '%s' bei\n" +"Du hast eine Wiedervorlage erhalten für den Mandanten '%s' bei\n" "%s:\n" "\n" "%s" - -#~ msgid "No" -#~ msgstr "Nein" - -#~ msgid "Yes" -#~ msgstr "Ja" - -#~ msgid "Generate XHTML" -#~ msgstr "XHTML erzeugen" - -#~ msgid "Newsletter: %s" -#~ msgstr "Newsletter: %s" - -#~ msgid "" -#~ "The html newsletter article has been deleted (idart: %s), the html " -#~ "message is lost" -#~ msgstr "" -#~ "Der HTML-Newsletter-Artikel wurde gelöscht (idart: %s), die HTML-" -#~ "Nachricht kann nicht wiederhergestellt werden" - -#~ msgid "" -#~ "The html newsletter template article has been deleted, it has been " -#~ "restored using the html message article of this newsletter" -#~ msgstr "" -#~ "Der HTML-Newsletter-Template-Artikel wurde gelöscht; er wurde aus " -#~ "dem aktuellen HTML-Newsletter-Artikel wiederhergestellt" - -#~ msgid "%s (Template restored)" -#~ msgstr "%s (Template wiederhergestellt)" - -#~ msgid "Edit newsletter message (%s)" -#~ msgstr "Newsletter-Nachricht bearbeiten (%s)" - -#~ msgid "Tag information" -#~ msgstr "Tag-Information" - -#~ msgid "Special message tags (will be replaced when sending)" -#~ msgstr "Spezielle Tags (werden beim Senden ersetzt)" - -#~ msgid "Name of the recipient" -#~ msgstr "Name des Empfägers" - -#~ msgid "Date, when the mail has been sent" -#~ msgstr "Datum des E-Mail Versands" - -#~ msgid "Time, when the mail has been sent" -#~ msgstr "Zeit des e-Mail Versand" - -#~ msgid "Number of recipients" -#~ msgstr "Anzahl der Empfänger" - -#~ msgid "Link to unsubscribe" -#~ msgstr "Link zum Abbestellen des Newsletters" - -#~ msgid "Link to pause the subscription" -#~ msgstr "Link zum Pausieren des Newsletterempfangs" - -#~ msgid "Link to resume the subscription" -#~ msgstr "Link, um den Newsletterempfang wieder aufzunehmen" - -#~ msgid "" -#~ "Special message tags (will be replaced when sending, {..} = optional)" -#~ msgstr "" -#~ "Spezielle Nachrichten-Tags (werden beim Senden ersetzt, {...} = optional)" - -#~ msgid "Link text" -#~ msgstr "Link-Text" - -#~ msgid "Additional message tags from recipients plugins:" -#~ msgstr "Zusätzliche Tags aus Empfänger-Plugins:" - -#~ msgid "-- none --" -#~ msgstr "-- Kein(e) --" - -#~ msgid "HTML Template" -#~ msgstr "HTML-Template" - -#~ msgid "" -#~ "Note, that changing the template discards the current html message content" -#~ msgstr "" -#~ "Hinweis: Eine Änderung des Templates verwirft die aktuelle HTML-" -#~ "Nachricht" - -#~ msgid "HTML Message" -#~ msgstr "HTML-Nachricht" - -#~ msgid "" -#~ "Newsletter type has been set to HTML/text, please remember to select an " -#~ "html template" -#~ msgstr "" -#~ "Dieser Newsletter ist ein HTML- und Text-Newsletter; bitte denken Sie " -#~ "daran, ein HTML-Template auszuwählen" - -#~ msgid "Please choose a template first" -#~ msgstr "Bitte zuerst HTML-Template wählen" - -#~ msgid "Text Message" -#~ msgstr "Text-Nachricht" - -#~ msgid "HTML newsletter template changed" -#~ msgstr "Änderung des HTML-Newsletter-Templates" - -#~ msgid "" -#~ "HTML template has been changed. Do you like to save now to apply changes?" -#~ "

    Note, that existing HTML newsletter content will get lost!" -#~ "" -#~ msgstr "" -#~ "Das HTML-Template wurde geändert. Möchten Sie jetzt speichern, " -#~ "um die Änderungen anzuwenden?

    Bitte beachten Sie, dass " -#~ "der ggf. vorhandene Inhalt des HTML-Newsletters verloren geht!" - -#~ msgid "-- new newsletter --" -#~ msgstr "-- Neuer Newsletter --" - -#~ msgid "Newsletter dispatch job has been added for this newsletter" -#~ msgstr "Versand-Job für diesen Newsletter wurde erzeugt" - -#~ msgid "" -#~ "Newsletter dispatch job has been not been added! Please check newsletter " -#~ "details" -#~ msgstr "" -#~ "Versand-Job für diesen Newsletter wurde nicht erzeugt! Bitte die " -#~ "Angaben überprüfen" - -#~ msgid "Test newsletter has been sent to:" -#~ msgstr "Test-Newsletter wurde an folgende Empfänger gesendet:" - -#~ msgid "Test newsletter has not been sent (partly or completely):" -#~ msgstr "Der Newsletter wurde nicht gesendet (im Ganzen oder in Teilen):" - -#~ msgid "Successful:" -#~ msgstr "Erfolgreich:" - -#~ msgid "Error messages:" -#~ msgstr "Fehlermeldungen:" - -#~ msgid "Could not set new newsletter name: name already exists" -#~ msgstr "" -#~ "Name konnte nicht geändert werden: Ein Newsletter gleichen Namens " -#~ "existiert bereits." - -#~ msgid "" -#~ "'Send to recipients in selected groups' has been selected, but no group " -#~ "has been specified. Selection has been set to 'Send to all recipients'" -#~ msgstr "" -#~ "'Newsletter an die Mitglieder der ausgewählten Gruppe(n) senden' " -#~ "wurde aktiviert, aber es wurde keine Gruppe ausgewählt. Die Option " -#~ "wurde auf 'An alle Empfänger senden' zurückgesetzt" - -#~ msgid "Text only" -#~ msgstr "Nur Text" - -#~ msgid "HTML and text" -#~ msgstr "HTML und Text" - -#~ msgid "From (E-Mail)" -#~ msgstr "Absender (E-Mail)" - -#~ msgid "From (Name)" -#~ msgstr "Absender (Name)" - -#~ msgid "optional" -#~ msgstr "Optional" - -#~ msgid "Note: Hold to select multiple items." -#~ msgstr "" -#~ "Hinweis: Drücken und halten Sie die Taste , um mehrere " -#~ "Einträge zu selektieren." - -#~ msgid "Send newsletter to all recipients" -#~ msgstr "Newsletter an alle Empfänger senden" - -#~ msgid "Send newsletter to the members of the default group" -#~ msgstr "Newsletter an Mitglieder der Standardgruppe senden" - -#~ msgid "Send newsletter to the members of the selected group(s):" -#~ msgstr "" -#~ "Newsletter an die Mitglieder der ausgewählten Gruppe(n) senden:" - -#~ msgid "Option has to be enabled as client setting - see techref for details" -#~ msgstr "" -#~ "Option muss über eine Systemeinstellung aktiviert werden - siehe " -#~ "techref für details" - -#~ msgid "Note: Set to 0 to send chunks manually." -#~ msgstr "Hinweis: 0 auswählen um Blöcke manuell zu versenden" - -#~ msgid "Welcome-Newsletter" -#~ msgstr "Willkommen-Newsletter" - -#~ msgid "Use cronjob" -#~ msgstr "Cronjob verwenden" - -#~ msgid "Send in blocks:" -#~ msgstr "In Blöcken senden:" - -#~ msgid "Recipients per block:" -#~ msgstr "Empfänger pro Block:" - -#~ msgid "Delay between blocks:" -#~ msgstr "Pause zwischen Blöcken:" - -#~ msgid "sec." -#~ msgstr "Sek." - -#~ msgid "Save option settings as default" -#~ msgstr "Einstellungen als Standard speichern" - -#~ msgid "" -#~ "Do you really want to delete the following newsletter dispatch job:
    " -#~ msgstr "" -#~ "Möchten Sie wirklich den folgenden Newsletter Versand-Job lö" -#~ "schen:
    " - -#~ msgid "Do you really want to run the following job:
    " -#~ msgstr "Möchten Sie wirklich den folgenden Job ausführen:
    " - -#~ msgid "Confirmed" -#~ msgstr "Bestätigt" - -#~ msgid "Deactivated" -#~ msgstr "Deaktiviert" - -#~ msgid "Member list options" -#~ msgstr "Anzeigeoptionen (Mitglieder)" - -#~ msgid "No recipients are added to this group yet" -#~ msgstr "Die Gruppe enthält z.Z. keine Empfänger" - -#~ msgid "No recipients found" -#~ msgstr "Keine Empfänger gefunden" - -#~ msgid "Member navigation" -#~ msgstr "Navigation (Mitglieder)" - -#~ msgid "Recipients in group" -#~ msgstr "Empfänger in der Gruppe" - -#~ msgid "Outsider list options" -#~ msgstr "Anzeigeoptionen (Nicht-Mitglieder)" - -#~ msgid "Outsider navigation" -#~ msgstr "Navigation (Nicht-Mitglieder)" - -#~ msgid "Add recipients" -#~ msgstr "Empfänger hinzufügen" - -#~ msgid "Note: Hold <Ctrl> to
    select multiple items." -#~ msgstr "" -#~ "Hinweis: Halten Sie <Ctrl> gedrückt, um
    mehrere Elemente " -#~ "auszuwählen." - -#~ msgid "Can't clear error log : Access is denied!" -#~ msgstr "Fehlerlog konnte nicht geleert werden: Zugriff verweigert!" - -#~ msgid "install error log successfully cleared" -#~ msgstr "Installation-Errorlog erfolgreich geleert" - -#~ msgid "Do you really want to delete the following newsletter:
    " -#~ msgstr "" -#~ "Sind Sie sicher, dass Sie den folgenden Newsletter löschen mö" -#~ "chten:
    " - -#~ msgid "Send test newsletter" -#~ msgstr "Test-Newsletter versenden" - -#~ msgid "" -#~ "Send test newsletter (disabled, check newsletter sender e-mail address " -#~ "and handler article selection)" -#~ msgstr "" -#~ "Test-Newsletter versenden (deaktiviert, Absender-Adresse und Handler-" -#~ "Artikel überprüfen)" - -#~ msgid "" -#~ "Add newsletter dispatch job (disabled, check newsletter sender e-mail " -#~ "address and handler article selection)" -#~ msgstr "" -#~ "Newsletter-Versand-Job erzeugen (deaktiviert, Absender-Adresse und " -#~ "Handler-Artikel überprüfen)" - -#~ msgid "Recipient group: %s" -#~ msgstr "Empfänger-Gruppe: %s" - -#~ msgid "Do you really want to send the newsletter to:
    %s" -#~ msgstr "" -#~ "Möchten Sie wirklich den Newsletter an den angegebenen Empfä" -#~ "nger versenden:
    %s" - -#~ msgid "Report:" -#~ msgstr "Bericht:" - -#~ msgid "Sending newsletter ... (chunk %s of %s, recipients: %s, sent: %s)" -#~ msgstr "" -#~ "Sende Newsletter ... (Block %s von %s, Empfänger: %s, gesendet: %s)" - -#~ msgid "Stop sending" -#~ msgstr "Senden abbrechen" - -#~ msgid "Send next chunk" -#~ msgstr "Nächster Block senden" - -#~ msgid "The newsletter has been sent to %s recipients" -#~ msgstr "Der Newsletter wurde an %s Empfänger gesendet" - -#~ msgid "-All-" -#~ msgstr "-Alle-" - -#~ msgid "Sent" -#~ msgstr "Gesendet" - -#~ msgid "Waiting for sending" -#~ msgstr "Warte auf Versand" - -#~ msgid "Sending" -#~ msgstr "Sende" - -#~ msgid "Successful" -#~ msgstr "Erfolgreich" - -#~ msgid "Error: %s" -#~ msgstr "Fehler: %s" - -#~ msgid "Newsletter Dispatch Job" -#~ msgstr "Newsletter Versand-Job" - -#~ msgid "Pending" -#~ msgstr "Bereit" - -#~ msgid "Sending (started: %s)" -#~ msgstr "Sende (gestartet: %s)" - -#~ msgid "Finished (started: %s, finished: %s)" -#~ msgstr "Abgeschlossen (gestartet: %s, abgeschlossen: %s)" - -#~ msgid "Planned: %s, Send: %s" -#~ msgstr "Geplant: %s, Gesendet: %s" - -#~ msgid "From" -#~ msgstr "Absender" - -#~ msgid "Send newsletter to single recipient:" -#~ msgstr "Newsletter an einzelnen Empfänger senden:" - -#~ msgid "Use cronjob: Enabled" -#~ msgstr "Cronjob: Aktiviert" - -#~ msgid "Use cronjob: Not enabled" -#~ msgstr "Cronjob: Nicht aktiviert" - -#~ msgid "Dispatch: Enabled (block size: %s, delay: %s sec.)" -#~ msgstr "" -#~ "In Blöcken versenden: Aktiviert (Blockgröße: %s, Pause: " -#~ "%s Sek.)" - -#~ msgid "Dispatch: Disabled" -#~ msgstr "Block-Sendung: Deaktiviert" - -#~ msgid "" -#~ "%d recipients, with no or incompatible key has been updated. Deactivate " -#~ "update function." -#~ msgstr "" -#~ "%d Empfänger ohne bzw. mit inkompatiblen Schlüssel wurden " -#~ "aktualisiert. Deaktivieren Sie die Update-Funktion." - -#~ msgid "Do you really want to delete the following recipient:
    " -#~ msgstr "" -#~ "Möchten Sie wirklich den folgenden Empfänger löschen:
    " - -#~ msgid "Mail" -#~ msgstr "Mail" - -#~ msgid "Confirmed Date" -#~ msgstr "Bestätigungsdatum" - -#~ msgid "Message type" -#~ msgstr "Nachrichtentyp" - -#~ msgid "Group" -#~ msgstr "Gruppe" - -#~ msgid "Given column header '%s' unknown, column ignored" -#~ msgstr "Gegebener Spaltenname '%s' unbekannt, Spalte wird ignoriert" - -#~ msgid "Mandatory column '%s' wasn't found, import stopped" -#~ msgstr "Benötigte Spalte '%s' nicht gefunden, Import gestoppt" - -#~ msgid "Item with empty mail address found, item ignored (name: %s, row: %s)" -#~ msgstr "" -#~ "Eintrag mit fehlender Emailadresse gefunden, Eintrag wird ignoriert " -#~ "(Name: %s, Reihe: %s)" - -#~ msgid "Mail address '%s' is invalid, item ignored (row: %s)" -#~ msgstr "Emailadresse '%s' ungültig, Eintrag ignoriert (Reihe: %s)" - -#~ msgid "" -#~ "Recipient with mail address '%s' already exists, item skipped (row: %s)" -#~ msgstr "" -#~ "Empfänger mit Emailadresse '%s' bereits vorhanden, Eintrag ü" -#~ "bersprungen (Reihe: %s)" - -#~ msgid "yes" -#~ msgstr "ja" - -#~ msgid "" -#~ "%d recipients added, %d recipients skipped (email already exists) and %d " -#~ "invalid recipients/e-mail adresses ignored. Invalid recipients are shown " -#~ "(if any)." -#~ msgstr "" -#~ "%d Empfänger ergänzt, %d Empfänger übergangen " -#~ "(Empfänger-E-Mail-Adresse wird bereits verwendet) und %d ungü" -#~ "tige Emfänger/E-Mail-Adressen ignoriert. Ggf. ungültige " -#~ "Empfänger werden angezeigt." - -#~ msgid "Tab" -#~ msgstr "Tab" - -#~ msgid "Semicolon" -#~ msgstr "Semikolon" - -#~ msgid "Delimiter" -#~ msgstr "Trennzeichen" - -#~ msgid "Import information" -#~ msgstr "Import Hinweise" - -#~ msgid "Specify colum types:" -#~ msgstr "Spaltentypen definieren:" - -#~ msgid "" -#~ "
    The first line must contain the column names; this specifies the " -#~ "column order.
    <column name>[delimiter]<column name>..." -#~ msgstr "" -#~ "
    Die erste Zeile muss die Spaltennamen enthalten; dies definiert die " -#~ "Spaltenreihenfolge.
    <Spaltenname>[Separator]<" -#~ "Spaltenname>..." - -#~ msgid "Data structure:" -#~ msgstr "Datenstruktur:" - -#~ msgid "" -#~ "The recipients have to be entered using the following format:
    <" -#~ "data>[Delimiter]<data>... - each recipient in a new line." -#~ msgstr "" -#~ "Die Empfänger müssen nach dem folgenden Format eingegeben " -#~ "werden:
    <data>[Separator]<data>... - Jeder Empfä" -#~ "nger in einer neuen Zeile." - -#~ msgid "Example:" -#~ msgstr "Beispiel:" - -#~ msgid "
    name;mail;confirmed
    Smith;jon.smith@example.org;1" -#~ msgstr "" -#~ "

    name;mail;bestätigt
    Smith;jon.smith@example.org;1" - -#~ msgid "The following column names will be recognized:" -#~ msgstr "Die folgenden Spaltennamen können verwendet werden:" - -#~ msgid "Contenido: " -#~ msgstr "ConLite: " - -#~ msgid "View" -#~ msgstr "Ansehen" - -#~ msgid "Details" -#~ msgstr "Details" - -#~ msgid "Edit Message" -#~ msgstr "Nachricht bearbeiten" - -#~ msgid "-- new recipient --" -#~ msgstr "-- Neuer Empfänger --" - -#~ msgid "" -#~ "%1backslashdollard recipients, which hasn't been confirmed since more " -#~ "than %2backslashdollard days has been removed." -#~ msgstr "" -#~ "%1backslashdollard Empfänger, die ihre E-Mail-Adresse seit mehr als " -#~ "%2backslashdollard Tagen nicht bestätigt haben, wurden gelöscht." - -#~ msgid "" -#~ "There are no recipients, which hasn't been confirmed since more than " -#~ "%2backslashdollard days has been removed." -#~ msgstr "" -#~ "Es gibt keine Empfänger, die ihre E-Mail-Adresse seit mehr als " -#~ "%2backslashdollard Tagen nicht bestätigt haben." - -#~ msgid "Please specify a valid e-mail address" -#~ msgstr "Bitte geben Sie eine gültige E-Mail-Adresse an" - -#~ msgid "" -#~ "Could not set new e-mail adress: Other recipient with same e-mail address " -#~ "already exists" -#~ msgstr "" -#~ "E-Mail-Adresse konnte nicht geändert werden: Ein Empfänger mit " -#~ "der gleichen E-Mail-Adresse existiert bereits" - -#~ msgid "Recipient is not member of any group" -#~ msgstr "Empfänger ist kein Mitglied einer Gruppe" - -#~ msgid "Associated Groups" -#~ msgstr "Mitglied von" - -#~ msgid "Dispatch" -#~ msgstr "Versand" - -#~ msgid "Recipient groups" -#~ msgstr "Empfänger-Gruppen" - -#~ msgid "Please select" -#~ msgstr "Bitte wählen" - -#~ msgid "My mail address" -#~ msgstr "Meine E-Mail-Adresse" - -#~ msgid "Enable HTML Newsletter" -#~ msgstr "HTML-Newsletter aktivieren" - -#~ msgid "HTML Template Category:" -#~ msgstr "Kategorie (HTML-Template):" - -#~ msgid "HTML Newsletter Category:" -#~ msgstr "Kategorie (HTML-Newsletter):" - -#~ msgid "Send test destination:" -#~ msgstr "Test-Empfänger:" - -#~ msgid "" -#~ "Do you really want to remove recipients, that have not been confirmed " -#~ "since %s days and over?" -#~ msgstr "" -#~ "Wollen Sie wirklich alle Empfänger, die ihre E-Mail-Adresse seit " -#~ "mehr als %s Tagen nicht bestätigt haben, löschen?" - -#~ msgid "Purge timeframe" -#~ msgstr "Zeitfenster" - -#~ msgid "days" -#~ msgstr "Tage" - -#~ msgid "-- All groups --" -#~ msgstr "-- Alle Gruppen --" - -#~ msgid "" -#~ "Do you really want to delete the following newsletter recipient group:
    " -#~ msgstr "" -#~ "Sind Sie sicher, dass Sie die folgende Gruppe löschen möchten:" -#~ "
    " - -#~ msgid "" -#~ "There was a problem getting the newsletter article using http. Error: %s " -#~ "(%s)" -#~ msgstr "" -#~ "Der HTML-Newsletter-Artikel konnte nicht eingelesen werden. Fehler: %s " -#~ "(%s)" - -#~ msgid "Newsletter to %s could not be sent: No html message available" -#~ msgstr "" -#~ "Newsletter an %s konnte nicht versendet werden: Keine HTML-Nachricht " -#~ "verügbar" - -#~ msgid "Newsletter to %s could not be sent: No valid e-mail address" -#~ msgstr "" -#~ "Newsletter an %s konnte nicht versendet werden: Keine gütige E-Mail-" -#~ "Adresse verfügbar" - -#~ msgid "Newsletter to %s could not be sent" -#~ msgstr "Newsletter an %s konnte nicht versendet werden" - -#~ msgid "Newsletter could not be sent: No html message available" -#~ msgstr "" -#~ "Newsletter konnte nicht versendet werden: Keine HTML-Nachricht verfü" -#~ "gbar" - -#~ msgid "" -#~ "Newsletter to %s could not be sent: Recipient has an incompatible or " -#~ "empty key" -#~ msgstr "" -#~ "Newsletter an %s konnte nicht versendet werden: Empfänger hat einen " -#~ "inkompatiblen oder leeren Schlüssel." - -#~ msgid "" -#~ "Newsletter to %s could not be sent: No valid e-mail address specified" -#~ msgstr "" -#~ "Newsletter an %s konnte nicht versendet werden: Keine gütige E-Mail " -#~ "Adresse angegeben" - -#~ msgid "No recipient with specified recipient/group id %s/%s found" -#~ msgstr "" -#~ "Keine Empfänger mit der angegebenen Empfänger-/Gruppen-ID %s/%s " -#~ "gefunden" - -#~ msgid "Provide address" -#~ msgstr "Adresse angeben" - -#~ msgid "Mailer not supported" -#~ msgstr "Mailer wird nicht unterstützt" - -#~ msgid "Execute" -#~ msgstr "Ausführen" - -#~ msgid "Instantiate" -#~ msgstr "Keine mail()-Instanz erzeugt" - -#~ msgid "From failed" -#~ msgstr "Fehler bei SMTP-Versand" - -#~ msgid "Recipients failed" -#~ msgstr "Fehlerhafte Empfänger" - -#~ msgid "Data not accepted" -#~ msgstr "Daten nicht akzeptiert" - -#~ msgid "Authenticate" -#~ msgstr "Authentifizierung" - -#~ msgid "Connect host" -#~ msgstr "Hostverbindung" - -#~ msgid "File access" -#~ msgstr "Dateizugriff" - -#~ msgid "File open" -#~ msgstr "Öffnen der Datei" - -#~ msgid "Endzeitpunkt wählen" -#~ msgstr "Endzeitpunkt wählen" - -#~ msgid "Startzeitpunkt wählen" -#~ msgstr "Startzeitpunkt wählen" - -#, fuzzy -#~ msgid "Please enter a category name" -#~ msgstr "Bitte geben Sie einen Kategorienamen ein." - -#~ msgid "Set category offline" -#~ msgstr "Kategorie offline setzen" - -#~ msgid "Set category online" -#~ msgstr "Kategorie online setzen" - -#~ msgid "One or more subcategories exist, unable to delete" -#~ msgstr "" -#~ "Mindestens eine Unterkategorie existiert, löschen nicht möglich" - -#~ msgid "Are you sure to delete the following category" -#~ msgstr "" -#~ "Sind Sie sicher, dass Sie die folgende Kategorie Löschen wollen" - -#~ msgid "Store content allocations" -#~ msgstr "Content Allocations speichern" - -#, fuzzy -#~ msgid "Content Allocation" -#~ msgstr "Content Allocations speichern" - -#~ msgid "There is no Content Allocation tree." -#~ msgstr "Es existiert kein Content Allocation Baum." - -#~ msgid "Remove all" -#~ msgstr "Alle entfernen" - -#~ msgid "Remove" -#~ msgstr "Entfernen" - -#~ msgid "New Category %s successfully stored!" -#~ msgstr "Neue Kategorie %s erfolgreich erstellt!" - -#~ msgid "Category %s successfully renamed!" -#~ msgstr "Kategorie %s erfolgreich umbenannt!" - -#~ msgid "Please enter a category name." -#~ msgstr "Bitte geben Sie einen Kategorienamen ein." - -#, fuzzy -#~ msgid "Access category" -#~ msgstr "Neue Kategorie" - -#~ msgid "Interns" -#~ msgstr "Interne Links" - -#~ msgid "Externs" -#~ msgstr "Externe Links" - -#~ msgid "Intern/extern Links" -#~ msgstr "Interne & externe Links" - -#~ msgid "Link analysis from " -#~ msgstr "Link Analyse von" - -#~ msgid "%Y-%m-%d" -#~ msgstr "%d.%m.%Y" - -#~ msgid "No errors were found." -#~ msgstr "Keine Einträge im Errorlog gefunden" - -#, fuzzy -#~ msgid "Linkerror" -#~ msgstr "Link" - -#, fuzzy -#~ msgid "Links to articles" -#~ msgstr "Link auf eine beliebige Datei" - -#, fuzzy -#~ msgid "Links to categories" -#~ msgstr "Alle Kategorien öffnen" - -#, fuzzy -#~ msgid "Links to documents and images" -#~ msgstr "Link zu einem Bild" - -#, fuzzy -#~ msgid "Wrong links" -#~ msgstr "Zeichenkettenliste" - -#, fuzzy -#~ msgid "Offline: article or category is offline." -#~ msgstr "Kategorie offline setzen" - -#~ msgid "No errors for this type." -#~ msgstr "Keine Einträge im Errorlog gefunden" - -#, fuzzy -#~ msgid "Entry" -#~ msgstr "Einträge" - -#, fuzzy -#~ msgid "Publish article" -#~ msgstr "Veröffentlichungsdatum" - -#, fuzzy -#~ msgid "Lock article" -#~ msgstr "Meine Artikel" - -#, fuzzy -#~ msgid "Move back to last editor" -#~ msgstr "Speichern und Editor schließen" - -#, fuzzy -#~ msgid "Reject article" -#~ msgstr "Artikel löschen" - -#, fuzzy -#~ msgid "Edit article content" -#~ msgstr "Artikel bearbeiten" - -#, fuzzy -#~ msgid "Revise article" -#~ msgstr "Artikel speichern" - -#, fuzzy -#~ msgid "Article doesn't exist" -#~ msgstr "Artikeleigenschaften" - -#, fuzzy -#~ msgid "Workflow notification" -#~ msgstr "E-Mail Benachrichtigung" - -#, fuzzy -#~ msgid "No item loaded" -#~ msgstr "nicht geladen" - -#, fuzzy -#~ msgid "Delete workflow" -#~ msgstr "Datei löschen" - -#, fuzzy -#~ msgid "Select workflow task" -#~ msgstr "Workflow Aufgaben anzeigen" - -#, fuzzy -#~ msgid "Show workflow" -#~ msgstr "Workflow Aufgaben anzeigen" - -#, fuzzy -#~ msgid "Create workflow" -#~ msgstr "Gruppe erzeugen" - -#, fuzzy -#~ msgid "Edit workflow" -#~ msgstr "Datei bearbeiten" - -#, fuzzy -#~ msgid "Process workflow step" -#~ msgstr "Workflow Aufgaben anzeigen" - -#~ msgid "Edit workflow step" -#~ msgstr "Workflow Schritt bearbeiten" - -#, fuzzy -#~ msgid "Move workflowstep down" -#~ msgstr "Eine Kategorie nach unten verschieben" - -#, fuzzy -#~ msgid "Save Workflowstep" -#~ msgstr "Notiz speichern" - -#, fuzzy -#~ msgid "Create workflowstep" -#~ msgstr "Gruppe erzeugen" - -#, fuzzy -#~ msgid "Delete workflowstep" -#~ msgstr "Datei löschen" - -#, fuzzy -#~ msgid "Create Workflowstepuser" -#~ msgstr "Frontendbenutzer erstellen" - -#~ msgid "Delete Workflowstepuser" -#~ msgstr "Frontendbenutzer löschen" - -#, fuzzy -#~ msgid "Associate workflow with category" -#~ msgstr "Artikel mit Kategorie" - -#~ msgid "Workflow Step" -#~ msgstr "Workflow Schritt" - -#~ msgid "Workflow Action" -#~ msgstr "Workflow Aktion" - -#~ msgid "Workflow Editor" -#~ msgstr "Workflow Editor" - -#, fuzzy -#~ msgid "Last status" -#~ msgstr "Letzte Seite" - -#, fuzzy -#~ msgid "Back to last editor" -#~ msgstr "Speichern und im Editor bleiben" - -#, fuzzy -#~ msgid "Rejected" -#~ msgstr "Weiterleitung" - -#, fuzzy -#~ msgid "Revised" -#~ msgstr "Entfernen" - -#, fuzzy -#~ msgid "Last" -#~ msgstr "Letzte Seite" - -#, fuzzy -#~ msgid "New Workflow" -#~ msgstr "Neues Fenster" - -#, fuzzy -#~ msgid "Create new workflow" -#~ msgstr "Neuen Baum anlegen" - -#, fuzzy -#~ msgid "Workflow name" -#~ msgstr "Gruppenname" - -#~ msgid "Do you really want to delete the following workflow:

    %s
    " -#~ msgstr "" -#~ "Möchten Sie die folgende Datei wirklich löschen:

    %s" - -#~ msgid "Add User" -#~ msgstr "Benutzer hinzufügen" - -#, fuzzy -#~ msgid "New Workflow Step" -#~ msgstr "Workflow Aufgaben anzeigen" - -#, fuzzy -#~ msgid "Seconds" -#~ msgstr "Semikolon" - -#~ msgid "Minutes" -#~ msgstr "Minuten" - -#~ msgid "Hours" -#~ msgstr "Stunden" - -#, fuzzy -#~ msgid "Days" -#~ msgstr "Tag(e)" - -#~ msgid "Weeks" -#~ msgstr "Wochen" - -#~ msgid "Months" -#~ msgstr "Monate" - -#, fuzzy -#~ msgid "Years" -#~ msgstr "Ja" - -#, fuzzy -#~ msgid "Move step up" -#~ msgstr "Eine Kategorie nach oben verschieben" - -#, fuzzy -#~ msgid "Move step down" -#~ msgstr "Eine Kategorie nach unten verschieben" - -#, fuzzy -#~ msgid "Delete step" -#~ msgstr "Benutzer löschen" - -#, fuzzy -#~ msgid "Create new step" -#~ msgstr "Neuen Baum anlegen" - -#, fuzzy -#~ msgid "Step name" -#~ msgstr "Host-Name" - -#, fuzzy -#~ msgid "Step description" -#~ msgstr "Layoutbeschreibung" - -#, fuzzy -#~ msgid "Assigned users" -#~ msgstr "Zugewiesen zu" - -#, fuzzy -#~ msgid "Move user up" -#~ msgstr "Eine Kategorie nach oben verschieben" - -#, fuzzy -#~ msgid "Move user down" -#~ msgstr "Eine Kategorie nach unten verschieben" - -#~ msgid "Notify this user via E-Mail" -#~ msgstr "Diesen Benutzer per Email erinnern" - -#~ msgid "Show users" -#~ msgstr "Aktueller Benutzer" - -#, fuzzy -#~ msgid "Workflow tasks" -#~ msgstr "Workflow Aufgaben anzeigen" - -#~ msgid "No (more) recipients found" -#~ msgstr "Keine (weiteren) Empfänger gefunden" - -#~ msgid "Sent successfully" -#~ msgstr "Erfolgreich versendet" - -#~ msgid "" -#~ "Newsletter to %s could not be sent (recipient has an incompatible or " -#~ "empty key)." -#~ msgstr "" -#~ "Newsletter an %s konnte nicht versendet werden: Empfänger hat einen " -#~ "inkompatiblen oder leeren Schlüssel" - -#~ msgid "Target" -#~ msgstr "Ziel" - -#~ msgid "Open in same window" -#~ msgstr "Im gleichen Fenster öffnen" - -#~ msgid "Colorpicker" -#~ msgstr "Farbauswahl" - -#~ msgid "Insert Link" -#~ msgstr "Link einfügen" - -#~ msgid "PDF" -#~ msgstr "PDF" - -#~ msgid "Media" -#~ msgstr "Medien" - -#~ msgid "Open in parent frame" -#~ msgstr "Im parent-Frame öffnen" - -#~ msgid "Open in top frame" -#~ msgstr "Im top-Frame öffnen" - -#~ msgid "Edit URL names" -#~ msgstr "URL-Namen bearbeiten" - -#~ msgid "Take over module history" -#~ msgstr "Modulhistorie übernehmen" - -#~ msgid "Filter users" -#~ msgstr "Benutzer filtern" - -#~ msgid "Delete frontenduser in frontendgroup" -#~ msgstr "Frontendbenutzer in Gruppe löschen" - -#~ msgid "The following users were added to this group" -#~ msgstr "Die folgenden Benutzer wurden dieser Gruppe hinzugefügt" - -#~ msgid "" -#~ "The following users are already existing in the group and where not added" -#~ msgstr "" -#~ "Die folgenden Benutzer existieren in dieser Gruppe bereits und wurden " -#~ "deshalb nicht hinzugefügt" - -#~ msgid "Group member" -#~ msgstr "Gruppenmitglied" - -#~ msgid "No users found" -#~ msgstr "Keine Benutzer gefunden" - -#~ msgid "Add group member" -#~ msgstr "Gruppenmitglied hinzufügen" - -#~ msgid "Choose user" -#~ msgstr "Benutzer wählen" - -#~ msgid "Display article link" -#~ msgstr "Artikellink anzeigen" - -#~ msgid "Syncronize from" -#~ msgstr "Synchronisieren von" - -#~ msgid "No users are added to this group yet" -#~ msgstr "Gruppe enthält noch keine Benutzer" - -#~ msgid "Users in Group" -#~ msgstr "Benutzer in der Gruppe" - -#~ msgid "Note: Hold ctrl to select multiple items." -#~ msgstr "" -#~ "Hinweis: Drücken und halten Sie die Taste \"STRG\", um mehrere " -#~ "Einträge zu selektieren." - -#~ msgid "Do you really want to create a new language?" -#~ msgstr "Möchten Sie wirklich eine neue Sprache erstellen?" - -#~ msgid "Layout is in use" -#~ msgstr "Layout wird benutzt" - -#~ msgid "Module history" -#~ msgstr "Modulhistorie" - -#~ msgid "Module data" -#~ msgstr "Moduldaten" - -#~ msgid "No history available" -#~ msgstr "Keine Modulhistorie vorhanden" - -#~ msgid "Module history disabled by system administrator" -#~ msgstr "Die Modulhistorie wurde vom Systemadministrator deaktiviert." - -#~ msgid "In use" -#~ msgstr "Wird benutzt" - -#~ msgid "Translate module \"%s\"" -#~ msgstr "Modul \"%s\" übersetzen" - -#~ msgid "Use JAVA Module Editor (experimental)" -#~ msgstr "JAVA-Moduleditor verwenden (experimentell)" - -#~ msgid "" -#~ "Insert recipients using this format:
    <data>[Delimiter]<" -#~ "data>... - each recipient in a new line." -#~ msgstr "" -#~ "Empfänger im folgenden Format eingeben:
    <Daten>" -#~ "[Trennzeichen]<Daten>... - jeweils eine Zeile pro Empfänger." - -#~ msgid "" -#~ "
    e.g. name;mail -> first column contains the name, the second the " -#~ "mail address." -#~ msgstr "" -#~ "
    z.B. Name;Mail -> erste Spalte enthält den Namen, die zweite " -#~ "die E-Mail-Adresse." - -#~ msgid "Categoryname" -#~ msgstr "Kategoriename" - -#~ msgid "Unprotect category" -#~ msgstr "Kategorie freigeben" - -#~ msgid "One or more articles are existing, unable to delete" -#~ msgstr "" -#~ "Ein oder mehrere Artikel existieren, löschen nicht möglich" - -#~ msgid "" -#~ "One or more subtrees and one or more articles are existing, unable to " -#~ "delete." -#~ msgstr "" -#~ "Mindestens eine Unterkategorie sowie mindestens ein Artikel existieren, " -#~ "löschen nicht möglich" - -#~ msgid "Move tree" -#~ msgstr "Baum verschieben" - -#~ msgid "Place tree here" -#~ msgstr "Baum hier ablegen" - -#~ msgid "No thumbnails" -#~ msgstr "Keine Thumbnails" - -#~ msgid "Thumbnail size:" -#~ msgstr "Thumbnail-Größe" - -#~ msgid "Select date, please." -#~ msgstr "Bitte Datum wählen" - -#~ msgid "Su" -#~ msgstr "So" - -#~ msgid "Mo" -#~ msgstr "Mo" - -#~ msgid "Tu" -#~ msgstr "Di" - -#~ msgid "We" -#~ msgstr "Mi" - -#~ msgid "Th" -#~ msgstr "Do" - -#~ msgid "Fr" -#~ msgstr "Fr" - -#~ msgid "Sa" -#~ msgstr "Sa" - -#~ msgid "Previous year" -#~ msgstr "Vorheriges Jahr" - -#~ msgid "Previous month" -#~ msgstr "Vorheriger Monat" - -#~ msgid "Next month" -#~ msgstr "Nächster Monat" - -#~ msgid "Next year" -#~ msgstr "Nächstes Jahr" - -#~ msgid "Time" -#~ msgstr "Zeit" - -#~ msgid "Conceptual Project Management / Testing" -#~ msgstr "Konzeptionelles Projektmanagement / Qualitätssicherung" - -#~ msgid "Technical Project Management / Testing" -#~ msgstr "Technisches Projektmanagement / Qualitätssicherung" - -#~ msgid "Warning: Changes will reset active Workflows" -#~ msgstr "Warnung: Änderungen setzen aktive Workflows zurück" - -#~ msgid "Non Groupmembers" -#~ msgstr "Nicht Gruppenmitglieder" - -#~ msgid "Groupmembers" -#~ msgstr "Gruppenmitglieder" - -#~ msgid "Add right side selected users to group" -#~ msgstr "Füge rechts ausgewählte Benutzer der Gruppe hinzu" - -#~ msgid "Remove left side selected users from group" -#~ msgstr "Entferne links ausgewählte Benutzer aus der Gruppe" - -#~ msgid "Rights type" -#~ msgstr "Rechtegruppe" - -#~ msgid "This user does not exist." -#~ msgstr "Der eingegebene Nutzername existiert nicht." - -#~ msgid "" -#~ "The requested user has no valid e-mail address. Submitting new password " -#~ "is not possible. Please contact your system- administrator for further " -#~ "support." -#~ msgstr "" -#~ "Der betroffene Nutzer hat keine gültige E-Mailadresse hinterlegt. " -#~ "Die Zusendung eines neuen Passworts ist nicht möglich. Bitte " -#~ "kontaktieren Sie Ihren System- administrator für weitere " -#~ "Unterstützung." - -#~ msgid "Form error" -#~ msgstr "Formularfehler" - -#~ msgid "Please select a new Position for new category" -#~ msgstr "Bitte wählen Sie eine Position für die neue Kategorie" - -#~ msgid "Field category name is empty" -#~ msgstr "Das Feld Kateogoriename ist leer" - -#~ msgid "Your Contenido Version" -#~ msgstr "Ihre Contenido Version" - -#~ msgid "Latest Contenido Version" -#~ msgstr "Aktuelle Contenido Version" - -#~ msgid "Changed by" -#~ msgstr "Geändert von" - -#~ msgid "Show History Entry" -#~ msgstr "Historieneintrag anzeigen" - -#~ msgid "Update Information" -#~ msgstr "Update-Nachrichten" - -#~ msgid "Internal History Error" -#~ msgstr "Interner Historie Fehler" - -#~ msgid "more" -#~ msgstr "mehr" - -#~ msgid "No layout description available" -#~ msgstr "Keine Layout-Beschreibung vorhanden" - -#~ msgid "Client %s" -#~ msgstr "Mandant %s" - -#~ msgid "-- Unnamed Template --" -#~ msgstr "-- Unbenanntes Template --" - -#~ msgid "Is used in" -#~ msgstr "Wird benutzt in" diff --git a/conlite/locale/potfiles.txt b/conlite/locale/potfiles.txt index 0c0a86b..a006f92 100644 --- a/conlite/locale/potfiles.txt +++ b/conlite/locale/potfiles.txt @@ -57,6 +57,8 @@ ./classes/contenido/class.containerconfig.php ./classes/contenido/class.content.php ./classes/contenido/class.categorytree.php +./classes/gui/class.page.php +./classes/gui/class.file_list.php ./classes/class.notification.php ./classes/class.communications.php ./classes/class.versionLayout.php @@ -232,6 +234,7 @@ ./templates/standard/template.tpl_overview.html ./templates/standard/template.rights_inc.html ./templates/standard/html5/template.generic_page.html +./templates/standard/html5/file_list.html ./templates/standard/template.lay_edit_form.html ./templates/standard/template.inuse_tpl.html ./templates/standard/template.subnav_noleft.html @@ -302,6 +305,7 @@ ./scripts/articleObject.js.php ./scripts/help.js.php ./scripts/langref.php +./includes/include.js_files_overview_1.php ./includes/include.CMS_TEXT.php ./includes/include.mod_package.php ./includes/rights.inc.php @@ -445,6 +449,7 @@ ./includes/include.mod_sync.php ./includes/include.html_tpl_left_top.php ./includes/rights_str.inc.php +./includes/include.js_edit_form_1.php ./includes/include.mycontenido.tasks.edit.php ./includes/include.con_left_top.php ./includes/include.grouprights_menu.php diff --git a/conlite/plugins/chains/includes/config.plugin.php b/conlite/plugins/chains/includes/config.plugin.php index 73dcc2a..b6853e9 100644 --- a/conlite/plugins/chains/includes/config.plugin.php +++ b/conlite/plugins/chains/includes/config.plugin.php @@ -45,4 +45,8 @@ $_cecRegistry->addChainFunction("Contenido.Content.CreateMetatags", "cecCreateMe $_cecRegistry->addChainFunction("Contenido.Frontend.HTMLCodeOutput", "cecCreateFacebookMeta->createHeadTag"); $_cecRegistry->addChainFunction("Contenido.Frontend.BaseHrefGeneration", "cecCreateBaseHref"); $_cecRegistry->addChainFunction('Contenido.Frontend.HTMLCodeCompression', 'cecOutputCompressor'); + + +cInclude('includes', 'chains/include.chain.template.parsetemplate.php'); +$_cecRegistry->addChainFunction('Contenido.Template.BeforeParse', 'cecParseTemplate'); ?> \ No newline at end of file diff --git a/conlite/scripts/conlite.js b/conlite/scripts/conlite.js new file mode 100644 index 0000000..011553b --- /dev/null +++ b/conlite/scripts/conlite.js @@ -0,0 +1,121 @@ +( + function (jQuery, scope) { + var generator = 'ConLite'; + var Con; + // var $ = jQuery.noConflict(); + var $ = jQuery; + + scope.Con = scope.Con || { + Plugin: {}, + cfg: {}, + sid: 0 + }; + Con = scope.Con; + Con.$ = jQuery; + Con.cfg.enableLog = true; + + Con.namespace = function (namespace) { + var ns = namespace.split('.'), + o = scope, i; + for (i = 0; i < ns.length; i++) { + o[ns[i]] = o[ns[i]] || {}; + o = o[ns[i]]; + } + return o; + }; + + Con.getFrame = function (name) { + try { + // Contenido's file and image browser + if ("undefined" === typeof (scope.top.content)) { + switch (name) { + case 'header': + return scope.header; + case 'content': + return scope.contentFrame; + case 'left': + return scope.top.left; + case 'left_deco': + return scope.top.left.left_deco; + case 'left_top': + return scope.top.left.left_top; + case 'left_bottom': + return scope.top.left.left_bottom; + case 'right': + return scope.top.right; + case 'right_top': + return scope.top.right.right_top; + case 'right_bottom': + return scope.top.right.right_bottom; + } + } + // everywhere else + switch (name) { + case 'header': + return scope.top.header; + case 'content': + return scope.top.content; + case 'left': + return scope.top.content.left; + case 'left_deco': + return scope.top.content.left.left_deco; + case 'left_top': + return scope.top.content.left.left_top; + case 'left_bottom': + return scope.top.content.left.left_bottom; + case 'right': + return scope.top.content.right; + case 'right_top': + if ('undefined' !== $.type(scope.top.content.right)) { + return scope.top.content.right.right_top; + } else { + return scope.top.content.right_top; + } + case 'right_bottom': + if ('undefined' !== typeof (scope.top.content.right)) { + return scope.top.content.right.right_bottom; + } else { + return scope.top.content.right_bottom; + } + } + } catch (e) { + Con.log(["getFrame: Couldn't get frame " + name, e], generator, 'warn'); + return null; + } + }; + + + Con.log = function (mixedVar, source, severity) { + severity = severity || 'log'; + + if (!Con.cfg.enableLog) { + return; + } else if (-1 === $.inArray(severity, ['log', 'info', 'warn', 'error'])) { + return; + } + + if (scope.console && 'function' === typeof scope.console[severity]) { + var msg = severity.toUpperCase() + ': ' + source + ': '; + scope.console[severity](msg, mixedVar); + } + }; + + // Console emulation, to prevent errors if console is not available + if (!('console' in scope)) { + (function () { + scope.console = { + log: function () { + }, + debug: function () { + }, + info: function () { + }, + warn: function () { + }, + error: function () { + } + }; + })(); + } + } +)(jQuery, window); \ No newline at end of file diff --git a/conlite/scripts/conlite.min.js b/conlite/scripts/conlite.min.js new file mode 100644 index 0000000..8d627bc --- /dev/null +++ b/conlite/scripts/conlite.min.js @@ -0,0 +1 @@ +(function(e,a){var d="ConLite";var c;var b=e;a.Con=a.Con||{Plugin:{},cfg:{},sid:0};c=a.Con;c.$=e;c.cfg.enableLog=true;c.namespace=function(h){var g=h.split("."),j=a,f;for(f=0;f i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover > svg { + color: #fff; +} +.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i, .context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg { + color: #bbb; +} + +.context-menu-list { + position: absolute; + display: inline-block; + min-width: 13em; + max-width: 26em; + padding: .25em 0; + margin: .3em; + font-family: inherit; + font-size: inherit; + list-style-type: none; + background: #fff; + border: 1px solid #bebebe; + border-radius: .2em; + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, .5); + box-shadow: 0 2px 5px rgba(0, 0, 0, .5); +} + +.context-menu-item { + position: relative; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: .2em 2em; + color: #2f2f2f; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #fff; +} + +.context-menu-separator { + padding: 0; + margin: .35em 0; + border-bottom: 1px solid #e6e6e6; +} + +.context-menu-item > label > input, +.context-menu-item > label > textarea { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.context-menu-item.context-menu-hover { + color: #fff; + cursor: pointer; + background-color: #2980b9; +} + +.context-menu-item.context-menu-disabled { + color: #bbb; + cursor: default; + background-color: #fff; +} + +.context-menu-input.context-menu-hover { + color: #2f2f2f; + cursor: default; +} + +.context-menu-submenu:after { + position: absolute; + top: 50%; + right: .5em; + z-index: 1; + width: 0; + height: 0; + content: ''; + border-color: transparent transparent transparent #2f2f2f; + border-style: solid; + border-width: .25em 0 .25em .25em; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + -o-transform: translateY(-50%); + transform: translateY(-50%); +} + +/** + * Inputs + */ +.context-menu-item.context-menu-input { + padding: .3em .6em; +} + +/* vertically align inside labels */ +.context-menu-input > label > * { + vertical-align: top; +} + +/* position checkboxes and radios as icons */ +.context-menu-input > label > input[type="checkbox"], +.context-menu-input > label > input[type="radio"] { + position: relative; + top: .12em; + margin-right: .4em; +} + +.context-menu-input > label { + margin: 0; +} + +.context-menu-input > label, +.context-menu-input > label > input[type="text"], +.context-menu-input > label > textarea, +.context-menu-input > label > select { + display: block; + width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.context-menu-input > label > textarea { + height: 7em; +} + +.context-menu-item > .context-menu-list { + top: .3em; + /* re-positioned by js */ + right: -.3em; + display: none; +} + +.context-menu-item.context-menu-visible > .context-menu-list { + display: block; +} + +.context-menu-accesskey { + text-decoration: underline; +} diff --git a/conlite/scripts/jquery/contextmenu/jquery.contextMenu.js b/conlite/scripts/jquery/contextmenu/jquery.contextMenu.js new file mode 100644 index 0000000..9fa4ba7 --- /dev/null +++ b/conlite/scripts/jquery/contextmenu/jquery.contextMenu.js @@ -0,0 +1,2134 @@ +/** + * jQuery contextMenu v2.9.2 - Plugin for simple contextMenu handling + * + * Version: v2.9.2 + * + * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) + * Web: http://swisnl.github.io/jQuery-contextMenu/ + * + * Copyright (c) 2011-2020 SWIS BV and contributors + * + * Licensed under + * MIT License http://www.opensource.org/licenses/mit-license + * + * Date: 2020-05-13T13:55:36.983Z + */ + +// jscs:disable +/* jshint ignore:start */ +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as anonymous module. + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node / CommonJS + factory(require('jquery')); + } else { + // Browser globals. + factory(jQuery); + } +})(function ($) { + + 'use strict'; + + // TODO: - + // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio + // create structure if $.support[htmlCommand || htmlMenuitem] and !opt.disableNative + + // determine html5 compatibility + $.support.htmlMenuitem = ('HTMLMenuItemElement' in window); + $.support.htmlCommand = ('HTMLCommandElement' in window); + $.support.eventSelectstart = ('onselectstart' in document.documentElement); + /* // should the need arise, test for css user-select + $.support.cssUserSelect = (function(){ + var t = false, + e = document.createElement('div'); + + $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) { + var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect', + prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select'; + + e.style.cssText = prop + ': text;'; + if (e.style[propCC] == 'text') { + t = true; + return false; + } + + return true; + }); + + return t; + })(); + */ + + + if (!$.ui || !$.widget) { + // duck punch $.cleanData like jQueryUI does to get that remove event + $.cleanData = (function (orig) { + return function (elems) { + var events, elem, i; + for (i = 0; elems[i] != null; i++) { + elem = elems[i]; + try { + // Only trigger remove when necessary to save time + events = $._data(elem, 'events'); + if (events && events.remove) { + $(elem).triggerHandler('remove'); + } + + // Http://bugs.jquery.com/ticket/8235 + } catch (e) { + } + } + orig(elems); + }; + })($.cleanData); + } + /* jshint ignore:end */ + // jscs:enable + + var // currently active contextMenu trigger + $currentTrigger = null, + // is contextMenu initialized with at least one menu? + initialized = false, + // window handle + $win = $(window), + // number of registered menus + counter = 0, + // mapping selector to namespace + namespaces = {}, + // mapping namespace to options + menus = {}, + // custom command type handlers + types = {}, + // default values + defaults = { + // selector of contextMenu trigger + selector: null, + // where to append the menu to + appendTo: null, + // method to trigger context menu ["right", "left", "hover"] + trigger: 'right', + // hide menu when mouse leaves trigger / menu elements + autoHide: false, + // ms to wait before showing a hover-triggered context menu + delay: 200, + // flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu + // as long as the trigger happened on one of the trigger-element's child nodes + reposition: true, + // Flag denoting if a second trigger should close the menu, as long as + // the trigger happened on one of the trigger-element's child nodes. + // This overrides the reposition option. + hideOnSecondTrigger: false, + + //ability to select submenu + selectableSubMenu: false, + + // Default classname configuration to be able avoid conflicts in frameworks + classNames: { + hover: 'context-menu-hover', // Item hover + disabled: 'context-menu-disabled', // Item disabled + visible: 'context-menu-visible', // Item visible + notSelectable: 'context-menu-not-selectable', // Item not selectable + + icon: 'context-menu-icon', + iconEdit: 'context-menu-icon-edit', + iconCut: 'context-menu-icon-cut', + iconCopy: 'context-menu-icon-copy', + iconPaste: 'context-menu-icon-paste', + iconDelete: 'context-menu-icon-delete', + iconAdd: 'context-menu-icon-add', + iconQuit: 'context-menu-icon-quit', + iconLoadingClass: 'context-menu-icon-loading' + }, + + // determine position to show menu at + determinePosition: function ($menu) { + // position to the lower middle of the trigger element + if ($.ui && $.ui.position) { + // .position() is provided as a jQuery UI utility + // (...and it won't work on hidden elements) + $menu.css('display', 'block').position({ + my: 'center top', + at: 'center bottom', + of: this, + offset: '0 5', + collision: 'fit' + }).css('display', 'none'); + } else { + // determine contextMenu position + var offset = this.offset(); + offset.top += this.outerHeight(); + offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2; + $menu.css(offset); + } + }, + // position menu + position: function (opt, x, y) { + var offset; + // determine contextMenu position + if (!x && !y) { + opt.determinePosition.call(this, opt.$menu); + return; + } else if (x === 'maintain' && y === 'maintain') { + // x and y must not be changed (after re-show on command click) + offset = opt.$menu.position(); + } else { + // x and y are given (by mouse event) + var offsetParentOffset = opt.$menu.offsetParent().offset(); + offset = {top: y - offsetParentOffset.top, left: x -offsetParentOffset.left}; + } + + // correct offset if viewport demands it + var bottom = $win.scrollTop() + $win.height(), + right = $win.scrollLeft() + $win.width(), + height = opt.$menu.outerHeight(), + width = opt.$menu.outerWidth(); + + if (offset.top + height > bottom) { + offset.top -= height; + } + + if (offset.top < 0) { + offset.top = 0; + } + + if (offset.left + width > right) { + offset.left -= width; + } + + if (offset.left < 0) { + offset.left = 0; + } + + opt.$menu.css(offset); + }, + // position the sub-menu + positionSubmenu: function ($menu) { + if (typeof $menu === 'undefined') { + // When user hovers over item (which has sub items) handle.focusItem will call this. + // but the submenu does not exist yet if opt.items is a promise. just return, will + // call positionSubmenu after promise is completed. + return; + } + if ($.ui && $.ui.position) { + // .position() is provided as a jQuery UI utility + // (...and it won't work on hidden elements) + $menu.css('display', 'block').position({ + my: 'left top-5', + at: 'right top', + of: this, + collision: 'flipfit fit' + }).css('display', ''); + } else { + // determine contextMenu position + var offset = { + top: -9, + left: this.outerWidth() - 5 + }; + $menu.css(offset); + } + }, + // offset to add to zIndex + zIndex: 1, + // show hide animation settings + animation: { + duration: 50, + show: 'slideDown', + hide: 'slideUp' + }, + // events + events: { + preShow: $.noop, + show: $.noop, + hide: $.noop, + activated: $.noop + }, + // default callback + callback: null, + // list of contextMenu items + items: {} + }, + // mouse position for hover activation + hoveract = { + timer: null, + pageX: null, + pageY: null + }, + // determine zIndex + zindex = function ($t) { + var zin = 0, + $tt = $t; + + while (true) { + zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0); + $tt = $tt.parent(); + if (!$tt || !$tt.length || 'html body'.indexOf($tt.prop('nodeName').toLowerCase()) > -1) { + break; + } + } + return zin; + }, + // event handlers + handle = { + // abort anything + abortevent: function (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + }, + // contextmenu show dispatcher + contextmenu: function (e) { + var $this = $(this); + + //Show browser context-menu when preShow returns false + if (e.data.events.preShow($this,e) === false) { + return; + } + + // disable actual context-menu if we are using the right mouse button as the trigger + if (e.data.trigger === 'right') { + e.preventDefault(); + e.stopImmediatePropagation(); + } + + // abort native-triggered events unless we're triggering on right click + if ((e.data.trigger !== 'right' && e.data.trigger !== 'demand') && e.originalEvent) { + return; + } + + // Let the current contextmenu decide if it should show or not based on its own trigger settings + if (typeof e.mouseButton !== 'undefined' && e.data) { + if (!(e.data.trigger === 'left' && e.mouseButton === 0) && !(e.data.trigger === 'right' && e.mouseButton === 2)) { + // Mouse click is not valid. + return; + } + } + + // abort event if menu is visible for this trigger + if ($this.hasClass('context-menu-active')) { + return; + } + + if (!$this.hasClass('context-menu-disabled')) { + // theoretically need to fire a show event at + // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus + // var evt = jQuery.Event("show", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this }); + // e.data.$menu.trigger(evt); + + $currentTrigger = $this; + if (e.data.build) { + var built = e.data.build($currentTrigger, e); + // abort if build() returned false + if (built === false) { + return; + } + + // dynamically build menu on invocation + e.data = $.extend(true, {}, defaults, e.data, built || {}); + + // abort if there are no items to display + if (!e.data.items || $.isEmptyObject(e.data.items)) { + // Note: jQuery captures and ignores errors from event handlers + if (window.console) { + (console.error || console.log).call(console, 'No items specified to show in contextMenu'); + } + + throw new Error('No Items specified'); + } + + // backreference for custom command type creation + e.data.$trigger = $currentTrigger; + + op.create(e.data); + } + op.show.call($this, e.data, e.pageX, e.pageY); + } + }, + // contextMenu left-click trigger + click: function (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + $(this).trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY})); + }, + // contextMenu right-click trigger + mousedown: function (e) { + // register mouse down + var $this = $(this); + + // hide any previous menus + if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) { + $currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide'); + } + + // activate on right click + if (e.button === 2) { + $currentTrigger = $this.data('contextMenuActive', true); + } + }, + // contextMenu right-click trigger + mouseup: function (e) { + // show menu + var $this = $(this); + if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) { + e.preventDefault(); + e.stopImmediatePropagation(); + $currentTrigger = $this; + $this.trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY})); + } + + $this.removeData('contextMenuActive'); + }, + // contextMenu hover trigger + mouseenter: function (e) { + var $this = $(this), + $related = $(e.relatedTarget), + $document = $(document); + + // abort if we're coming from a menu + if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) { + return; + } + + // abort if a menu is shown + if ($currentTrigger && $currentTrigger.length) { + return; + } + + hoveract.pageX = e.pageX; + hoveract.pageY = e.pageY; + hoveract.data = e.data; + $document.on('mousemove.contextMenuShow', handle.mousemove); + hoveract.timer = setTimeout(function () { + hoveract.timer = null; + $document.off('mousemove.contextMenuShow'); + $currentTrigger = $this; + $this.trigger($.Event('contextmenu', { + data: hoveract.data, + pageX: hoveract.pageX, + pageY: hoveract.pageY + })); + }, e.data.delay); + }, + // contextMenu hover trigger + mousemove: function (e) { + hoveract.pageX = e.pageX; + hoveract.pageY = e.pageY; + }, + // contextMenu hover trigger + mouseleave: function (e) { + // abort if we're leaving for a menu + var $related = $(e.relatedTarget); + if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) { + return; + } + + try { + clearTimeout(hoveract.timer); + } catch (e) { + } + + hoveract.timer = null; + }, + // click on layer to hide contextMenu + layerClick: function (e) { + var $this = $(this), + root = $this.data('contextMenuRoot'), + button = e.button, + x = e.pageX, + y = e.pageY, + fakeClick = x === undefined, + target, + offset; + + e.preventDefault(); + + setTimeout(function () { + // If the click is not real, things break: https://github.com/swisnl/jQuery-contextMenu/issues/132 + if(fakeClick){ + if (root !== null && typeof root !== 'undefined' && root.$menu !== null && typeof root.$menu !== 'undefined') { + root.$menu.trigger('contextmenu:hide'); + } + return; + } + + var $window; + var triggerAction = ((root.trigger === 'left' && button === 0) || (root.trigger === 'right' && button === 2)); + + // find the element that would've been clicked, wasn't the layer in the way + if (document.elementFromPoint && root.$layer) { + root.$layer.hide(); + target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop()); + + // also need to try and focus this element if we're in a contenteditable area, + // as the layer will prevent the browser mouse action we want + if (target !== null && target.isContentEditable) { + var range = document.createRange(), + sel = window.getSelection(); + range.selectNode(target); + range.collapse(true); + sel.removeAllRanges(); + sel.addRange(range); + } + $(target).trigger(e); + root.$layer.show(); + } + + if (root.hideOnSecondTrigger && triggerAction && root.$menu !== null && typeof root.$menu !== 'undefined') { + root.$menu.trigger('contextmenu:hide'); + return; + } + + if (root.reposition && triggerAction) { + if (document.elementFromPoint) { + if (root.$trigger.is(target)) { + root.position.call(root.$trigger, root, x, y); + return; + } + } else { + offset = root.$trigger.offset(); + $window = $(window); + // while this looks kinda awful, it's the best way to avoid + // unnecessarily calculating any positions + offset.top += $window.scrollTop(); + if (offset.top <= e.pageY) { + offset.left += $window.scrollLeft(); + if (offset.left <= e.pageX) { + offset.bottom = offset.top + root.$trigger.outerHeight(); + if (offset.bottom >= e.pageY) { + offset.right = offset.left + root.$trigger.outerWidth(); + if (offset.right >= e.pageX) { + // reposition + root.position.call(root.$trigger, root, x, y); + return; + } + } + } + } + } + } + + if (target && triggerAction) { + root.$trigger.one('contextmenu:hidden', function () { + $(target).contextMenu({x: x, y: y, button: button}); + }); + } + + if (root !== null && typeof root !== 'undefined' && root.$menu !== null && typeof root.$menu !== 'undefined') { + root.$menu.trigger('contextmenu:hide'); + } + }, 50); + }, + // key handled :hover + keyStop: function (e, opt) { + if (!opt.isInput) { + e.preventDefault(); + } + + e.stopPropagation(); + }, + key: function (e) { + + var opt = {}; + + // Only get the data from $currentTrigger if it exists + if ($currentTrigger) { + opt = $currentTrigger.data('contextMenu') || {}; + } + // If the trigger happen on a element that are above the contextmenu do this + if (typeof opt.zIndex === 'undefined') { + opt.zIndex = 0; + } + var targetZIndex = 0; + var getZIndexOfTriggerTarget = function (target) { + if (target.style.zIndex !== '') { + targetZIndex = target.style.zIndex; + } else { + if (target.offsetParent !== null && typeof target.offsetParent !== 'undefined') { + getZIndexOfTriggerTarget(target.offsetParent); + } + else if (target.parentElement !== null && typeof target.parentElement !== 'undefined') { + getZIndexOfTriggerTarget(target.parentElement); + } + } + }; + getZIndexOfTriggerTarget(e.target); + // If targetZIndex is heigher then opt.zIndex dont progress any futher. + // This is used to make sure that if you are using a dialog with a input / textarea / contenteditable div + // and its above the contextmenu it wont steal keys events + if (opt.$menu && parseInt(targetZIndex,10) > parseInt(opt.$menu.css("zIndex"),10)) { + return; + } + switch (e.keyCode) { + case 9: + case 38: // up + handle.keyStop(e, opt); + // if keyCode is [38 (up)] or [9 (tab) with shift] + if (opt.isInput) { + if (e.keyCode === 9 && e.shiftKey) { + e.preventDefault(); + if (opt.$selected) { + opt.$selected.find('input, textarea, select').blur(); + } + if (opt.$menu !== null && typeof opt.$menu !== 'undefined') { + opt.$menu.trigger('prevcommand'); + } + return; + } else if (e.keyCode === 38 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') { + // checkboxes don't capture this key + e.preventDefault(); + return; + } + } else if (e.keyCode !== 9 || e.shiftKey) { + if (opt.$menu !== null && typeof opt.$menu !== 'undefined') { + opt.$menu.trigger('prevcommand'); + } + return; + } + break; + // omitting break; + // case 9: // tab - reached through omitted break; + case 40: // down + handle.keyStop(e, opt); + if (opt.isInput) { + if (e.keyCode === 9) { + e.preventDefault(); + if (opt.$selected) { + opt.$selected.find('input, textarea, select').blur(); + } + if (opt.$menu !== null && typeof opt.$menu !== 'undefined') { + opt.$menu.trigger('nextcommand'); + } + return; + } else if (e.keyCode === 40 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') { + // checkboxes don't capture this key + e.preventDefault(); + return; + } + } else { + if (opt.$menu !== null && typeof opt.$menu !== 'undefined') { + opt.$menu.trigger('nextcommand'); + } + return; + } + break; + + case 37: // left + handle.keyStop(e, opt); + if (opt.isInput || !opt.$selected || !opt.$selected.length) { + break; + } + + if (!opt.$selected.parent().hasClass('context-menu-root')) { + var $parent = opt.$selected.parent().parent(); + opt.$selected.trigger('contextmenu:blur'); + opt.$selected = $parent; + return; + } + break; + + case 39: // right + handle.keyStop(e, opt); + if (opt.isInput || !opt.$selected || !opt.$selected.length) { + break; + } + + var itemdata = opt.$selected.data('contextMenu') || {}; + if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) { + opt.$selected = null; + itemdata.$selected = null; + itemdata.$menu.trigger('nextcommand'); + return; + } + break; + + case 35: // end + case 36: // home + if (opt.$selected && opt.$selected.find('input, textarea, select').length) { + return; + } else { + (opt.$selected && opt.$selected.parent() || opt.$menu) + .children(':not(.' + opt.classNames.disabled + ', .' + opt.classNames.notSelectable + ')')[e.keyCode === 36 ? 'first' : 'last']() + .trigger('contextmenu:focus'); + e.preventDefault(); + return; + } + break; + + case 13: // enter + handle.keyStop(e, opt); + if (opt.isInput) { + if (opt.$selected && !opt.$selected.is('textarea, select')) { + e.preventDefault(); + return; + } + break; + } + if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) { + opt.$selected.trigger('mouseup'); + } + return; + + case 32: // space + case 33: // page up + case 34: // page down + // prevent browser from scrolling down while menu is visible + handle.keyStop(e, opt); + return; + + case 27: // esc + handle.keyStop(e, opt); + if (opt.$menu !== null && typeof opt.$menu !== 'undefined') { + opt.$menu.trigger('contextmenu:hide'); + } + return; + + default: // 0-9, a-z + var k = (String.fromCharCode(e.keyCode)).toUpperCase(); + if (opt.accesskeys && opt.accesskeys[k]) { + // according to the specs accesskeys must be invoked immediately + opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu ? 'contextmenu:focus' : 'mouseup'); + return; + } + break; + } + // pass event to selected item, + // stop propagation to avoid endless recursion + e.stopPropagation(); + if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) { + opt.$selected.trigger(e); + } + }, + // select previous possible command in menu + prevItem: function (e) { + e.stopPropagation(); + var opt = $(this).data('contextMenu') || {}; + var root = $(this).data('contextMenuRoot') || {}; + + // obtain currently selected menu + if (opt.$selected) { + var $s = opt.$selected; + opt = opt.$selected.parent().data('contextMenu') || {}; + opt.$selected = $s; + } + + var $children = opt.$menu.children(), + $prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(), + $round = $prev; + + // skip disabled or hidden elements + while ($prev.hasClass(root.classNames.disabled) || $prev.hasClass(root.classNames.notSelectable) || $prev.is(':hidden')) { + if ($prev.prev().length) { + $prev = $prev.prev(); + } else { + $prev = $children.last(); + } + if ($prev.is($round)) { + // break endless loop + return; + } + } + + // leave current + if (opt.$selected) { + handle.itemMouseleave.call(opt.$selected.get(0), e); + } + + // activate next + handle.itemMouseenter.call($prev.get(0), e); + + // focus input + var $input = $prev.find('input, textarea, select'); + if ($input.length) { + $input.focus(); + } + }, + // select next possible command in menu + nextItem: function (e) { + e.stopPropagation(); + var opt = $(this).data('contextMenu') || {}; + var root = $(this).data('contextMenuRoot') || {}; + + // obtain currently selected menu + if (opt.$selected) { + var $s = opt.$selected; + opt = opt.$selected.parent().data('contextMenu') || {}; + opt.$selected = $s; + } + + var $children = opt.$menu.children(), + $next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(), + $round = $next; + + // skip disabled + while ($next.hasClass(root.classNames.disabled) || $next.hasClass(root.classNames.notSelectable) || $next.is(':hidden')) { + if ($next.next().length) { + $next = $next.next(); + } else { + $next = $children.first(); + } + if ($next.is($round)) { + // break endless loop + return; + } + } + + // leave current + if (opt.$selected) { + handle.itemMouseleave.call(opt.$selected.get(0), e); + } + + // activate next + handle.itemMouseenter.call($next.get(0), e); + + // focus input + var $input = $next.find('input, textarea, select'); + if ($input.length) { + $input.focus(); + } + }, + // flag that we're inside an input so the key handler can act accordingly + focusInput: function () { + var $this = $(this).closest('.context-menu-item'), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + root.$selected = opt.$selected = $this; + root.isInput = opt.isInput = true; + }, + // flag that we're inside an input so the key handler can act accordingly + blurInput: function () { + var $this = $(this).closest('.context-menu-item'), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + root.isInput = opt.isInput = false; + }, + // :hover on menu + menuMouseenter: function () { + var root = $(this).data().contextMenuRoot; + root.hovering = true; + }, + // :hover on menu + menuMouseleave: function (e) { + var root = $(this).data().contextMenuRoot; + if (root.$layer && root.$layer.is(e.relatedTarget)) { + root.hovering = false; + } + }, + // :hover done manually so key handling is possible + itemMouseenter: function (e) { + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + root.hovering = true; + + // abort if we're re-entering + if (e && root.$layer && root.$layer.is(e.relatedTarget)) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + + // make sure only one item is selected + (opt.$menu ? opt : root).$menu + .children('.' + root.classNames.hover).trigger('contextmenu:blur') + .children('.hover').trigger('contextmenu:blur'); + + if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) { + opt.$selected = null; + return; + } + + + $this.trigger('contextmenu:focus'); + }, + // :hover done manually so key handling is possible + itemMouseleave: function (e) { + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) { + if (typeof root.$selected !== 'undefined' && root.$selected !== null) { + root.$selected.trigger('contextmenu:blur'); + } + e.preventDefault(); + e.stopImmediatePropagation(); + root.$selected = opt.$selected = opt.$node; + return; + } + + if(opt && opt.$menu && opt.$menu.hasClass('context-menu-visible')){ + return; + } + + $this.trigger('contextmenu:blur'); + }, + // contextMenu item click + itemClick: function (e) { + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot, + key = data.contextMenuKey, + callback; + + // abort if the key is unknown or disabled or is a menu + if (!opt.items[key] || $this.is('.' + root.classNames.disabled + ', .context-menu-separator, .' + root.classNames.notSelectable) || ($this.is('.context-menu-submenu') && root.selectableSubMenu === false )) { + return; + } + + e.preventDefault(); + e.stopImmediatePropagation(); + + if ($.isFunction(opt.callbacks[key]) && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) { + // item-specific callback + callback = opt.callbacks[key]; + } else if ($.isFunction(root.callback)) { + // default callback + callback = root.callback; + } else { + // no callback, no action + return; + } + + // hide menu if callback doesn't stop that + if (callback.call(root.$trigger, key, root, e) !== false) { + root.$menu.trigger('contextmenu:hide'); + } else if (root.$menu.parent().length) { + op.update.call(root.$trigger, root); + } + }, + // ignore click events on input elements + inputClick: function (e) { + e.stopImmediatePropagation(); + }, + // hide + hideMenu: function (e, data) { + var root = $(this).data('contextMenuRoot'); + op.hide.call(root.$trigger, root, data && data.force); + }, + // focus + focusItem: function (e) { + e.stopPropagation(); + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) { + return; + } + + $this + .addClass([root.classNames.hover, root.classNames.visible].join(' ')) + // select other items and included items + .parent().find('.context-menu-item').not($this) + .removeClass(root.classNames.visible) + .filter('.' + root.classNames.hover) + .trigger('contextmenu:blur'); + + // remember selected + opt.$selected = root.$selected = $this; + + + if(opt && opt.$node && opt.$node.hasClass('context-menu-submenu')){ + opt.$node.addClass(root.classNames.hover); + } + + // position sub-menu - do after show so dumb $.ui.position can keep up + if (opt.$node) { + root.positionSubmenu.call(opt.$node, opt.$menu); + } + }, + // blur + blurItem: function (e) { + e.stopPropagation(); + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + if (opt.autoHide) { // for tablets and touch screens this needs to remain + $this.removeClass(root.classNames.visible); + } + $this.removeClass(root.classNames.hover); + opt.$selected = null; + } + }, + // operations + op = { + show: function (opt, x, y) { + var $trigger = $(this), + css = {}; + + // hide any open menus + $('#context-menu-layer').trigger('mousedown'); + + // backreference for callbacks + opt.$trigger = $trigger; + + // show event + if (opt.events.show.call($trigger, opt) === false) { + $currentTrigger = null; + return; + } + + // create or update context menu + var hasVisibleItems = op.update.call($trigger, opt); + if (hasVisibleItems === false) { + $currentTrigger = null; + return; + } + + // position menu + opt.position.call($trigger, opt, x, y); + + // make sure we're in front + if (opt.zIndex) { + var additionalZValue = opt.zIndex; + // If opt.zIndex is a function, call the function to get the right zIndex. + if (typeof opt.zIndex === 'function') { + additionalZValue = opt.zIndex.call($trigger, opt); + } + css.zIndex = zindex($trigger) + additionalZValue; + } + + // add layer + op.layer.call(opt.$menu, opt, css.zIndex); + + // adjust sub-menu zIndexes + opt.$menu.find('ul').css('zIndex', css.zIndex + 1); + + // position and show context menu + opt.$menu.css(css)[opt.animation.show](opt.animation.duration, function () { + $trigger.trigger('contextmenu:visible'); + + op.activated(opt); + opt.events.activated(opt); + }); + // make options available and set state + $trigger + .data('contextMenu', opt) + .addClass('context-menu-active'); + + // register key handler + $(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key); + // register autoHide handler + if (opt.autoHide) { + // mouse position handler + $(document).on('mousemove.contextMenuAutoHide', function (e) { + // need to capture the offset on mousemove, + // since the page might've been scrolled since activation + var pos = $trigger.offset(); + pos.right = pos.left + $trigger.outerWidth(); + pos.bottom = pos.top + $trigger.outerHeight(); + + if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) { + /* Additional hover check after short time, you might just miss the edge of the menu */ + setTimeout(function () { + if (!opt.hovering && opt.$menu !== null && typeof opt.$menu !== 'undefined') { + opt.$menu.trigger('contextmenu:hide'); + } + }, 50); + } + }); + } + }, + hide: function (opt, force) { + var $trigger = $(this); + if (!opt) { + opt = $trigger.data('contextMenu') || {}; + } + + // hide event + if (!force && opt.events && opt.events.hide.call($trigger, opt) === false) { + return; + } + + // remove options and revert state + $trigger + .removeData('contextMenu') + .removeClass('context-menu-active'); + + if (opt.$layer) { + // keep layer for a bit so the contextmenu event can be aborted properly by opera + setTimeout((function ($layer) { + return function () { + $layer.remove(); + }; + })(opt.$layer), 10); + + try { + delete opt.$layer; + } catch (e) { + opt.$layer = null; + } + } + + // remove handle + $currentTrigger = null; + // remove selected + opt.$menu.find('.' + opt.classNames.hover).trigger('contextmenu:blur'); + opt.$selected = null; + // collapse all submenus + opt.$menu.find('.' + opt.classNames.visible).removeClass(opt.classNames.visible); + // unregister key and mouse handlers + // $(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705 + $(document).off('.contextMenuAutoHide').off('keydown.contextMenu'); + // hide menu + if (opt.$menu) { + opt.$menu[opt.animation.hide](opt.animation.duration, function () { + // tear down dynamically built menu after animation is completed. + if (opt.build) { + opt.$menu.remove(); + $.each(opt, function (key) { + switch (key) { + case 'ns': + case 'selector': + case 'build': + case 'trigger': + return true; + + default: + opt[key] = undefined; + try { + delete opt[key]; + } catch (e) { + } + return true; + } + }); + } + + setTimeout(function () { + $trigger.trigger('contextmenu:hidden'); + }, 10); + }); + } + }, + create: function (opt, root) { + if (typeof root === 'undefined') { + root = opt; + } + + // create contextMenu + opt.$menu = $('
      ').addClass(opt.className || '').data({ + 'contextMenu': opt, + 'contextMenuRoot': root + }); + if(opt.dataAttr){ + $.each(opt.dataAttr, function (key, item) { + opt.$menu.attr('data-' + opt.key, item); + }); + } + + $.each(['callbacks', 'commands', 'inputs'], function (i, k) { + opt[k] = {}; + if (!root[k]) { + root[k] = {}; + } + }); + + if (!root.accesskeys) { + root.accesskeys = {}; + } + + function createNameNode(item) { + var $name = $(''); + if (item._accesskey) { + if (item._beforeAccesskey) { + $name.append(document.createTextNode(item._beforeAccesskey)); + } + $('') + .addClass('context-menu-accesskey') + .text(item._accesskey) + .appendTo($name); + if (item._afterAccesskey) { + $name.append(document.createTextNode(item._afterAccesskey)); + } + } else { + if (item.isHtmlName) { + // restrict use with access keys + if (typeof item.accesskey !== 'undefined') { + throw new Error('accesskeys are not compatible with HTML names and cannot be used together in the same item'); + } + $name.html(item.name); + } else { + $name.text(item.name); + } + } + return $name; + } + + // create contextMenu items + $.each(opt.items, function (key, item) { + var $t = $('
    • ').addClass(item.className || ''), + $label = null, + $input = null; + + // iOS needs to see a click-event bound to an element to actually + // have the TouchEvents infrastructure trigger the click event + $t.on('click', $.noop); + + // Make old school string seperator a real item so checks wont be + // akward later. + // And normalize 'cm_separator' into 'cm_seperator'. + if (typeof item === 'string' || item.type === 'cm_separator') { + item = {type: 'cm_seperator'}; + } + + item.$node = $t.data({ + 'contextMenu': opt, + 'contextMenuRoot': root, + 'contextMenuKey': key + }); + + // register accesskey + // NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that + if (typeof item.accesskey !== 'undefined') { + var aks = splitAccesskey(item.accesskey); + for (var i = 0, ak; ak = aks[i]; i++) { + if (!root.accesskeys[ak]) { + root.accesskeys[ak] = item; + var matched = item.name.match(new RegExp('^(.*?)(' + ak + ')(.*)$', 'i')); + if (matched) { + item._beforeAccesskey = matched[1]; + item._accesskey = matched[2]; + item._afterAccesskey = matched[3]; + } + break; + } + } + } + + if (item.type && types[item.type]) { + // run custom type handler + types[item.type].call($t, item, opt, root); + // register commands + $.each([opt, root], function (i, k) { + k.commands[key] = item; + // Overwrite only if undefined or the item is appended to the root. This so it + // doesn't overwrite callbacks of root elements if the name is the same. + if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) { + k.callbacks[key] = item.callback; + } + }); + } else { + // add label for input + if (item.type === 'cm_seperator') { + $t.addClass('context-menu-separator ' + root.classNames.notSelectable); + } else if (item.type === 'html') { + $t.addClass('context-menu-html ' + root.classNames.notSelectable); + } else if (item.type !== 'sub' && item.type) { + $label = $('').appendTo($t); + createNameNode(item).appendTo($label); + + $t.addClass('context-menu-input'); + opt.hasTypes = true; + $.each([opt, root], function (i, k) { + k.commands[key] = item; + k.inputs[key] = item; + }); + } else if (item.items) { + item.type = 'sub'; + } + + switch (item.type) { + case 'cm_seperator': + break; + + case 'text': + $input = $('') + .attr('name', 'context-menu-input-' + key) + .val(item.value || '') + .appendTo($label); + break; + + case 'textarea': + $input = $('') + .attr('name', 'context-menu-input-' + key) + .val(item.value || '') + .appendTo($label); + + if (item.height) { + $input.height(item.height); + } + break; + + case 'checkbox': + $input = $('') + .attr('name', 'context-menu-input-' + key) + .val(item.value || '') + .prop('checked', !!item.selected) + .prependTo($label); + break; + + case 'radio': + $input = $('') + .attr('name', 'context-menu-input-' + item.radio) + .val(item.value || '') + .prop('checked', !!item.selected) + .prependTo($label); + break; + + case 'select': + $input = $('') + .attr('name', 'context-menu-input-' + key) + .appendTo($label); + if (item.options) { + $.each(item.options, function (value, text) { + $('').val(value).text(text).appendTo($input); + }); + $input.val(item.selected); + } + break; + + case 'sub': + createNameNode(item).appendTo($t); + item.appendTo = item.$node; + $t.data('contextMenu', item).addClass('context-menu-submenu'); + item.callback = null; + + // If item contains items, and this is a promise, we should create it later + // check if subitems is of type promise. If it is a promise we need to create + // it later, after promise has been resolved. + if ('function' === typeof item.items.then) { + // probably a promise, process it, when completed it will create the sub menu's. + op.processPromises(item, root, item.items); + } else { + // normal submenu. + op.create(item, root); + } + break; + + case 'html': + $(item.html).appendTo($t); + break; + + default: + $.each([opt, root], function (i, k) { + k.commands[key] = item; + // Overwrite only if undefined or the item is appended to the root. This so it + // doesn't overwrite callbacks of root elements if the name is the same. + if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) { + k.callbacks[key] = item.callback; + } + }); + createNameNode(item).appendTo($t); + break; + } + + // disable key listener in + if (item.type && item.type !== 'sub' && item.type !== 'html' && item.type !== 'cm_seperator') { + $input + .on('focus', handle.focusInput) + .on('blur', handle.blurInput); + + if (item.events) { + $input.on(item.events, opt); + } + } + + // add icons + if (item.icon) { + if ($.isFunction(item.icon)) { + item._icon = item.icon.call(this, this, $t, key, item); + } else { + if (typeof(item.icon) === 'string' && ( + item.icon.substring(0, 4) === 'fab ' + || item.icon.substring(0, 4) === 'fas ' + || item.icon.substring(0, 4) === 'fad ' + || item.icon.substring(0, 4) === 'far ' + || item.icon.substring(0, 4) === 'fal ') + ) { + // to enable font awesome + $t.addClass(root.classNames.icon + ' ' + root.classNames.icon + '--fa5'); + item._icon = $(''); + } else if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') { + item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon; + } else { + item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon; + } + } + + if(typeof(item._icon) === "string"){ + $t.addClass(item._icon); + } else { + $t.prepend(item._icon); + } + } + } + + // cache contained elements + item.$input = $input; + item.$label = $label; + + // attach item to menu + $t.appendTo(opt.$menu); + + // Disable text selection + if (!opt.hasTypes && $.support.eventSelectstart) { + // browsers support user-select: none, + // IE has a special event for text-selection + // browsers supporting neither will not be preventing text-selection + $t.on('selectstart.disableTextSelect', handle.abortevent); + } + }); + // attach contextMenu to (to bypass any possible overflow:hidden issues on parents of the trigger element) + if (!opt.$node) { + opt.$menu.css('display', 'none').addClass('context-menu-root'); + } + opt.$menu.appendTo(opt.appendTo || document.body); + }, + resize: function ($menu, nested) { + var domMenu; + // determine widths of submenus, as CSS won't grow them automatically + // position:absolute within position:absolute; min-width:100; max-width:200; results in width: 100; + // kinda sucks hard... + + // determine width of absolutely positioned element + $menu.css({position: 'absolute', display: 'block'}); + // don't apply yet, because that would break nested elements' widths + $menu.data('width', + (domMenu = $menu.get(0)).getBoundingClientRect ? + Math.ceil(domMenu.getBoundingClientRect().width) : + $menu.outerWidth() + 1); // outerWidth() returns rounded pixels + // reset styles so they allow nested elements to grow/shrink naturally + $menu.css({ + position: 'static', + minWidth: '0px', + maxWidth: '100000px' + }); + // identify width of nested menus + $menu.find('> li > ul').each(function () { + op.resize($(this), true); + }); + // reset and apply changes in the end because nested + // elements' widths wouldn't be calculatable otherwise + if (!nested) { + $menu.find('ul').addBack().css({ + position: '', + display: '', + minWidth: '', + maxWidth: '' + }).outerWidth(function () { + return $(this).data('width'); + }); + } + }, + update: function (opt, root) { + var $trigger = this; + if (typeof root === 'undefined') { + root = opt; + op.resize(opt.$menu); + } + + var hasVisibleItems = false; + + // re-check disabled for each item + opt.$menu.children().each(function () { + var $item = $(this), + key = $item.data('contextMenuKey'), + item = opt.items[key], + disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true, + visible; + if ($.isFunction(item.visible)) { + visible = item.visible.call($trigger, key, root); + } else if (typeof item.visible !== 'undefined') { + visible = item.visible === true; + } else { + visible = true; + } + + if (visible) { + hasVisibleItems = true; + } + + $item[visible ? 'show' : 'hide'](); + + // dis- / enable item + $item[disabled ? 'addClass' : 'removeClass'](root.classNames.disabled); + + if ($.isFunction(item.icon)) { + $item.removeClass(item._icon); + var iconResult = item.icon.call(this, $trigger, $item, key, item); + if(typeof(iconResult) === "string"){ + $item.addClass(iconResult); + } else { + $item.prepend(iconResult); + } + } + + if (item.type) { + // dis- / enable input elements + $item.find('input, select, textarea').prop('disabled', disabled); + + // update input states + switch (item.type) { + case 'text': + case 'textarea': + item.$input.val(item.value || ''); + break; + + case 'checkbox': + case 'radio': + item.$input.val(item.value || '').prop('checked', !!item.selected); + break; + + case 'select': + item.$input.val((item.selected === 0 ? "0" : item.selected) || ''); + break; + } + } + + if (item.$menu) { + // update sub-menu + var subMenuHasVisibleItems = op.update.call($trigger, item, root); + if (subMenuHasVisibleItems) { + hasVisibleItems = true; + } + } + }); + return hasVisibleItems; + }, + layer: function (opt, zIndex) { + // add transparent layer for click area + // filter and background for Internet Explorer, Issue #23 + var $layer = opt.$layer = $('
      ') + .css({ + height: $win.height(), + width: $win.width(), + display: 'block', + position: 'fixed', + 'z-index': zIndex - 1, + top: 0, + left: 0, + opacity: 0, + filter: 'alpha(opacity=0)', + 'background-color': '#000' + }) + .data('contextMenuRoot', opt) + .appendTo(document.body) + .on('contextmenu', handle.abortevent) + .on('mousedown', handle.layerClick); + + // IE6 doesn't know position:fixed; + if (typeof document.body.style.maxWidth === 'undefined') { // IE6 doesn't support maxWidth + $layer.css({ + 'position': 'absolute', + 'height': $(document).height() + }); + } + + return $layer; + }, + processPromises: function (opt, root, promise) { + // Start + opt.$node.addClass(root.classNames.iconLoadingClass); + + function completedPromise(opt, root, items) { + // Completed promise (dev called promise.resolve). We now have a list of items which can + // be used to create the rest of the context menu. + if (typeof items === 'undefined') { + // Null result, dev should have checked + errorPromise(undefined);//own error object + } + finishPromiseProcess(opt, root, items); + } + + function errorPromise(opt, root, errorItem) { + // User called promise.reject() with an error item, if not, provide own error item. + if (typeof errorItem === 'undefined') { + errorItem = { + "error": { + name: "No items and no error item", + icon: "context-menu-icon context-menu-icon-quit" + } + }; + if (window.console) { + (console.error || console.log).call(console, 'When you reject a promise, provide an "items" object, equal to normal sub-menu items'); + } + } else if (typeof errorItem === 'string') { + errorItem = {"error": {name: errorItem}}; + } + finishPromiseProcess(opt, root, errorItem); + } + + function finishPromiseProcess(opt, root, items) { + if (typeof root.$menu === 'undefined' || !root.$menu.is(':visible')) { + return; + } + opt.$node.removeClass(root.classNames.iconLoadingClass); + opt.items = items; + op.create(opt, root, true); // Create submenu + op.update(opt, root); // Correctly update position if user is already hovered over menu item + root.positionSubmenu.call(opt.$node, opt.$menu); // positionSubmenu, will only do anything if user already hovered over menu item that just got new subitems. + } + + // Wait for promise completion. .then(success, error, notify) (we don't track notify). Bind the opt + // and root to avoid scope problems + promise.then(completedPromise.bind(this, opt, root), errorPromise.bind(this, opt, root)); + }, + // operation that will run after contextMenu showed on screen + activated: function(opt){ + var $menu = opt.$menu; + var $menuOffset = $menu.offset(); + var winHeight = $(window).height(); + var winScrollTop = $(window).scrollTop(); + var menuHeight = $menu.height(); + if(menuHeight > winHeight){ + $menu.css({ + 'height' : winHeight + 'px', + 'overflow-x': 'hidden', + 'overflow-y': 'auto', + 'top': winScrollTop + 'px' + }); + } else if(($menuOffset.top < winScrollTop) || ($menuOffset.top + menuHeight > winScrollTop + winHeight)){ + $menu.css({ + 'top': winScrollTop + 'px' + }); + } + } + }; + + // split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key + function splitAccesskey(val) { + var t = val.split(/\s+/); + var keys = []; + + for (var i = 0, k; k = t[i]; i++) { + k = k.charAt(0).toUpperCase(); // first character only + // theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it. + // a map to look up already used access keys would be nice + keys.push(k); + } + + return keys; + } + +// handle contextMenu triggers + $.fn.contextMenu = function (operation) { + var $t = this, $o = operation; + if (this.length > 0) { // this is not a build on demand menu + if (typeof operation === 'undefined') { + this.first().trigger('contextmenu'); + } else if (typeof operation.x !== 'undefined' && typeof operation.y !== 'undefined') { + this.first().trigger($.Event('contextmenu', { + pageX: operation.x, + pageY: operation.y, + mouseButton: operation.button + })); + } else if (operation === 'hide') { + var $menu = this.first().data('contextMenu') ? this.first().data('contextMenu').$menu : null; + if ($menu) { + $menu.trigger('contextmenu:hide'); + } + } else if (operation === 'destroy') { + $.contextMenu('destroy', {context: this}); + } else if ($.isPlainObject(operation)) { + operation.context = this; + $.contextMenu('create', operation); + } else if (operation) { + this.removeClass('context-menu-disabled'); + } else if (!operation) { + this.addClass('context-menu-disabled'); + } + } else { + $.each(menus, function () { + if (this.selector === $t.selector) { + $o.data = this; + + $.extend($o.data, {trigger: 'demand'}); + } + }); + + handle.contextmenu.call($o.target, $o); + } + + return this; + }; + + // manage contextMenu instances + $.contextMenu = function (operation, options) { + if (typeof operation !== 'string') { + options = operation; + operation = 'create'; + } + + if (typeof options === 'string') { + options = {selector: options}; + } else if (typeof options === 'undefined') { + options = {}; + } + + // merge with default options + var o = $.extend(true, {}, defaults, options || {}); + var $document = $(document); + var $context = $document; + var _hasContext = false; + + if (!o.context || !o.context.length) { + o.context = document; + } else { + // you never know what they throw at you... + $context = $(o.context).first(); + o.context = $context.get(0); + _hasContext = !$(o.context).is(document); + } + + switch (operation) { + + case 'update': + // Updates visibility and such + if(_hasContext){ + op.update($context); + } else { + for(var menu in menus){ + if(menus.hasOwnProperty(menu)){ + op.update(menus[menu]); + } + } + } + break; + + case 'create': + // no selector no joy + if (!o.selector) { + throw new Error('No selector specified'); + } + // make sure internal classes are not bound to + if (o.selector.match(/.context-menu-(list|item|input)($|\s)/)) { + throw new Error('Cannot bind to selector "' + o.selector + '" as it contains a reserved className'); + } + if (!o.build && (!o.items || $.isEmptyObject(o.items))) { + throw new Error('No Items specified'); + } + counter++; + o.ns = '.contextMenu' + counter; + if (!_hasContext) { + namespaces[o.selector] = o.ns; + } + menus[o.ns] = o; + + // default to right click + if (!o.trigger) { + o.trigger = 'right'; + } + + if (!initialized) { + var itemClick = o.itemClickEvent === 'click' ? 'click.contextMenu' : 'mouseup.contextMenu'; + var contextMenuItemObj = { + // 'mouseup.contextMenu': handle.itemClick, + // 'click.contextMenu': handle.itemClick, + 'contextmenu:focus.contextMenu': handle.focusItem, + 'contextmenu:blur.contextMenu': handle.blurItem, + 'contextmenu.contextMenu': handle.abortevent, + 'mouseenter.contextMenu': handle.itemMouseenter, + 'mouseleave.contextMenu': handle.itemMouseleave + }; + contextMenuItemObj[itemClick] = handle.itemClick; + // make sure item click is registered first + $document + .on({ + 'contextmenu:hide.contextMenu': handle.hideMenu, + 'prevcommand.contextMenu': handle.prevItem, + 'nextcommand.contextMenu': handle.nextItem, + 'contextmenu.contextMenu': handle.abortevent, + 'mouseenter.contextMenu': handle.menuMouseenter, + 'mouseleave.contextMenu': handle.menuMouseleave + }, '.context-menu-list') + .on('mouseup.contextMenu', '.context-menu-input', handle.inputClick) + .on(contextMenuItemObj, '.context-menu-item'); + + initialized = true; + } + + // engage native contextmenu event + $context + .on('contextmenu' + o.ns, o.selector, o, handle.contextmenu); + + if (_hasContext) { + // add remove hook, just in case + $context.on('remove' + o.ns, function () { + $(this).contextMenu('destroy'); + }); + } + + switch (o.trigger) { + case 'hover': + $context + .on('mouseenter' + o.ns, o.selector, o, handle.mouseenter) + .on('mouseleave' + o.ns, o.selector, o, handle.mouseleave); + break; + + case 'left': + $context.on('click' + o.ns, o.selector, o, handle.click); + break; + case 'touchstart': + $context.on('touchstart' + o.ns, o.selector, o, handle.click); + break; + /* + default: + // http://www.quirksmode.org/dom/events/contextmenu.html + $document + .on('mousedown' + o.ns, o.selector, o, handle.mousedown) + .on('mouseup' + o.ns, o.selector, o, handle.mouseup); + break; + */ + } + + // create menu + if (!o.build) { + op.create(o); + } + break; + + case 'destroy': + var $visibleMenu; + if (_hasContext) { + // get proper options + var context = o.context; + $.each(menus, function (ns, o) { + + if (!o) { + return true; + } + + // Is this menu equest to the context called from + if (!$(context).is(o.selector)) { + return true; + } + + $visibleMenu = $('.context-menu-list').filter(':visible'); + if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is($(o.context).find(o.selector))) { + $visibleMenu.trigger('contextmenu:hide', {force: true}); + } + + try { + if (menus[o.ns].$menu) { + menus[o.ns].$menu.remove(); + } + + delete menus[o.ns]; + } catch (e) { + menus[o.ns] = null; + } + + $(o.context).off(o.ns); + + return true; + }); + } else if (!o.selector) { + $document.off('.contextMenu .contextMenuAutoHide'); + $.each(menus, function (ns, o) { + $(o.context).off(o.ns); + }); + + namespaces = {}; + menus = {}; + counter = 0; + initialized = false; + + $('#context-menu-layer, .context-menu-list').remove(); + } else if (namespaces[o.selector]) { + $visibleMenu = $('.context-menu-list').filter(':visible'); + if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) { + $visibleMenu.trigger('contextmenu:hide', {force: true}); + } + + try { + if (menus[namespaces[o.selector]].$menu) { + menus[namespaces[o.selector]].$menu.remove(); + } + + delete menus[namespaces[o.selector]]; + } catch (e) { + menus[namespaces[o.selector]] = null; + } + + $document.off(namespaces[o.selector]); + } + break; + + case 'html5': + // if and are not handled by the browser, + // or options was a bool true, + // initialize $.contextMenu for them + if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options === 'boolean' && options)) { + $('menu[type="context"]').each(function () { + if (this.id) { + $.contextMenu({ + selector: '[contextmenu=' + this.id + ']', + items: $.contextMenu.fromMenu(this) + }); + } + }).css('display', 'none'); + } + break; + + default: + throw new Error('Unknown operation "' + operation + '"'); + } + + return this; + }; + +// import values into commands + $.contextMenu.setInputValues = function (opt, data) { + if (typeof data === 'undefined') { + data = {}; + } + + $.each(opt.inputs, function (key, item) { + switch (item.type) { + case 'text': + case 'textarea': + item.value = data[key] || ''; + break; + + case 'checkbox': + item.selected = data[key] ? true : false; + break; + + case 'radio': + item.selected = (data[item.radio] || '') === item.value; + break; + + case 'select': + item.selected = data[key] || ''; + break; + } + }); + }; + +// export values from commands + $.contextMenu.getInputValues = function (opt, data) { + if (typeof data === 'undefined') { + data = {}; + } + + $.each(opt.inputs, function (key, item) { + switch (item.type) { + case 'text': + case 'textarea': + case 'select': + data[key] = item.$input.val(); + break; + + case 'checkbox': + data[key] = item.$input.prop('checked'); + break; + + case 'radio': + if (item.$input.prop('checked')) { + data[item.radio] = item.value; + } + break; + } + }); + + return data; + }; + +// find