Looking for a c# class or similar that can parse or convert wiki-formated text to html or similar.
Specs are here:
http://www.mediawiki.org/wiki/Markup_spec
Thanks.
According to this post, you can rip apart the parse helper class from ScrewTurn Wiki
Maybe you are looking for this (Wiki .NET Parser).
Also, you can look an example of parsing on this article.
Related
I need your help to know about javadoc in asp.net, does exist any javadoc equivalent for .net (asp.net mvc 4)?. I know about ///summary but I don't know if this comments can be exported to xml or html.
Take a look at this answer on how to enable XML documentation directly on VS:
How to generate documentation out of code comments
Have you looked into GhostDoc?
http://submain.com/products/ghostdoc.aspx
We have a C# project which for historical reasons uses both Doxygen and Visual Studio style comments in the same code.
Has anyone tried to systematically translate one standard to another, preferably to the common XML subset?
I guess it would not be too difficult to write a script to cover the most common features,
but I would not like to reinvent the wheel.
I had the same question, found these answers in 2022, maybe it can help someone:
Atomineer Pro can convert between existing and your configured format
Doxygen to XML converter self-describing as quick and dirty Python tool
Is there an equivalent of PHP's highlight_string function in C#?
It is not necessary to be a built-in function.
Edit: If not is there a good library for that?
Edit2: I really need a server side solution for that like PHP does.
There is nothing in the framework that will give you the coloured output. You will have to use a library to do this.
C# Code Format was one of the first .Net ones to come up in Google, although it only supports highlighting of C#, VB, HTML, XML, T-SQL or Monad. It is capable of running server side though as it is written in C#. If you need it to format PHP, then it is probably quite simple to extend it to do so - just make a custom PHPFormat class.
You can build yourself a basic syntax highlighter easy using RegExp.
Here's an example:
Syntax Highlight in C#
Or if you want a html C# highlighter written in C#
C# Syntax Highlighter 2.0
Or a JS highlighter:
highlight.js
Nope, certainly not in the Framework itself. You'd have to look for libraries that support this.
If you want it for webpages (which I assume, since the PHP highlight function formats it as HTML) you can use Googles Code prettify. It's however a javascript, which on the other hand makes it code-behind language independent.
I'm using it at my site with great success :-)
You can find it here: http://code.google.com/p/google-code-prettify/
I recently wrote a SQL formatting library (Poor Man's T-SQL Formatter library) in C# (.Net 2.0) which, among the available options, supports just coloring the output (with html span tags).
It's available online for testing at http://poorsql.com, and here's a link that already sets the options to "just colorize" so you can test/play:
http://poorsql.com/?reFormat=false
I am currently looking into writing a fast deesrialisation/parsing of a custom message format which are similar to BNF syntax. There are maybe 50 different objects involved.
The grammar of the objects contains a recursive definition which is the biggest problem for me at the moment.
Do you know any good examples or would you write your own lexer using regular expressions and parsing them using a FIFO queue for the embedded messages?
In Perl I am at the moment converting the messages into JSON messages and use a generic parser, but I am not so sure if this makes sense on C#.
Messages look like this:
"{key1=value1|key2={key3=value3}}".
The following URL shows examples of serialization/deserialization of JSON in C# by Scott Gu and the .NET 3.5 Framework:
http://weblogs.asp.net/scottgu/archive/2007/10/01/tip-trick-building-a-tojson-extension-method-using-net-3-5.aspx
Right before the summary you will find this sentence:
Note: In addition to the
JavaScriptSerializer class, .NET 3.5
also now includes a new
System.Runtime.Serialization.DataContractJsonSerializer
class that you can use for JSON
serialization/deserialization.
Hope this helps:
Andrew
This must be a classic .NET question for anyone migrating from Java.
.NET does not seem to have a direct equivalent to java.io.StreamTokenizer, however the JLCA provides a SupportClass that attempts to implement it. I believe the JLCA also provides a Tokenizer SupportClass that takes a String as the source, which I thought a StreamTokenizer would be derived from, but isn't.
What is the preferred way to Tokenize both a Stream and a String? or is there one? How are streams tokenized in .Net? I'd like to have the flexibility that java.io.StreamTokenizer provides. Any thoughts?
There isn't anything in .NET that is completely equivalent to StreamTokenizer. For simple cases, you can use String.Split(), but for more advanced token parsing, you'll probably end up using System.Text.RegularExpressions.Regex.
Use System.String.Split if you need to split a string based on a collection
of specific characters.
Use System.Text.RegularExpressions.RegEx.Split to split based
on matching patterns.
There's a tokenizer in the Nextem library -- you can see an example here: http://trac.assembla.com/nextem/browser/trunk/Examples/Parsing.n
It's implemented as a Nemerle macro, but you can write this and then use it from C# easily.
I don't think so, for very simple tokenizing have a look at System.String.Split().
More complex tokenizing can be achieved by System.Text.RegularExpressions.Regex.
We had the same problem of finding a StreamTokenizer equivalent when porting tuProlog from Java to C#. We ended up writing what as far as I know is a straight conversion of StreamTokenizer which takes a TextReader as a "stream" for input purposes. You will find the code in the download for tuProlog.NET 2.1 (LGPL-licensed) so feel free to reuse and adapt it to your needs.
To tokenize a string, use string.Split(...).