Raimond Spekking has submitted this change and it was merged. Change subject: Indent with spaces and update version string. ......................................................................
Indent with spaces and update version string. According to https://www.mediawiki.org/wiki/Manual:Coding_conventions, fix following files. * QuickGV.php * QuickGV.i18n.php * QuickGV.template.php Bug: T133633 Change-Id: Iaf56644e1d9538d9cea4b667ad811e272446cbb8 --- M QuickGV.i18n.php M QuickGV.php M QuickGV.template.php 3 files changed, 167 insertions(+), 163 deletions(-) Approvals: Raimond Spekking: Verified; Looks good to me, approved diff --git a/QuickGV.i18n.php b/QuickGV.i18n.php index 1271004..6592f8d 100644 --- a/QuickGV.i18n.php +++ b/QuickGV.i18n.php @@ -2,31 +2,31 @@ $messages = array(); $messages['en'] = array( - 'quickgv-desc' => 'A little tool to create digraph', - 'filepath' => 'File Path', - 'filesize' => 'File Size', - 'filemtime' => 'Last modified', - 'md5sum' => 'MD5 Summary', - 'exectime' => 'Execution Time', - 'seconds' => 'second(s)', - 'graphviz-path' => 'Graphviz Path', - 'graphviz-ver' => 'Graphviz Version', - 'graphviz-ref' => 'Reference', - 'quickgv-ver' => 'QuickGV Version', - 'quickgv-about' => 'About QuickGV', + 'quickgv-desc' => 'Build flowchart, mindmap and ram description quickly.', + 'filepath' => 'File Path', + 'filesize' => 'File Size', + 'filemtime' => 'Last modified', + 'md5sum' => 'MD5 Summary', + 'exectime' => 'Execution Time', + 'seconds' => 'second(s)', + 'graphviz-path' => 'Graphviz Path', + 'graphviz-ver' => 'Graphviz Version', + 'graphviz-ref' => 'Reference', + 'quickgv-ver' => 'QuickGV Version', + 'quickgv-about' => 'About QuickGV', ); $messages['zh-hant'] = array( - 'quickgv-desc' => '有向圖小工具', - 'filepath' => '檔案路徑', - 'filesize' => '檔案大小', - 'filemtime' => '檔案更新時間', - 'md5sum' => 'MD5 摘要', - 'exectime' => '轉圖時間', - 'seconds' => '秒', - 'graphviz-path' => 'Graphviz 路徑', - 'graphviz-ver' => 'Graphviz 版本', - 'graphviz-ref' => '參考文件', - 'quickgv-ver' => 'QuickGV 版本', - 'quickgv-about' => '關於 QuickGV', + 'quickgv-desc' => '快速製作流程圖、心智圖、記憶體描述的小工具。', + 'filepath' => '檔案路徑', + 'filesize' => '檔案大小', + 'filemtime' => '檔案更新時間', + 'md5sum' => 'MD5 摘要', + 'exectime' => '轉圖時間', + 'seconds' => '秒', + 'graphviz-path' => 'Graphviz 路徑', + 'graphviz-ver' => 'Graphviz 版本', + 'graphviz-ref' => '參考文件', + 'quickgv-ver' => 'QuickGV 版本', + 'quickgv-about' => '關於 QuickGV', ); diff --git a/QuickGV.php b/QuickGV.php index 8fb48a1..9c3d7b6 100644 --- a/QuickGV.php +++ b/QuickGV.php @@ -1,13 +1,13 @@ <?php $wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'QuickGV', - 'author' => '[https://github.com/virus-warnning Raymond Wu]', - 'url' => 'https://www.mediawiki.org/wiki/Extension:QuickGV', - 'descriptionmsg' => 'quickgv-desc', - 'version' => '0.2.3', + 'path' => __FILE__, + 'name' => 'QuickGV', + 'author' => '[https://github.com/virus-warnning 吳政璋]', + 'url' => 'https://www.mediawiki.org/wiki/Extension:QuickGV', + 'descriptionmsg' => 'quickgv-desc', + 'version' => '0.2.4', ); -$wgAutoloadClasses['QuickGV'] = __DIR__ . '/QuickGV.body.php'; +$wgAutoloadClasses['QuickGV'] = __DIR__ . '/QuickGV.body.php'; $wgExtensionMessagesFiles['QuickGV'] = __DIR__ . '/QuickGV.i18n.php'; -$wgHooks['ParserFirstCallInit'][] = 'QuickGV::init'; +$wgHooks['ParserFirstCallInit'][] = 'QuickGV::init'; diff --git a/QuickGV.template.php b/QuickGV.template.php index 69c3b77..7204ba7 100644 --- a/QuickGV.template.php +++ b/QuickGV.template.php @@ -3,175 +3,179 @@ * Template of graph description (dot syntax) *************************************************/ -// theme definitions +// Theme definitions $THEME_ATTRS = array( - 'cold' => array( - 'graph_bg' => '#555566', - 'graph_label' => '#ffffff', - 'graph_border' => '#ffffff', - 'edge_path' => '#ffffff', - 'edge_font' => '#ffffff', - 'node_border' => '#ffffff', - 'node_font' => '#000000', - 'node_fill' => '#ccffff:#00c0ff' - ), - 'warm' => array( - 'graph_bg' => '#fffff7', - 'graph_label' => '#000000', - 'graph_border' => '#804000', - 'edge_path' => '#704000', - 'edge_font' => '#704000', - 'node_border' => '#c07000', - 'node_font' => '#000000', - 'node_fill' => '#ffffff:#ffffc0' - ), - 'sakura' => array( - 'graph_bg' => '#996677', - 'graph_label' => '#ffffff', - 'graph_border' => '#ffffff', - 'edge_path' => '#ffffff', - 'edge_font' => '#ffffff', - 'node_border' => '#cc4444', - 'node_font' => '#000000', - 'node_fill' => '#ffffff:#ffc0d0' - ), - 'default' => array( - 'graph_bg' => '#f0f0f0:#ffffff', - 'graph_label' => '#000000', - 'graph_border' => '#555555', - 'edge_path' => '#555555', - 'edge_font' => '#000000', - 'node_border' => '#aaaaaa', - 'node_font' => '#000000', - 'node_fill' => '#ffffff:#e7e7e7' - ), + 'cold' => array( + 'graph_bg' => '#555566', + 'graph_label' => '#ffffff', + 'graph_border' => '#ffffff', + 'edge_path' => '#ffffff', + 'edge_font' => '#ffffff', + 'node_border' => '#ffffff', + 'node_font' => '#000000', + 'node_fill' => '#ccffff:#00c0ff' + ), + 'warm' => array( + 'graph_bg' => '#fffff7', + 'graph_label' => '#000000', + 'graph_border' => '#804000', + 'edge_path' => '#704000', + 'edge_font' => '#704000', + 'node_border' => '#c07000', + 'node_font' => '#000000', + 'node_fill' => '#ffffff:#ffffc0' + ), + 'sakura' => array( + 'graph_bg' => '#996677', + 'graph_label' => '#ffffff', + 'graph_border' => '#ffffff', + 'edge_path' => '#ffffff', + 'edge_font' => '#ffffff', + 'node_border' => '#cc4444', + 'node_font' => '#000000', + 'node_fill' => '#ffffff:#ffc0d0' + ), + 'default' => array( + 'graph_bg' => '#f0f0f0:#ffffff', + 'graph_label' => '#000000', + 'graph_border' => '#555555', + 'edge_path' => '#555555', + 'edge_font' => '#000000', + 'node_border' => '#aaaaaa', + 'node_font' => '#000000', + 'node_fill' => '#ffffff:#e7e7e7' + ), ); /** * Get shell argument. If not exists, use default instead. * * @since 0.2.0 + * @param $rank rank of arguments + * @param $default_value default for this argument + * @return If the argument exists return it, otherwise return default. */ -function shell_arg($rank, $default_value='') { - global $argv; +function shell_arg($rank, $default_value='') +{ + global $argv; - if (isset($argv[$rank])) { - $v = trim($argv[$rank]); - if ($v!=='') return $v; - } + if (isset($argv[$rank])) { + $v = trim($argv[$rank]); + if ( $v !== '' ) return $v; + } - return $default_value; + return $default_value; } -// get graph name & theme name +// Get graph name & theme name $gname = shell_arg(1, 'G'); $theme = shell_arg(2, 'default'); $usage = shell_arg(3); -// replace the alias of usage -if ($usage==='er' || $usage==='ram') $usage = 'record'; -if ($usage==='mindmap') $usage = 'neato'; +// Replace the alias of usage +if ( $usage === 'er' || $usage === 'ram' ) $usage = 'record'; +if ( $usage === 'mindmap' ) $usage = 'neato'; -// get graph description +// Get graph description $gdata = trim(file_get_contents('php://stdin')); -if (!isset($THEME_ATTRS[$theme])) $theme = 'default'; -if ($gdata==='') $theme = 'warm'; +if ( !isset($THEME_ATTRS[$theme]) ) $theme = 'default'; +if ( $gdata === '' ) $theme = 'warm'; $attrs =& $THEME_ATTRS[$theme]; ?> digraph <?php echo $gname; ?> { - // options - // theme = <?php echo "$theme\n"; ?> - // usage = <?php echo "$usage\n"; ?> + // Options + // theme = <?php echo "$theme\n"; ?> + // usage = <?php echo "$usage\n"; ?> - // default settings of graphs - graph [ - rankdir = LR, - color = "<?php echo $attrs['graph_border']; ?>", - bgcolor = "<?php echo $attrs['graph_bg']; ?>", - fontcolor = "<?php echo $attrs['graph_label']; ?>", - fontsize = 12, - style = dashed, - gradientangle = 65, + // default settings of graphs + graph [ + rankdir = LR, + color = "<?php echo $attrs['graph_border']; ?>", + bgcolor = "<?php echo $attrs['graph_bg']; ?>", + fontcolor = "<?php echo $attrs['graph_label']; ?>", + fontsize = 12, + style = dashed, + gradientangle = 65, - <?php if ($usage==''): ?> - splines = ortho, - <?php endif; ?> + <?php if ( $usage == '' ) : ?> + splines = ortho, + <?php endif; ?> - <?php if ($usage=='neato'): ?> - splines = curved, - layout = neato, - start = "A", - <?php endif; ?> + <?php if ( $usage == 'neato' ) : ?> + splines = curved, + layout = neato, + start = "A", + <?php endif; ?> - <?php if ($usage==='record'): ?> - // * ortho, curved are bad - // * polyline acts as line - // * spline (default) is ok - splines = spline, - <?php endif; ?> - ]; + <?php if ( $usage === 'record' ) : ?> + // * ortho, curved are bad + // * polyline acts as line + // * spline (default) is ok + splines = spline, + <?php endif; ?> + ]; - // default settings of nodes - node [ - <?php if ($usage==='record'): ?> - shape = record, - style = filled, - labelloc = l, - <?php else: ?> - shape = box, - style = "filled,rounded", - <?php endif; ?> + // default settings of nodes + node [ + <?php if ( $usage === 'record' ) : ?> + shape = record, + style = filled, + labelloc = l, + <?php else: ?> + shape = box, + style = "filled,rounded", + <?php endif; ?> - height = 0.3, - fontsize = 10, - - // theme - color = "<?php echo $attrs['node_border']; ?>", - fontcolor = "<?php echo $attrs['node_font']; ?>", - fillcolor = "<?php echo $attrs['node_fill']; ?>", - gradientangle = 295 // left, top -> right, bottom - ]; + height = 0.3, + fontsize = 10, - // default settings of edges - edge [ - color = "<?php echo $attrs['edge_path']; ?>", - fontcolor = "<?php echo $attrs['edge_font']; ?>", - fontsize = 10, - arrowsize = 0.6 - ]; + // theme + color = "<?php echo $attrs['node_border']; ?>", + fontcolor = "<?php echo $attrs['node_font']; ?>", + fillcolor = "<?php echo $attrs['node_fill']; ?>", + gradientangle = 295 // left, top -> right, bottom + ]; - <?php if ($gdata===''): ?> + // default settings of edges + edge [ + color = "<?php echo $attrs['edge_path']; ?>", + fontcolor = "<?php echo $attrs['edge_font']; ?>", + fontsize = 10, + arrowsize = 0.6 + ]; - //-------------------------- - // default graph ---- begin - //-------------------------- + <?php if ( $gdata === '' ) : ?> - graph [rankdir=TB]; + //-------------------------- + // default graph ---- begin + //-------------------------- - A [label="Can it work?"]; - B [label="Did you touch it?"]; - C [label="Does anybody know that?"]; - Z1 [label="It's OK! Don't touch it."]; - Z2 [label="Oh! You are such a fool."]; + graph [rankdir=TB]; - A -> Z1 [label="Yes"]; - A -> B [label="No"]; - B -> Z1 [label="No"]; - B -> C [label="Yes"]; - C -> Z1 [label="No"]; - C -> Z2 [label="Yes"]; + A [label="Can it work?"]; + B [label="Did you touch it?"]; + C [label="Does anybody know that?"]; + Z1 [label="It's OK! Don't touch it."]; + Z2 [label="Oh! You are such a fool."]; - //-------------------------- - // default graph ---- end - //-------------------------- + A -> Z1 [label="Yes"]; + A -> B [label="No"]; + B -> Z1 [label="No"]; + B -> C [label="Yes"]; + C -> Z1 [label="No"]; + C -> Z2 [label="Yes"]; - <?php else: ?> + //-------------------------- + // default graph ---- end + //-------------------------- - // nodes, edges, and clusters - <?php echo $gdata; ?> + <?php else: ?> - <?php endif; ?> + // nodes, edges, and clusters + <?php echo $gdata; ?> + + <?php endif; ?> } -- To view, visit https://gerrit.wikimedia.org/r/285143 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaf56644e1d9538d9cea4b667ad811e272446cbb8 Gerrit-PatchSet: 11 Gerrit-Project: mediawiki/extensions/QuickGV Gerrit-Branch: master Gerrit-Owner: 小璋丸 <virus.warnn...@gmail.com> Gerrit-Reviewer: Aklapper <aklap...@wikimedia.org> Gerrit-Reviewer: Gage <jger...@wikimedia.org> Gerrit-Reviewer: Raimond Spekking <raimond.spekk...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits