plugin:chem
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:chem [2010-04-04 22:22] – 124.214.174.221 | plugin:chem [2023-10-30 23:38] (current) – Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Chem plugin | + | ====== Chem Plugin |
---- plugin ---- | ---- plugin ---- | ||
Line 6: | Line 6: | ||
email : i.obataya@gmail.com | email : i.obataya@gmail.com | ||
type : syntax | type : syntax | ||
- | lastupdate : 2008-09-29 | + | lastupdate : 2017-10-19 |
- | compatible : 2006/11/06 or later | + | compatible : Frusterick Manners, Greebo, Hogfather, Igor |
depends | depends | ||
conflicts | conflicts | ||
similar | similar | ||
tags : formula chemistry science | tags : formula chemistry science | ||
+ | |||
+ | downloadurl: | ||
+ | sourcerepo : https:// | ||
---- | ---- | ||
- | |||
- | [[http:// | ||
- | |||
- | ^ ZIP file ^ | ||
- | |{{http:// | ||
This DokuWiki plugin formats a molecular formula easily. | This DokuWiki plugin formats a molecular formula easily. | ||
Line 27: | Line 25: | ||
The latest version supports to export Open Document format using [[plugin: | The latest version supports to export Open Document format using [[plugin: | ||
- | =====Examples===== | + | ===== Examples ===== |
- | C< | + | |
- | < | + | |
- | Na< | + | | C< |
- | <code>< | + | | |
+ | | C<sub>2</ | ||
+ | | Cl< | ||
+ | | Al< | ||
- | C< | + | ====== |
- | < | + | |
- | + | ||
- | Cl< | + | |
- | < | + | |
- | + | ||
- | Al< | + | |
- | < | + | |
- | + | ||
- | ====== | + | |
The original plugin works very fine. | The original plugin works very fine. | ||
- | For those of you who have to write more chemical formulars and have some extra wishes like easyer | + | For those of you who have to write more chemical formulars and have some extra wishes like easier |
__Syntax__: < | __Syntax__: < | ||
- | __Unfortunatelly | + | __Unfortunately |
- | * Due to many preg_matches the entering and leaving of DW-editmenu takes quite long | + | * Due to many preg_matches the entering and leaving of DokuWiki |
- | * :!: ODT-Support | + | * :!: ODT-Support |
* :!: if you use ions and have multiple elements the shifting breaks as I just optimized it for one digit. (May someone could give me a hand here) | * :!: if you use ions and have multiple elements the shifting breaks as I just optimized it for one digit. (May someone could give me a hand here) | ||
- | __syntax.php__: | + | >I'll work on it soon (in Apr, maybe ;-) --- //[[ikuo_obataya@symplus.co.jp|iobataya]] 2010/04/04 22:23// |
- | <code php> | + | |
- | <?php | + | |
- | /* | + | |
- | description : Plugin Chem: formatting chemical format | + | |
- | author | + | |
- | email : ikuo_obataya@symplus.co.jp | + | |
- | lastupdate | + | |
- | license | + | |
- | */ | + | |
- | if(!defined('DOKU_INC' | + | |
- | if(!defined(' | + | |
- | require_once(DOKU_PLUGIN.' | + | |
- | class syntax_plugin_chem extends DokuWiki_Syntax_Plugin { | + | |
- | function getInfo(){ | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | function getType(){ return ' | + | >>I'd like to apply a new syntax for notation of isotopes in order to simplify either the DW syntax and the regular expressions. |
- | function getAllowedTypes() { return array(' | + | |
- | function getSort(){ return 158; } | + | |
- | function connectTo($mode) { $this->Lexer->addEntryPattern('< | + | |
- | function postConnect() { $this-> | + | |
- | + | ||
- | function handle($match, | + | |
- | switch ($state) { | + | |
- | case DOKU_LEXER_ENTER | + | |
- | case DOKU_LEXER_UNMATCHED :return array($state, | + | |
- | case DOKU_LEXER_EXIT | + | |
- | } | + | |
- | return array(); | + | |
- | } | + | |
- | | + | |
- | if($mode == ' | + | *Put on _ before atomic number within a <chem> element. (-> subscript) |
- | list($state, | + | < |
- | switch ($state) { | + | #EXAMPLE |
- | case DOKU_LEXER_ENTER: | + | ^14_6C |
- | case DOKU_LEXER_UNMATCHED: | + | ^235_92U |
- | if($mode==' | + | </code> |
- | // xhtml | + | What do you think ? |
- | $renderer->doc .= $this->getChemFormat($match); | + | --- //iobataya 2010/04/21 05:45// |
- | } | + | |
- | if($mode == ' | + | |
- | // Open document format | + | |
- | $renderer->doc.= $this->getOdtChemFormat($match); | + | |
- | } | + | |
- | | + | |
- | | + | |
- | } | + | |
- | return true; | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | | + | |
- | "/ | + | |
- | "/ | + | |
- | "/ | + | |
- | " | + | |
- | + | ||
- | "/ | + | |
- | "/ | + | |
- | " | + | |
- | "/ | + | My server moved to new place. |
- | "/ | + | |
- | "/ | + | |
- | $replace = array( " | + | |
- | " | + | |
- | " | + | |
- | "< | + | |
- | "< | + | |
- | + | ||
- | "< | + | |
- | "< | + | |
- | "< | + | |
- | "< | ||
- | " | ||
- | "& | ||
- | return preg_replace($pattern, | ||
- | } | ||
+ | Source code was moved to GitHub | ||
- | function getOdtChemFormat($raw){ | + | SS 2015-12-13: Doesn' |
- | $c = $this-> | + | |
- | $pattern = array( "/< | + | |
- | "/< | + | |
- | $replace = array( "< | + | |
- | "< | + | |
- | return preg_replace($pattern, | + | |
- | } | + | |
- | + | ||
- | + | ||
- | } | + | |
- | ?> | + | |
- | </ | + | |
+ | This tool is simply great! Love it:) Just a small suggestion, can we have a button in the toolbar in forum posts? I mean a small button in the toolbar with italic/ | ||
+ | >Now you can find a benzene button in a tool bar ;-) | ||
+ | >Clear cache of web browser after update the plugin. Cache of javascripts are sticky. | ||
+ | > --- [[user> |
plugin/chem.1270412534.txt.gz · Last modified: 2010-04-04 22:22 by 124.214.174.221