Token.Literal.String.Regexp

XWiki.org JIRA | Thomas Mortagne | 6 years ago
  1. 0

    To reproduce use: {code} {{code}} ################################################################################################## ## This is a dirty, ugly hack. it does the job, but its probably very inefficient and unstable. ## ################################################################################################## ## The following is a set of scripts which allow you to display a list of publications from ## ## bibsonomy. This list is retrieved from the RSS feed of a tag. There's no option to limit the ## ## list to a specific user, etc. The easiest way to use this is to add the following two lines ## ## to your page: ## ## #includeInContext("scripts.Bibsonomy") ## ## #publications_pp("MyTag") ## ################################################################################################## ## to make this code decent, we should use the bibsnomy API, retrieve the list in XML and ## ## process that, probably in groovy. ## ################################################################################################## ## This code is provided as is, with no warranties, guaranties, or liabilities. ## ## It is licensed under a Creative Commons BY-NC-SA 2.0 UK: England & Wales License. ## ## http://creativecommons.org/licenses/by-nc-sa/2.0/uk/ ## ## Yishay Mor, yishaym@gmail.com ## ################################################################################################## #set ($basename = $doc.getFullName()+".") #set ($createUrl = "?create=") #### create a new discussion page for bibsonomy entry #macro(createPage $item $pagename) #set ($newdoc = $xwiki.getDocument($pagename)) $newdoc.setParent($doc.getFullName()) #set ($content = '<div style="border: 3px coral solid;">'+$item.getDescription().value+'</div>') $newdoc.setContent($content) $newdoc.save() ## this should work, but needs programming rights: ## $context.setDoc($newdoc) <script type="text/javascript"> <!-- window.location = "$newdoc.getExternalURL()" //--> </script> #end ### createPage #### display a bibsonomy tag feed #macro(bibsonomyfeed $feed $label $raw) #if ($label) <h3> $label </h3> #end #foreach ($entry in $feed.entries) $entry.getDescription().value <br /> #if(0) #set($val = $entry.getDescription().value) #if(!$raw) ## get title #set($index = $val.indexOf("bmtitle") +10) #set($val = $val.substring($index)) #set($index = $val.indexOf("</div>")) #set($headline = $val.substring(0, $index)) #set($index = $index +6) #set($val = $val.substring($index)) ---- <h4> $headline </h4> ## xtract bibsonomy key #set ($index = $headline.indexOf("/bibtex/") + 8) #if ($index <0) #set($index = 0) <!-- /bibtex/ --> #end #set ($bibkey = $headline.substring($index)) #set ($index = $bibkey.indexOf("/")) #if ($index <0) #set($index = 0) <!-- / --> #end #set ($bibkey = $bibkey.substring(0, $index)) ## generate link to discussion doc #set($itempagename = $basename+$bibkey) #if ($request.create == $bibkey) #createPage($entry $itempagename) #end ## page exists? #if ($xwiki.exists($itempagename)) #set ($comcount = 0) #set ($bibdoc = $xwiki.getDocument($itempagename)) #set ($comcount = $bibdoc.getComments().size()) <a href="$bibdoc.getURL()">$comcount comments</a> #else <a href="$createUrl$bibkey">Discuss (new)</a> #end #if ($request.showabstracts.equalsIgnoreCase("true")) ## do nothing #else ## cut after the reference #set ($index = $val.indexOf("</div>") +6) #if ($index <0) #set($index = 0) <!-- /div --> #end #set ($val = $val.substring(0,$index)) #end <blockquote> \{pre\} <div> #else ---- \{pre\} #end ## raw $val \{/pre\} </blockquote> #end #end #end #### macro(bibsonomy $tag) ############## bibsonomy publications feed #macro(publications $tag) #if ($request.filter && $request.filter.length() > 0) #set ($tag = $tag+'+'+$request.filter) #end #set($feed = $xwiki.feed.getFeeds("http://www.bibsonomy.org/publrssN/tag/${tag}?items=1000")) #set($title = '<a href="http://www.bibsonomy.org/tag/'+$tag+'">'+$tag+'</a> publications' ) #bibsonomyfeed( $feed $title false) #end ############## /bibsonomy publications feed ############## bibsonomy publications feed with controls #macro(publications_pp $tag) <form action="" id="publications" method="post"> <input type="checkbox" #if ($request.showabstracts) checked #end name="showabstracts" value="true" />&nbsp;Show abstracts&nbsp; <input type="text" size="20" name="filter" value="$!request.filter" /> <input type="submit" name="filter" value="Filter" /> </form> #publications($tag) #end ############## /bibsonomy publications feed with controls #macro(publicationspp $tag) #publications_pp($tag) #end ############## bibsonomy links feed #macro(links $tag) #set($feed = $xwiki.feed.getFeeds("http://www.bibsonomy.org/rss/tag/${tag}?items=1000")) #set($title = '<a href="http://www.bibsonomy.org/tag/"'+$tag+'">'+$tag+'</a> links' ) #bibsonomyfeed( $feed $title true) #end ############## /bibsonomy publications feed ############## bibsonomy all NOT WORKING #macro(bibsonomyall $tag) <div style="float:left;width:40%;padding:5px;border:1px solid black;"> #publications( $tag) </div> <div style="float:left;width:40%;padding:5px;border:1px solid black;"> #links( $tag) </div> #end ############## /bibsonomy all {{/code}} {code} which produce {code} org.xwiki.rendering.macro.MacroExecutionException: Failed to highlight content at org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:108) at org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:48) at org.xwiki.rendering.macro.box.AbstractBoxMacro.execute(AbstractBoxMacro.java:145) at org.xwiki.rendering.macro.box.AbstractBoxMacro.execute(AbstractBoxMacro.java:51) at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transformOnce(MacroTransformation.java:184) at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:129) at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:72) at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:7471) at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:7420) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:835) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:783) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:878) at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116) at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1895) at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1833) at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:860) at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116) at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1943) at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1856) at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:154) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:226) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:117) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: Traceback (most recent call last): File "<string>", line 1, in <module> File "__pyclasspath__/pygments/__init__.py", line 86, in highlight File "__pyclasspath__/pygments/__init__.py", line 66, in format File "__pyclasspath__/pygments/__init__.py", line 66, in format File "__pyclasspath__/pygments/formatters/xdom.py", line 48, in format File "__pyclasspath__/pygments/style.py", line 80, in style_for_token KeyError: Token.Literal.String.Regexp at org.python.core.PyException.fillInStackTrace(PyException.java:70) at java.lang.Throwable.<init>(Throwable.java:181) at java.lang.Exception.<init>(Exception.java:29) at java.lang.RuntimeException.<init>(RuntimeException.java:32) at org.python.core.PyException.<init>(PyException.java:46) at org.python.core.PyException.<init>(PyException.java:43) at org.python.core.Py.KeyError(Py.java:211) at org.python.core.PyObject.__getitem__(PyObject.java:655) at pygments.style$py.style_for_token$4(__pyclasspath__/pygments/style.py:81) at pygments.style$py.call_function(__pyclasspath__/pygments/style.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyBaseCode.call(PyBaseCode.java:149) at org.python.core.PyFunction.__call__(PyFunction.java:327) at org.python.core.PyMethod.__call__(PyMethod.java:124) at pygments.formatters.xdom$py.format$3(__pyclasspath__/pygments/formatters/xdom.py:53) at pygments.formatters.xdom$py.call_function(__pyclasspath__/pygments/formatters/xdom.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyBaseCode.call(PyBaseCode.java:166) at org.python.core.PyFunction.__call__(PyFunction.java:338) at org.python.core.PyMethod.__call__(PyMethod.java:139) at pygments$py.format$2(__pyclasspath__/pygments/__init__.py:75) at pygments$py.call_function(__pyclasspath__/pygments/__init__.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyBaseCode.call(PyBaseCode.java:166) at org.python.core.PyFunction.__call__(PyFunction.java:338) at pygments$py.highlight$3(__pyclasspath__/pygments/__init__.py:86) at pygments$py.call_function(__pyclasspath__/pygments/__init__.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyBaseCode.call(PyBaseCode.java:301) at org.python.core.PyBaseCode.call(PyBaseCode.java:157) at org.python.core.PyFunction.__call__(PyFunction.java:338) at org.python.pycode._pyx3.f$0(<string>:1) at org.python.pycode._pyx3.call_function(<string>) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1253) at org.python.core.Py.exec(Py.java:1297) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:206) at org.xwiki.rendering.internal.parser.pygments.PygmentsParser.highlight(PygmentsParser.java:243) at org.xwiki.rendering.internal.parser.pygments.PygmentsParser.highlight(PygmentsParser.java:193) at org.xwiki.rendering.internal.macro.code.CodeMacro.highlight(CodeMacro.java:146) at org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:105) ... 92 more {code}

    XWiki.org JIRA | 6 years ago | Thomas Mortagne
    Token.Literal.String.Regexp

    Root Cause Analysis

    1. Token.Literal.String.Regexp

      No message provided

      at org.python.core.PyException.fillInStackTrace()
    2. Jython
      PyException.fillInStackTrace
      1. org.python.core.PyException.fillInStackTrace(PyException.java:70)
      1 frame
    3. Java RT
      RuntimeException.<init>
      1. java.lang.Throwable.<init>(Throwable.java:181)
      2. java.lang.Exception.<init>(Exception.java:29)
      3. java.lang.RuntimeException.<init>(RuntimeException.java:32)
      3 frames
    4. Jython
      PyObject.__getitem__
      1. org.python.core.PyException.<init>(PyException.java:46)
      2. org.python.core.PyException.<init>(PyException.java:43)
      3. org.python.core.Py.KeyError(Py.java:211)
      4. org.python.core.PyObject.__getitem__(PyObject.java:655)
      4 frames