Beautifier-Talk
This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.
Comments
- In php 5.3, the function call_user_method is deprecated.
- You should change line 564 in
$FarmD
/cookbook/beautifier/php/Beautifier/Core.php to read:
- You should change line 564 in
$code = call_user_func(array(&$this->highlightfile, $this->highlightfile->linkscripts{$category}), $oldword, $this->output_module)
-Ryan (1/5/13) this is not my work, I found this via Google search posted by another PmWiki user
- Thanks Pm for this port, I really appreciate, however ;) There's a slight bug that needs fixing in beautifier.php the code Markup("^=beaut_$lang", "block", "/^=$language\\s+$KeepToken(\\d.*?)$KeepToken/e", "'<:block,1>'.do_beautify('$language', '$1')");
- Should be:
Markup("^=beaut_$language", "block", "/^=$language\\s+$KeepToken(\\d.*?)$KeepToken/e", "'<:block,1>'.do_beautify('$language', '$1')");
Note the first string has changed, this allows multiple languages to co-exist on the wiki and be beautified independently, this is obviously a typo and not your intention <g> JJ?
- Chinese note in the code can't be display correctly.
--~LiGuang
- Is there a reason why the colors (or colours) from the language configuration file aren't used? It looks like all the values are hard coded in
./cookbook/beautifier/php/Output/Output_HTML.php
. -Kurt Devlin December 21, 2005, at 01:39 PM
Auto-indenting doesn't work very well. If you want to disable it, comment out the following lines in core.php:
=php3 // Strip leading and trailing spaces if ($this->highlightfile->notrim==0) $line = trim($line);
and
=php3 // Print out the current indent. $sw = $this->_starts_with($lineorig, $this->highlightfile->unindent); if ($lineorig != "") { if ($this->context->ind>0 && $sw!="") { $lineout = str_repeat(" ", ($this->context->ind-1)); } else { $lineout = str_repeat(" ", $this->context->ind); } }
--thom
I've found that I can get something similar to the old Cookbook-V1/TextArea effect by slightly modifying beautifier.php.
I change this section:
=php3 $results = "<pre class='sourcecode'>" . $h1->highlight_text($code) . '</pre>';
to this:
=php3 $results = "<textarea cols='60' rows='20' wrap='no'>" . $h1->highlight_text($code) . '</textarea>';
and bingo. Text areas for all code samples. Of course, a downside is that the highlighting is lost. Is there somewhere better for me to implement this? --olivera?
overflow: auto
", and use border colors to give the text area effect.
Here are the default HTML colours converted to CSS, they might be useful for anyone using $BeautifierOutputType='css':
span.linecomment, span.blockcomment {
color: green;
}
span.prepro {
color: purple;
}
span.select {
color: red;
}
span.quote, span.category_1, span.category_2, span.category_3 {
color: blue;
}
--Adam
Sandbox
=php3 <?php if (!@$pagename) { $pagename = 'PmWiki.PmWiki'; if (substr($_SERVER['HTTP_HOST'],-11,11) == 'michaud.com') $pagename = 'Pm.HomePage'; } include_once('scripts/compat1x.php'); #ConvertV1WikiD("wiki-1.d"); UseV1WikiD("wiki-1.d"); $ScriptUrl = "http://{$_SERVER['HTTP_HOST']}/wiki"; $PubDirUrl = '/pmwiki/pub'; include_once('scripts/urlapprove.php'); $UnapprovedLinkFmt = "\$LinkText<a class='apprlink' href='\$PageUrl?action=approvesites'>$[(approve links)]</a>"; ?>
=csharp // C++ source code test #include <iostream> struct ShowCpp : public std::unary_function<void,std::string> { public: typedef std::unary_function<void,std::string> BaseClass; void operator ()(const std::string& words) { std::cout << words << std::endl; } };
=csharp //C# source code test private void go_button(object sender, System.EventArgs e) { System.Object nullObject = 0; string str = ""; System.Object nullObjStr = str; Cursor.Current = Cursors.WaitCursor; axWebBrowser1.Navigate(textBox1.Text, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr); Cursor.Current = Cursors.Default; }
=javascript // Java source code test private String doIt(Object sender, x.y.z.Rototo o) throws HibernateException { Collection c = new ArrayList(); String res = ""; for (Iterator i = c.iterator() ; i.hasNext(); ) { res += i.hasNext(); } return res; }
=xml //<this> <is> <a id="toto"/> <test> <nonsense/> </test> </is> </this>
=lua -- lua source code goes here
=php3 <?php phpinfo(); ?>
=csharp #include <stdio.h> int main() { printf("hello,world\n"); }
Talk page for the Beautifier recipe (users?).