Iron router function to render templates with the same layout - meteor

In my meteor application I use multiple yields in the layout.
The layout looks like this:
<template name="frontEnd">
{{>yield "header"}}
{{>yield}}
</template>
And the header
<template name="frontEndHeader">
<div class="ui menu">
<a class="active item" href="/">Home</a>
<a class="item" href="admin">Admin</a>
<div class="right menu">
{{>searchPaste}}
</div>
</div>
</template>
In the router.coffee I created a function to render frontEndHeader to prevent hardcoding, because there are many routes that use that template.
Here's the function:
renderFontEnd = (that, template)->
that.layout 'frontEnd'
that.render template
that.render 'frontEndHeader', to : 'header'
The problem is that I need to pass this when I define a route for example:
Router.route '/', ()-> renderFontEnd(#, 'mainUi')
I would like to remove that "()->" before calling the function, how could I do this?
I tried modifying the function to
renderFontEnd = (that, template)->(that=that, template=template)->
that.layout 'frontEnd'
that.render template
that.render 'frontEndHeader', to : 'header'
It doesn't show errors but it renders in nothing (If i add text to the layout it renders it but it doesn't render yields)
I think I'm trying to do this the wrong way.
Thanks for the help
Edit
Adding
console.log #, template
to my renderFrontEnd function, in the browser console I got
Window {speechSynthesis: SpeechSynthesis, caches: CacheStorage, localStorage: Storage, sessionStorage: Storage, webkitStorageInfo: DeprecatedStorageInfo…}Infinity: Infinity$: ( selector, context )Accounts: AccountsClientAnalyserNode: AnalyserNode()AnimationEvent: AnimationEvent()AppBannerPromptResult: AppBannerPromptResult()ApplicationCache: ApplicationCache()ApplicationCacheErrorEvent: ApplicationCacheErrorEvent()Array: Array()ArrayBuffer: ArrayBuffer()Attr: Attr()Audio: HTMLAudioElement()AudioBuffer: AudioBuffer()AudioBufferSourceNode: AudioBufferSourceNode()AudioContext: AudioContext()AudioDestinationNode: AudioDestinationNode()AudioListener: AudioListener()AudioNode: AudioNode()AudioParam: AudioParam()AudioProcessingEvent: AudioProcessingEvent()Autoupdate: ObjectBarProp: BarProp()BatteryManager: BatteryManager()BeforeInstallPromptEvent: BeforeInstallPromptEvent()BeforeUnloadEvent: BeforeUnloadEvent()BiquadFilterNode: BiquadFilterNode()Blaze: ObjectBlob: Blob()BlobEvent: BlobEvent()Boolean: Boolean()Buffer: Buffer(arg)ByteLengthQueuingStrategy: ByteLengthQueuingStrategy()CDATASection: CDATASection()CSS: CSS()CSSFontFaceRule: CSSFontFaceRule()CSSGroupingRule: CSSGroupingRule()CSSImportRule: CSSImportRule()CSSKeyframeRule: CSSKeyframeRule()CSSKeyframesRule: CSSKeyframesRule()CSSMediaRule: CSSMediaRule()CSSNamespaceRule: CSSNamespaceRule()CSSPageRule: CSSPageRule()CSSRule: CSSRule()CSSRuleList: CSSRuleList()CSSStyleDeclaration: CSSStyleDeclaration()CSSStyleRule: CSSStyleRule()CSSStyleSheet: CSSStyleSheet()CSSSupportsRule: CSSSupportsRule()CSSViewportRule: CSSViewportRule()Cache: Cache()CacheStorage: CacheStorage()CanvasCaptureMediaStreamTrack: CanvasCaptureMediaStreamTrack()CanvasGradient: CanvasGradient()CanvasPattern: CanvasPattern()CanvasRenderingContext2D: CanvasRenderingContext2D()ChannelMergerNode: ChannelMergerNode()ChannelSplitterNode: ChannelSplitterNode()CharacterData: CharacterData()ClientRect: ClientRect()ClientRectList: ClientRectList()ClipboardEvent: ClipboardEvent()CloseEvent: CloseEvent()Comment: Comment()CompositionEvent: CompositionEvent()ConvolverNode: ConvolverNode()CountQueuingStrategy: CountQueuingStrategy()Credential: Credential()CredentialsContainer: CredentialsContainer()Crypto: Crypto()CryptoKey: CryptoKey()CustomEvent: CustomEvent()DDP: ObjectDOMError: DOMError()DOMException: DOMException()DOMImplementation: DOMImplementation()DOMParser: DOMParser()DOMStringList: DOMStringList()DOMStringMap: DOMStringMap()DOMTokenList: DOMTokenList()DataTransfer: DataTransfer()DataTransferItem: DataTransferItem()DataTransferItemList: DataTransferItemList()DataView: DataView()Date: Date(Y, M, D, h, m, s, ms)DelayNode: DelayNode()Deps: ObjectDeviceMotionEvent: DeviceMotionEvent()DeviceOrientationEvent: DeviceOrientationEvent()Document: Document()DocumentFragment: DocumentFragment()DocumentType: DocumentType()DragEvent: DragEvent()DynamicsCompressorNode: DynamicsCompressorNode()Element: Element()Error: Error()ErrorEvent: ErrorEvent()EvalError: EvalError()Event: Event()EventSource: EventSource()EventTarget: EventTarget()FastRender: ObjectFederatedCredential: FederatedCredential()File: File()FileError: FileError()FileList: FileList()FileReader: FileReader()Float32Array: Float32Array()Float64Array: Float64Array()FocusEvent: FocusEvent()FontFace: FontFace()FormData: FormData()Function: Function()GainNode: GainNode()Gamepad: Gamepad()GamepadButton: GamepadButton()GamepadEvent: GamepadEvent()HTML: ObjectHTMLAllCollection: HTMLAllCollection()HTMLAnchorElement: HTMLAnchorElement()HTMLAreaElement: HTMLAreaElement()HTMLAudioElement: HTMLAudioElement()HTMLBRElement: HTMLBRElement()HTMLBaseElement: HTMLBaseElement()HTMLBodyElement: HTMLBodyElement()HTMLButtonElement: HTMLButtonElement()HTMLCanvasElement: HTMLCanvasElement()HTMLCollection: HTMLCollection()HTMLContentElement: HTMLContentElement()HTMLDListElement: HTMLDListElement()HTMLDataListElement: HTMLDataListElement()HTMLDetailsElement: HTMLDetailsElement()HTMLDialogElement: HTMLDialogElement()HTMLDirectoryElement: HTMLDirectoryElement()HTMLDivElement: HTMLDivElement()HTMLDocument: HTMLDocument()HTMLElement: HTMLElement()HTMLEmbedElement: HTMLEmbedElement()HTMLFieldSetElement: HTMLFieldSetElement()HTMLFontElement: HTMLFontElement()HTMLFormControlsCollection: HTMLFormControlsCollection()HTMLFormElement: HTMLFormElement()HTMLFrameElement: HTMLFrameElement()HTMLFrameSetElement: HTMLFrameSetElement()HTMLHRElement: HTMLHRElement()HTMLHeadElement: HTMLHeadElement()HTMLHeadingElement: HTMLHeadingElement()HTMLHtmlElement: HTMLHtmlElement()HTMLIFrameElement: HTMLIFrameElement()HTMLImageElement: HTMLImageElement()HTMLInputElement: HTMLInputElement()HTMLKeygenElement: HTMLKeygenElement()HTMLLIElement: HTMLLIElement()HTMLLabelElement: HTMLLabelElement()HTMLLegendElement: HTMLLegendElement()HTMLLinkElement: HTMLLinkElement()HTMLMapElement: HTMLMapElement()HTMLMarqueeElement: HTMLMarqueeElement()HTMLMediaElement: HTMLMediaElement()HTMLMenuElement: HTMLMenuElement()HTMLMetaElement: HTMLMetaElement()HTMLMeterElement: HTMLMeterElement()HTMLModElement: HTMLModElement()HTMLOListElement: HTMLOListElement()HTMLObjectElement: HTMLObjectElement()HTMLOptGroupElement: HTMLOptGroupElement()HTMLOptionElement: HTMLOptionElement()HTMLOptionsCollection: HTMLOptionsCollection()HTMLOutputElement: HTMLOutputElement()HTMLParagraphElement: HTMLParagraphElement()HTMLParamElement: HTMLParamElement()HTMLPictureElement: HTMLPictureElement()HTMLPreElement: HTMLPreElement()HTMLProgressElement: HTMLProgressElement()HTMLQuoteElement: HTMLQuoteElement()HTMLScriptElement: HTMLScriptElement()HTMLSelectElement: HTMLSelectElement()HTMLShadowElement: HTMLShadowElement()HTMLSourceElement: HTMLSourceElement()HTMLSpanElement: HTMLSpanElement()HTMLStyleElement: HTMLStyleElement()HTMLTableCaptionElement: HTMLTableCaptionElement()HTMLTableCellElement: HTMLTableCellElement()HTMLTableColElement: HTMLTableColElement()HTMLTableElement: HTMLTableElement()HTMLTableRowElement: HTMLTableRowElement()HTMLTableSectionElement: HTMLTableSectionElement()HTMLTemplateElement: HTMLTemplateElement()HTMLTextAreaElement: HTMLTextAreaElement()HTMLTitleElement: HTMLTitleElement()HTMLTrackElement: HTMLTrackElement()HTMLUListElement: HTMLUListElement()HTMLUnknownElement: HTMLUnknownElement()HTMLVideoElement: HTMLVideoElement()Handlebars: ObjectHasAndBelongsToManyRelation: HasAndBelongsToManyRelation()HasManyRelation: HasManyRelation()HashChangeEvent: HashChangeEvent()Headers: Headers()History: History()IDBCursor: IDBCursor()IDBCursorWithValue: IDBCursorWithValue()IDBDatabase: IDBDatabase()IDBFactory: IDBFactory()IDBIndex: IDBIndex()IDBKeyRange: IDBKeyRange()IDBObjectStore: IDBObjectStore()IDBOpenDBRequest: IDBOpenDBRequest()IDBRequest: IDBRequest()IDBTransaction: IDBTransaction()IDBVersionChangeEvent: IDBVersionChangeEvent()IIRFilterNode: IIRFilterNode()IdleDeadline: IdleDeadline()Image: HTMLImageElement()ImageBitmap: ImageBitmap()ImageData: ImageData()InputDeviceCapabilities: InputDeviceCapabilities()Int8Array: Int8Array()Int16Array: Int16Array()Int32Array: Int32Array()IntersectionObserver: IntersectionObserver()IntersectionObserverEntry: IntersectionObserverEntry()Intl: ObjectIron: ObjectJSON: JSONKeyboardEvent: KeyboardEvent()LaunchScreen: ObjectLocation: Location()MIDIAccess: MIDIAccess()MIDIConnectionEvent: MIDIConnectionEvent()MIDIInput: MIDIInput()MIDIInputMap: MIDIInputMap()MIDIMessageEvent: MIDIMessageEvent()MIDIOutput: MIDIOutput()MIDIOutputMap: MIDIOutputMap()MIDIPort: MIDIPort()Map: Map()Math: MathMediaDevices: MediaDevices()MediaElementAudioSourceNode: MediaElementAudioSourceNode()MediaEncryptedEvent: MediaEncryptedEvent()MediaError: MediaError()MediaKeyMessageEvent: MediaKeyMessageEvent()MediaKeySession: MediaKeySession()MediaKeyStatusMap: MediaKeyStatusMap()MediaKeySystemAccess: MediaKeySystemAccess()MediaKeys: MediaKeys()MediaList: MediaList()MediaQueryList: MediaQueryList()MediaQueryListEvent: MediaQueryListEvent()MediaRecorder: MediaRecorder()MediaSource: MediaSource()MediaStreamAudioDestinationNode: MediaStreamAudioDestinationNode()MediaStreamAudioSourceNode: MediaStreamAudioSourceNode()MediaStreamEvent: MediaStreamEvent()MediaStreamTrack: MediaStreamTrack()MessageChannel: MessageChannel()MessageEvent: MessageEvent()MessagePort: MessagePort()Meteor: ObjectMimeType: MimeType()MimeTypeArray: MimeTypeArray()Minimongoid: Minimongoid(attr, parent, is_new)Mongo: ObjectMouseEvent: MouseEvent()MutationEvent: MutationEvent()MutationObserver: MutationObserver()MutationRecord: MutationRecord()NaN: NaNNamedNodeMap: NamedNodeMap()Navigator: Navigator()Node: Node()NodeFilter: NodeFilter()NodeIterator: NodeIterator()NodeList: NodeList()Notification: Notification()Number: Number()Object: Object()OfflineAudioCompletionEvent: OfflineAudioCompletionEvent()OfflineAudioContext: OfflineAudioContext()Option: HTMLOptionElement()OscillatorNode: OscillatorNode()Package: ObjectPageTransitionEvent: PageTransitionEvent()PasswordCredential: PasswordCredential()Paste: Paste()Path2D: Path2D()Performance: Performance()PerformanceEntry: PerformanceEntry()PerformanceMark: PerformanceMark()PerformanceMeasure: PerformanceMeasure()PerformanceNavigation: PerformanceNavigation()PerformanceObserver: PerformanceObserver()PerformanceObserverEntryList: PerformanceObserverEntryList()PerformanceResourceTiming: PerformanceResourceTiming()PerformanceTiming: PerformanceTiming()PeriodicWave: PeriodicWave()PermissionStatus: PermissionStatus()Permissions: Permissions()Plugin: Plugin()PluginArray: PluginArray()PopStateEvent: PopStateEvent()Presentation: Presentation()PresentationAvailability: PresentationAvailability()PresentationConnection: PresentationConnection()PresentationConnectionAvailableEvent: PresentationConnectionAvailableEvent()PresentationConnectionCloseEvent: PresentationConnectionCloseEvent()PresentationRequest: PresentationRequest()ProcessingInstruction: ProcessingInstruction()ProgressEvent: ProgressEvent()Promise: Promise()PromiseRejectionEvent: PromiseRejectionEvent()Proxy: Proxy()PushManager: PushManager()PushSubscription: PushSubscription()RTCCertificate: RTCCertificate()RTCIceCandidate: RTCIceCandidate()RTCSessionDescription: RTCSessionDescription()RadioNodeList: RadioNodeList()Range: Range()RangeError: RangeError()ReactiveVar: (initialValue, equalsFunc)ReadableStream: ReadableStream()ReferenceError: ReferenceError()Reflect: ObjectRegExp: RegExp()Relation: Relation()Reload: ObjectRequest: Request()Response: Response()Roles: ObjectRouteController: ()Router: router(req, res, next)SVGAElement: SVGAElement()SVGAngle: SVGAngle()SVGAnimateElement: SVGAnimateElement()SVGAnimateMotionElement: SVGAnimateMotionElement()SVGAnimateTransformElement: SVGAnimateTransformElement()SVGAnimatedAngle: SVGAnimatedAngle()SVGAnimatedBoolean: SVGAnimatedBoolean()SVGAnimatedEnumeration: SVGAnimatedEnumeration()SVGAnimatedInteger: SVGAnimatedInteger()SVGAnimatedLength: SVGAnimatedLength()SVGAnimatedLengthList: SVGAnimatedLengthList()SVGAnimatedNumber: SVGAnimatedNumber()SVGAnimatedNumberList: SVGAnimatedNumberList()SVGAnimatedPreserveAspectRatio: SVGAnimatedPreserveAspectRatio()SVGAnimatedRect: SVGAnimatedRect()SVGAnimatedString: SVGAnimatedString()SVGAnimatedTransformList: SVGAnimatedTransformList()SVGAnimationElement: SVGAnimationElement()SVGCircleElement: SVGCircleElement()SVGClipPathElement: SVGClipPathElement()SVGComponentTransferFunctionElement: SVGComponentTransferFunctionElement()SVGCursorElement: SVGCursorElement()SVGDefsElement: SVGDefsElement()SVGDescElement: SVGDescElement()SVGDiscardElement: SVGDiscardElement()SVGElement: SVGElement()SVGEllipseElement: SVGEllipseElement()SVGFEBlendElement: SVGFEBlendElement()SVGFEColorMatrixElement: SVGFEColorMatrixElement()SVGFEComponentTransferElement: SVGFEComponentTransferElement()SVGFECompositeElement: SVGFECompositeElement()SVGFEConvolveMatrixElement: SVGFEConvolveMatrixElement()SVGFEDiffuseLightingElement: SVGFEDiffuseLightingElement()SVGFEDisplacementMapElement: SVGFEDisplacementMapElement()SVGFEDistantLightElement: SVGFEDistantLightElement()SVGFEDropShadowElement: SVGFEDropShadowElement()SVGFEFloodElement: SVGFEFloodElement()SVGFEFuncAElement: SVGFEFuncAElement()SVGFEFuncBElement: SVGFEFuncBElement()SVGFEFuncGElement: SVGFEFuncGElement()SVGFEFuncRElement: SVGFEFuncRElement()SVGFEGaussianBlurElement: SVGFEGaussianBlurElement()SVGFEImageElement: SVGFEImageElement()SVGFEMergeElement: SVGFEMergeElement()SVGFEMergeNodeElement: SVGFEMergeNodeElement()SVGFEMorphologyElement: SVGFEMorphologyElement()SVGFEOffsetElement: SVGFEOffsetElement()SVGFEPointLightElement: SVGFEPointLightElement()SVGFESpecularLightingElement: SVGFESpecularLightingElement()SVGFESpotLightElement: SVGFESpotLightElement()SVGFETileElement: SVGFETileElement()SVGFETurbulenceElement: SVGFETurbulenceElement()SVGFilterElement: SVGFilterElement()SVGForeignObjectElement: SVGForeignObjectElement()SVGGElement: SVGGElement()SVGGeometryElement: SVGGeometryElement()SVGGradientElement: SVGGradientElement()SVGGraphicsElement: SVGGraphicsElement()SVGImageElement: SVGImageElement()SVGLength: SVGLength()SVGLengthList: SVGLengthList()SVGLineElement: SVGLineElement()SVGLinearGradientElement: SVGLinearGradientElement()SVGMPathElement: SVGMPathElement()SVGMarkerElement: SVGMarkerElement()SVGMaskElement: SVGMaskElement()SVGMatrix: SVGMatrix()SVGMetadataElement: SVGMetadataElement()SVGNumber: SVGNumber()SVGNumberList: SVGNumberList()SVGPathElement: SVGPathElement()SVGPatternElement: SVGPatternElement()SVGPoint: SVGPoint()SVGPointList: SVGPointList()SVGPolygonElement: SVGPolygonElement()SVGPolylineElement: SVGPolylineElement()SVGPreserveAspectRatio: SVGPreserveAspectRatio()SVGRadialGradientElement: SVGRadialGradientElement()SVGRect: SVGRect()SVGRectElement: SVGRectElement()SVGSVGElement: SVGSVGElement()SVGScriptElement: SVGScriptElement()SVGSetElement: SVGSetElement()SVGStopElement: SVGStopElement()SVGStringList: SVGStringList()SVGStyleElement: SVGStyleElement()SVGSwitchElement: SVGSwitchElement()SVGSymbolElement: SVGSymbolElement()SVGTSpanElement: SVGTSpanElement()SVGTextContentElement: SVGTextContentElement()SVGTextElement: SVGTextElement()SVGTextPathElement: SVGTextPathElement()SVGTextPositioningElement: SVGTextPositioningElement()SVGTitleElement: SVGTitleElement()SVGTransform: SVGTransform()SVGTransformList: SVGTransformList()SVGUnitTypes: SVGUnitTypes()SVGUseElement: SVGUseElement()SVGViewElement: SVGViewElement()SVGViewSpec: SVGViewSpec()SVGZoomEvent: SVGZoomEvent()Screen: Screen()ScreenOrientation: ScreenOrientation()ScriptProcessorNode: ScriptProcessorNode()SecurityPolicyViolationEvent: SecurityPolicyViolationEvent()Selection: Selection()ServiceWorker: ServiceWorker()ServiceWorkerContainer: ServiceWorkerContainer()ServiceWorkerMessageEvent: ServiceWorkerMessageEvent()ServiceWorkerRegistration: ServiceWorkerRegistration()Set: Set()ShadowRoot: ShadowRoot()SharedWorker: SharedWorker()SiteBoundCredential: SiteBoundCredential()SourceBuffer: SourceBuffer()SourceBufferList: SourceBufferList()Spacebars: ObjectSpeechSynthesisEvent: SpeechSynthesisEvent()SpeechSynthesisUtterance: SpeechSynthesisUtterance()Storage: Storage()StorageEvent: StorageEvent()String: String()StyleSheet: StyleSheet()StyleSheetList: StyleSheetList()SubsManager: (options)SubtleCrypto: SubtleCrypto()Symbol: Symbol()SyncManager: SyncManager()SyntaxError: SyntaxError()Template: (viewName, renderFunction)Text: Text()TextDecoder: TextDecoder()TextEncoder: TextEncoder()TextEvent: TextEvent()TextMetrics: TextMetrics()TextTrack: TextTrack()TextTrackCue: TextTrackCue()TextTrackCueList: TextTrackCueList()TextTrackList: TextTrackList()TimeRanges: TimeRanges()Touch: Touch()TouchEvent: TouchEvent()TouchList: TouchList()TrackEvent: TrackEvent()Tracker: ObjectTransitionEvent: TransitionEvent()TreeWalker: TreeWalker()TypeError: TypeError()UI: ObjectUIEvent: UIEvent()URIError: URIError()URL: URL()URLSearchParams: URLSearchParams()Uint8Array: Uint8Array()Uint8ClampedArray: Uint8ClampedArray()Uint16Array: Uint16Array()Uint32Array: Uint32Array()VTTCue: VTTCue()ValidityState: ValidityState()WaveShaperNode: WaveShaperNode()WeakMap: WeakMap()WeakSet: WeakSet()WebApp: ObjectWebGLActiveInfo: WebGLActiveInfo()WebGLBuffer: WebGLBuffer()WebGLContextEvent: WebGLContextEvent()WebGLFramebuffer: WebGLFramebuffer()WebGLProgram: WebGLProgram()WebGLRenderbuffer: WebGLRenderbuffer()WebGLRenderingContext: WebGLRenderingContext()WebGLShader: WebGLShader()WebGLShaderPrecisionFormat: WebGLShaderPrecisionFormat()WebGLTexture: WebGLTexture()WebGLUniformLocation: WebGLUniformLocation()WebKitAnimationEvent: AnimationEvent()WebKitCSSMatrix: WebKitCSSMatrix()WebKitMutationObserver: MutationObserver()WebKitTransitionEvent: TransitionEvent()WebSocket: WebSocket()WheelEvent: WheelEvent()Window: Window()Worker: Worker()XMLDocument: XMLDocument()XMLHttpRequest: XMLHttpRequest()XMLHttpRequestEventTarget: XMLHttpRequestEventTarget()XMLHttpRequestUpload: XMLHttpRequestUpload()XMLSerializer: XMLSerializer()XPathEvaluator: XPathEvaluator()XPathExpression: XPathExpression()XPathResult: XPathResult()XSLTProcessor: XSLTProcessor()_: (obj)__coffeescriptShare: Object__core-js_shared__: Object__init_fast_render: undefined__meteor_runtime_config__: Objectalert: alert()applicationCache: ApplicationCacheatob: atob()blur: ()btoa: btoa()caches: CacheStoragecancelAnimationFrame: cancelAnimationFrame()cancelIdleCallback: cancelIdleCallback()captureEvents: captureEvents()chrome: ObjectclearInterval: clearInterval()clearTimeout: clearTimeout()clientInformation: Navigatorclose: ()closed: falseconfirm: confirm()console: Objectcore: ObjectcreateImageBitmap: createImageBitmap()crypto: CryptodecodeURI: decodeURI()decodeURIComponent: decodeURIComponent()defaultStatus: ""defaultstatus: ""devicePixelRatio: 1document: documentencodeURI: encodeURI()encodeURIComponent: encodeURIComponent()escape: escape()eval: eval()event: undefinedexternal: Objectfetch: fetch()find: find()focus: ()frameElement: nullframes: WindowgetComputedStyle: getComputedStyle()getMatchedCSSRules: getMatchedCSSRules()getSelection: getSelection()global: Windowhistory: HistoryindexedDB: IDBFactoryinnerHeight: 925innerWidth: 1563isFinite: isFinite()isNaN: isNaN()isSecureContext: truejQuery: ( selector, context )jQuery1112005778395572585193: Objectlanguage: language()length: 0localStorage: Storagelocation: Locationlocationbar: BarPropmatchMedia: matchMedia()menubar: BarPropmeteorBabelHelpers: ObjectmeteorEnv: ObjectmeteorInstall: install(tree, options)moveBy: moveBy()moveTo: moveTo()name: ""navigator: NavigatoroffscreenBuffering: trueonabort: nullonanimationend: nullonanimationiteration: nullonanimationstart: nullonbeforeunload: nullonblur: nulloncancel: nulloncanplay: nulloncanplaythrough: nullonchange: nullonclick: nullonclose: nulloncontextmenu: nulloncuechange: nullondblclick: nullondevicemotion: nullondeviceorientation: nullondeviceorientationabsolute: nullondrag: nullondragend: nullondragenter: nullondragleave: nullondragover: nullondragstart: nullondrop: nullondurationchange: nullonemptied: nullonended: nullonerror: nullonfocus: nullonhashchange: nulloninput: nulloninvalid: nullonkeydown: nullonkeypress: nullonkeyup: nullonlanguagechange: nullonload: nullonloadeddata: nullonloadedmetadata: nullonloadstart: nullonmessage: nullonmousedown: nullonmouseenter: nullonmouseleave: nullonmousemove: nullonmouseout: nullonmouseover: nullonmouseup: nullonmousewheel: nullonoffline: nullononline: nullonpagehide: nullonpageshow: nullonpause: nullonplay: nullonplaying: nullonpopstate: nullonprogress: nullonratechange: nullonrejectionhandled: nullonreset: nullonresize: nullonscroll: nullonsearch: nullonseeked: nullonseeking: nullonselect: nullonshow: nullonstalled: nullonstorage: nullonsubmit: nullonsuspend: nullontimeupdate: nullontoggle: nullontransitionend: nullonunhandledrejection: nullonunload: nullonvolumechange: nullonwaiting: nullonwebkitanimationend: nullonwebkitanimationiteration: nullonwebkitanimationstart: nullonwebkittransitionend: nullonwheel: nullopen: open()openDatabase: openDatabase()opener: nullouterHeight: 1015outerWidth: 1920pageXOffset: 0pageYOffset: 0parent: WindowparseFloat: parseFloat()parseInt: parseInt()performance: Performancepersonalbar: BarProppostMessage: ()print: print()process: Objectprompt: prompt()releaseEvents: releaseEvents()requestAnimationFrame: requestAnimationFrame()requestIdleCallback: requestIdleCallback()require: require(id)resizeBy: resizeBy()resizeTo: resizeTo()screen: ScreenscreenLeft: 0screenTop: 29screenX: 0screenY: 29scroll: scroll()scrollBy: scrollBy()scrollTo: scrollTo()scrollX: 0scrollY: 0scrollbars: BarPropself: WindowsessionStorage: StoragesetInterval: setInterval()setTimeout: setTimeout()speechSynthesis: SpeechSynthesisstatus: ""statusbar: BarPropstop: stop()styleMedia: StyleMediatoolbar: BarProptop: Windowundefined: undefinedunescape: unescape()webkitAudioContext: AudioContext()webkitCancelAnimationFrame: webkitCancelAnimationFrame()webkitCancelRequestAnimationFrame: webkitCancelRequestAnimationFrame()webkitIDBCursor: IDBCursor()webkitIDBDatabase: IDBDatabase()webkitIDBFactory: IDBFactory()webkitIDBIndex: IDBIndex()webkitIDBKeyRange: IDBKeyRange()webkitIDBObjectStore: IDBObjectStore()webkitIDBRequest: IDBRequest()webkitIDBTransaction: IDBTransaction()webkitIndexedDB: IDBFactorywebkitMediaStream: MediaStream()webkitOfflineAudioContext: OfflineAudioContext()webkitRTCPeerConnection: RTCPeerConnection()webkitRequestAnimationFrame: webkitRequestAnimationFrame()webkitRequestFileSystem: webkitRequestFileSystem()webkitResolveLocalFileSystemURL: webkitResolveLocalFileSystemURL()webkitSpeechGrammar: SpeechGrammar()webkitSpeechGrammarList: SpeechGrammarList()webkitSpeechRecognition: SpeechRecognition()webkitSpeechRecognitionError: SpeechRecognitionError()webkitSpeechRecognitionEvent: SpeechRecognitionEvent()webkitStorageInfo: DeprecatedStorageInfowebkitURL: URL()window: Window__proto__: Window "mainUi"

I'm not 100% sure I understand your question, but it seems you are looking for Function.prototype.bind(). It returns a version of the function with a given this context and optionally some parameters. In your case you can create the bound function like this:
Router.route '/', renderFontEnd.bind(#, 'mainUi')
Now you can modify your renderFrontEnd function like this:
renderFontEnd = (template)->
#layout 'frontEnd'
#render template
#render 'frontEndHeader', to : 'header'
since bind has supplied the correct this context.

Related

PIDinRootline = 5,10 with symfony expressions without OR statement?

According to https://www.clickstorm.de/blog/typoscript-conditions-symfony-expression-language/ the new notation for [PIDinRootline = 5,10] would be [5 in tree.rootLineIds || 10 in tree.rootLineIds]
Now my problem is, that before I used a configurable Constant like this:
cd.pageList = 5,10
[PIDinRootline = {$cd.pageList}]
With the new annotation, the only thing that worked to make this configurable would be:
cd.pageList = 5 in tree.rootLineIds || 10 in tree.rootLineIds
[{$cd.pageList}]
Is there any way to have a conditional that checks if any value inside a list is in the tree.rootLineIds or is this really the only option?
Something like [5,10] in tree.rootLineIds?

HTML tags using paste in R

Can anyone help me here with HTML tags
> df <- "sadfsdf adfsd"
> HTML(paste0(strwrap(glue('Comments : <span style = "font-weight:lighter">{df}</span>'),width = 50), collapse="</br>"))
Comments : <span style =</br>"font-weight:lighter">sadfsdf adfsd</span>
Not sure why is coming in between.
Expected output
Comments : <span style ="font-weight:lighter">sadfsdf adfsd</span>
You're doing it to yourself with strwrap.
strwrap(glue::glue('Comments : <span style = "font-weight:lighter">{df}</span>'),width = 50)
# [1] "Comments : <span style =" "\"font-weight:lighter\">sadfsdf adfsd</span>"
That's a length-2 vector, so by wrapping that in paste0(..., collapse="</br>"), you corrupt it.
paste0(strwrap(glue::glue('Comments : <span style = "font-weight:lighter">{df}</span>'),width = 50), collapse="</br>")
# [1] "Comments : <span style =</br>\"font-weight:lighter\">sadfsdf adfsd</span>"
Further, I suspect the strwrap and paste0 should be done inside of the glue, perhaps
htmltools::HTML(glue::glue('Comments : <span style = "font-weight:lighter">{ paste0(strwrap(df,width=50),collapse="</br>") }</span>'))
# Comments : <span style = "font-weight:lighter">sadfsdf adfsd</span>

RStudio truncates long strings when pasting into IDE - workaround?

I'm using R 3.6.1 and RStudio 1.3.1056.
When pasting a long character string into RStudio using either paste() or paste0() or even c() or just simply assigning the string to an object, I get some strange results, and it looks to be unique to RStudio (if you place this code directly into R it works just fine; the correct value is given for nchar()):
thing <- paste0("(blah blah
'100869017', '100895297', '100937037', '100952542', '100953872', '100958290', '100977291', '100978521', '100982570', '100983764', '100986439', '100987969', '100988635', '100988637', '100989748', '100992594', '100998300', '100998306', '101000068', '101000556', '101002036', '101002550', '101002813', '101002871', '101002872', '101003492', '101003787', '101003789', '101003830', '101004348', '101004349', '101004400', '101004401', '101005323', '101005738', '101006388', '101006411', '101006413', '101006414', '101006416', '101006417', '101006419', '101006440', '101006441', '101006442', '101006443', '101006444', '101006445', '101006446', '101006447', '101006448', '101006449', '101006450', '101006451', '101006452', '101006453', '101006454', '101006455', '101006456', '101006457', '101006458', '101006554', '101006588', '101006608', '101008736', '101009658', '101011518', '101011680', '101011681', '101012457', '101012495', '101014157', '101014197', '101014240', '101014244', '101014248', '101014301', '101014302', '101014303', '101014304', '101014358', '101014480', '101014481', '101015219', '101017560', '101019383', '101019396', '101019454', '101019480', '101019481', '101019567', '101020977', '101022585', '101024007', '101024436', '101028376', '101028377', '101028405', '101029814', '101030739', '101030940', '101031364', '101031368', '101032356', '101032399', '101032440', '101032441', '101032442', '101032443', '101032444', '101032462', '101032468', '101032482', '101032483', '101032484', '101032485', '101032486', '101032487', '101032488', '101032489', '101032590', '101032591', '101032735', '101032987', '101033456', '101036227', '101037275', '101038196', '101038279', '101038930', '101038932', '101038938', '101039576', '101041116', '101041233', '101041288', '101042815', '101043166', '101043280', '101043281', '101043282', '101043285', '101043288', '101043307', '101043302', '101043329', '101043405', '101043837', '101045392', '101045635', '101046419', '101046440', '101046441', '101047082', '101047224', '101047227', '101047275', '101047281', '101047286', '101047287', '101047288', '101047290', '101047293', '101047295', '101047297', '101047304', '101048355', '101048439', '101048480', '101048905', '101048921', '101050905', '101052305', '101052442', '101052448', '101052449', '101052480', '101052481', '101052485', '101052487', '101052489', '101052522', '101052550', '101052551', '101053187', '101055017', '101055036', '101055039', '101055220', '101055258', '101055313', '101055316', '101055317', '101059567', '101060256', '101060554', '101060810', '101060817', '101061738', '101061739', '101061762', '101062369', '101062469', '101063528', '101063909', '101065440', '101065471', '101065473', '101065536', '101065760', '101065784', '101065805', '101065813', '101068343', '101068346', '101069329', '101069472', '101069478', '101069771', '101069871', '101069902', '101070895', '101071301', '101071303', '101072911', '101072914', '101072915', '101072944', '101072946', '101072949', '101072972', '101072981', '101072984', '101072985', '101073389', '101073806', '101074467', '101074469', '101074650', '101074709', '101074721', '101074869', '101075639', '101075881', '101075887', '101075888', '101076841', '101076843', '101076884', '101076885', '101076889', '101076930', '101077036', '101077872', '101077877', '101078006', '101078141', '101078834', '101079626', '101079624', '101079658', '101080128', '101080146', '101080341', '101080389', '101080732', '101080738', '101080931', '101081744', '101081745', '101082123', '101082443', '101082445', '101082447', '101085919', '101086763', '101086774', '101086801', '101086915', '101086964', '101086965', '101087006', '101088057', '101088465', '101089884', '101089915', '101089945', '101090159', '101090197', '101090225', '101090226', '101090227', '101090229', '101090293', '101091218', '101091232', '101091238', '101091239', '101091635', '101091655', '101092773', '101092997', '101093029', '101093064', '101093067', '101093255', '101093344', '101097283', '101097668', '101098444', '101098514', '101099068', '101099073', '101099076', '101099141', '101099170', '101099172', '101099173', '101099175', '101099177', '101099178', '101099194', '101099204', '101099206', '101099581', '101099666', '101100002', '101100179', '101100492', '101100617', '101101080', '101101088', '101101091', '101101092', '101101115', '101101117', '101101150', '101101158', '101102050', '101102086', '101102101', '101102108', '101102169', '101102650', '101102712', '101103376', '101106299', '101106618', '101107257', '101107277', '101108114', '101108119', '101108670', '101108702', '101108707', '101109772', '101109774', '101109779', '101111022', '101111029', '101113873', '101114376', '101114390', '101115163', '101115246', '101115247', '101115357', '101115358', '101116813', '101116819', '101116870', '101116877', '101118108', '101118175', '101118178', '101118277', '101118441', '101118449', '101118471', '101118505', '101118631', '101119051', '101119448', '101119914', '101120073', '101120076', '101120127', '101120292', '101120334', '101120387', '101120389', '101122367', '101122822', '101122881', '101122886', '101124670', '101124838', '101125490', '101125610', '101126329', '101127340', '101127341', '101127342', '101127343', '101127346', '101127347', '101127360', '101127853', '101127855', '101127856', '101127857', '101128128', '101128126', '101128132', '101128135', '101130135', '101131523', '101132622', '101132648', '101132850', '101132870', '101132931', '101132938', '101132990', '101132994', '101133104', '101133206', '101133248', '101134597', '101134599', '101134611', '101134649', '101134661', '101134704', '101134771', '101135221', '101135276', '101135278', '101135409', '101135444', '101135518', '101135630', '101135633', '101135632', '101137571', '101137750', '101137812', '101137875', '101138237', '101139907', '101139931', '101139968', '101140076', '101140148', '101140181', '101140250', '101140253', '101140460', '101140462', '101140466', '101140469', '101140518', '101150986', '101150987', '101150990', '101150994', '101150995', '101151373', '101151376', '101151416', '101151418', '101151419', '101151434', '101151437', '101151891', '101151974', '101151978', '101151979', '101151996', '101152030', '101152031', '101152032', '101152037', '101152062', '101152063', '101152066', '101152068', '101152069', '101152070', '101152072', '101152073', '101152074', '101152077', '101152078', '101152080', '101152081', '101152083', '101152085', '101152087', '101152088', '101152089', '101152100', '101152103', '101152105', '101153684', '101153944', '101153966', '101153996', '101153999', '101155013', '101155141', '101155149', '101155311', '101155560', '101155880', '101155882', '101155883', '101155884', '101155905', '101156458', '101156459', '101156511', '101156524', '101156546', '101156547', '101156596', '101156611', '101156641', '101156664', '101156752', '101156786', '101156801', '101156842', '101156885', '101156888', '101156892', '101157753', '101157844', '101157881', '101157905', '101157927', '101158001', '101158011', '101158025', '101158028', '101158034', '101158061', '101158081', '101158084', '101158103', '101158107', '101159736', '101160183', '101160203', '101160234', '101160373', '101160377', '101160381', '101160378', '101160451', '101160551', '101162202', '101162245', '101162247', '101162249', '101162492', '101162538', '101162585', '101162595', '101162627', '101162630', '101162634', '101162792', '101162848', '101162876', '101162904', '101164138', '101164337', '101165132', '101165133', '101165134'
blah blah)")
nchar(thing)
The output of nchar() is 4130. In reality, nchar() should be showing 7603.
Why would I do something like this in a script? In this case, it was a SQL query written into a script and being run via RStudio.
Even stranger is removing the "blah blah" at the top and bottom of the string:
thing <- paste0("'100869017', '100895297', '100937037', '100952542', '100953872', '100958290', '100977291', '100978521', '100982570', '100983764', '100986439', '100987969', '100988635', '100988637', '100989748', '100992594', '100998300', '100998306', '101000068', '101000556', '101002036', '101002550', '101002813', '101002871', '101002872', '101003492', '101003787', '101003789', '101003830', '101004348', '101004349', '101004400', '101004401', '101005323', '101005738', '101006388', '101006411', '101006413', '101006414', '101006416', '101006417', '101006419', '101006440', '101006441', '101006442', '101006443', '101006444', '101006445', '101006446', '101006447', '101006448', '101006449', '101006450', '101006451', '101006452', '101006453', '101006454', '101006455', '101006456', '101006457', '101006458', '101006554', '101006588', '101006608', '101008736', '101009658', '101011518', '101011680', '101011681', '101012457', '101012495', '101014157', '101014197', '101014240', '101014244', '101014248', '101014301', '101014302', '101014303', '101014304', '101014358', '101014480', '101014481', '101015219', '101017560', '101019383', '101019396', '101019454', '101019480', '101019481', '101019567', '101020977', '101022585', '101024007', '101024436', '101028376', '101028377', '101028405', '101029814', '101030739', '101030940', '101031364', '101031368', '101032356', '101032399', '101032440', '101032441', '101032442', '101032443', '101032444', '101032462', '101032468', '101032482', '101032483', '101032484', '101032485', '101032486', '101032487', '101032488', '101032489', '101032590', '101032591', '101032735', '101032987', '101033456', '101036227', '101037275', '101038196', '101038279', '101038930', '101038932', '101038938', '101039576', '101041116', '101041233', '101041288', '101042815', '101043166', '101043280', '101043281', '101043282', '101043285', '101043288', '101043307', '101043302', '101043329', '101043405', '101043837', '101045392', '101045635', '101046419', '101046440', '101046441', '101047082', '101047224', '101047227', '101047275', '101047281', '101047286', '101047287', '101047288', '101047290', '101047293', '101047295', '101047297', '101047304', '101048355', '101048439', '101048480', '101048905', '101048921', '101050905', '101052305', '101052442', '101052448', '101052449', '101052480', '101052481', '101052485', '101052487', '101052489', '101052522', '101052550', '101052551', '101053187', '101055017', '101055036', '101055039', '101055220', '101055258', '101055313', '101055316', '101055317', '101059567', '101060256', '101060554', '101060810', '101060817', '101061738', '101061739', '101061762', '101062369', '101062469', '101063528', '101063909', '101065440', '101065471', '101065473', '101065536', '101065760', '101065784', '101065805', '101065813', '101068343', '101068346', '101069329', '101069472', '101069478', '101069771', '101069871', '101069902', '101070895', '101071301', '101071303', '101072911', '101072914', '101072915', '101072944', '101072946', '101072949', '101072972', '101072981', '101072984', '101072985', '101073389', '101073806', '101074467', '101074469', '101074650', '101074709', '101074721', '101074869', '101075639', '101075881', '101075887', '101075888', '101076841', '101076843', '101076884', '101076885', '101076889', '101076930', '101077036', '101077872', '101077877', '101078006', '101078141', '101078834', '101079626', '101079624', '101079658', '101080128', '101080146', '101080341', '101080389', '101080732', '101080738', '101080931', '101081744', '101081745', '101082123', '101082443', '101082445', '101082447', '101085919', '101086763', '101086774', '101086801', '101086915', '101086964', '101086965', '101087006', '101088057', '101088465', '101089884', '101089915', '101089945', '101090159', '101090197', '101090225', '101090226', '101090227', '101090229', '101090293', '101091218', '101091232', '101091238', '101091239', '101091635', '101091655', '101092773', '101092997', '101093029', '101093064', '101093067', '101093255', '101093344', '101097283', '101097668', '101098444', '101098514', '101099068', '101099073', '101099076', '101099141', '101099170', '101099172', '101099173', '101099175', '101099177', '101099178', '101099194', '101099204', '101099206', '101099581', '101099666', '101100002', '101100179', '101100492', '101100617', '101101080', '101101088', '101101091', '101101092', '101101115', '101101117', '101101150', '101101158', '101102050', '101102086', '101102101', '101102108', '101102169', '101102650', '101102712', '101103376', '101106299', '101106618', '101107257', '101107277', '101108114', '101108119', '101108670', '101108702', '101108707', '101109772', '101109774', '101109779', '101111022', '101111029', '101113873', '101114376', '101114390', '101115163', '101115246', '101115247', '101115357', '101115358', '101116813', '101116819', '101116870', '101116877', '101118108', '101118175', '101118178', '101118277', '101118441', '101118449', '101118471', '101118505', '101118631', '101119051', '101119448', '101119914', '101120073', '101120076', '101120127', '101120292', '101120334', '101120387', '101120389', '101122367', '101122822', '101122881', '101122886', '101124670', '101124838', '101125490', '101125610', '101126329', '101127340', '101127341', '101127342', '101127343', '101127346', '101127347', '101127360', '101127853', '101127855', '101127856', '101127857', '101128128', '101128126', '101128132', '101128135', '101130135', '101131523', '101132622', '101132648', '101132850', '101132870', '101132931', '101132938', '101132990', '101132994', '101133104', '101133206', '101133248', '101134597', '101134599', '101134611', '101134649', '101134661', '101134704', '101134771', '101135221', '101135276', '101135278', '101135409', '101135444', '101135518', '101135630', '101135633', '101135632', '101137571', '101137750', '101137812', '101137875', '101138237', '101139907', '101139931', '101139968', '101140076', '101140148', '101140181', '101140250', '101140253', '101140460', '101140462', '101140466', '101140469', '101140518', '101150986', '101150987', '101150990', '101150994', '101150995', '101151373', '101151376', '101151416', '101151418', '101151419', '101151434', '101151437', '101151891', '101151974', '101151978', '101151979', '101151996', '101152030', '101152031', '101152032', '101152037', '101152062', '101152063', '101152066', '101152068', '101152069', '101152070', '101152072', '101152073', '101152074', '101152077', '101152078', '101152080', '101152081', '101152083', '101152085', '101152087', '101152088', '101152089', '101152100', '101152103', '101152105', '101153684', '101153944', '101153966', '101153996', '101153999', '101155013', '101155141', '101155149', '101155311', '101155560', '101155880', '101155882', '101155883', '101155884', '101155905', '101156458', '101156459', '101156511', '101156524', '101156546', '101156547', '101156596', '101156611', '101156641', '101156664', '101156752', '101156786', '101156801', '101156842', '101156885', '101156888', '101156892', '101157753', '101157844', '101157881', '101157905', '101157927', '101158001', '101158011', '101158025', '101158028', '101158034', '101158061', '101158081', '101158084', '101158103', '101158107', '101159736', '101160183', '101160203', '101160234', '101160373', '101160377', '101160381', '101160378', '101160451', '101160551', '101162202', '101162245', '101162247', '101162249', '101162492', '101162538', '101162585', '101162595', '101162627', '101162630', '101162634', '101162792', '101162848', '101162876', '101162904', '101164138', '101164337', '101165132', '101165133', '101165134'")
In this case the console hangs with the + as if awaiting further input.
Again, take those examples and put them directly into R and nchar() provides the correct count.
The worst part of this is that in the first example, the object is created but is truncated, and the final part of the string is retained, i.e. the ending "blah blah". This has resulted in SQL queries excluding some criteria - over 3400 characters worth of criteria!
If anyone was to say that this is an ugly way to write SQL queries, I'd agree. And I certainly wouldn't want a single string so long anywhere in my code, but there's a solid chance they could show up in a team environment where a user is less familiar with R and RStudio.
RStudio gives absolutely no indicator or warning that this is done as far as I can tell.
Is there any way to avoid this behavior besides splitting strings or sourcing SQL scripts or text files?

Import data into R - argument is empty

I am trying to use a R package called GOSemSim, it requires to import a lot of data into variables with a specific format like this:
data1 = c("one", "two", "three")
data2 = c("A", "B", "C")
When the list of data that I try to import into a variable is longer than 293 then I get the following error message:
argument 293 is empty
THere are no error with the "" or comma, I computed it with linux, it does not matter what data it is.
This is really weird basically, I tried on two computers with no luck. I tried to import it as a CSV file but the R package won't allow it.
Anyone knows why you cannot import more than 293 data?
Update:
Here is the code and my data at the same time, it is a one liner in R which has never been a problem for me!
OQ = c("GO:0000003", "GO:0000070", "GO:0000077", "GO:0000079", "GO:0000082", "GO:0000086", "GO:0000122", "GO:0000212", "GO:0000226", "GO:0000278", "GO:0000279", "GO:0000280", "GO:0000724", "GO:0000725", "GO:0000819", "GO:0000910", "GO:0001932", "GO:0002118", "GO:0002121", "GO:0002165", "GO:0003002", "GO:0003006", "GO:0006022", "GO:0006030", "GO:0006040", "GO:0006139", "GO:0006259", "GO:0006260", "GO:0006261", "GO:0006267", "GO:0006270", "GO:0006275", "GO:0006277", "GO:0006281", "GO:0006302", "GO:0006304", "GO:0006305", "GO:0006306", "GO:0006310", "GO:0006323", "GO:0006325", "GO:0006342", "GO:0006351", "GO:0006355", "GO:0006357", "GO:0006366", "GO:0006464", "GO:0006468", "GO:0006479", "GO:0006725", "GO:0006807", "GO:0006928", "GO:0006950", "GO:0006974", "GO:0006996", "GO:0007010", "GO:0007017", "GO:0007018", "GO:0007049", "GO:0007051", "GO:0007059", "GO:0007062", "GO:0007067", "GO:0007076", "GO:0007088", "GO:0007093", "GO:0007095", "GO:0007098", "GO:0007126", "GO:0007127", "GO:0007131", "GO:0007140", "GO:0007141", "GO:0007143", "GO:0007154", "GO:0007155", "GO:0007156", "GO:0007259", "GO:0007266", "GO:0007275", "GO:0007276", "GO:0007281", "GO:0007282", "GO:0007292", "GO:0007304", "GO:0007307", "GO:0007346", "GO:0007350", "GO:0007365", "GO:0007367", "GO:0007379", "GO:0007389", "GO:0007399", "GO:0007400", "GO:0007417", "GO:0007420", "GO:0007423", "GO:0007444", "GO:0007472", "GO:0007476", "GO:0007552", "GO:0007560", "GO:0008104", "GO:0008213", "GO:0008283", "GO:0008284", "GO:0008315", "GO:0008356", "GO:0009059", "GO:0009611", "GO:0009653", "GO:0009790", "GO:0009791", "GO:0009880", "GO:0009886", "GO:0009887", "GO:0009888", "GO:0009889", "GO:0009890", "GO:0009892", "GO:0009893", "GO:0009896", "GO:0009968", "GO:0009987", "GO:0010032", "GO:0010033", "GO:0010092", "GO:0010389", "GO:0010468", "GO:0010498", "GO:0010556", "GO:0010558", "GO:0010564", "GO:0010604", "GO:0010605", "GO:0010608", "GO:0010629", "GO:0010648", "GO:0010948", "GO:0014016", "GO:0014017", "GO:0014070", "GO:0016043", "GO:0016055", "GO:0016070", "GO:0016310", "GO:0016319", "GO:0016321", "GO:0016441", "GO:0016458", "GO:0016568", "GO:0016569", "GO:0016570", "GO:0016571", "GO:0016572", "GO:0017145", "GO:0018130", "GO:0019219", "GO:0019222", "GO:0019438", "GO:0019827", "GO:0019953", "GO:0022402", "GO:0022403", "GO:0022404", "GO:0022412", "GO:0022414", "GO:0022610", "GO:0023052", "GO:0023057", "GO:0030111", "GO:0030154", "GO:0030178", "GO:0030182", "GO:0030261", "GO:0030422", "GO:0030703", "GO:0030727", "GO:0031023", "GO:0031047", "GO:0031050", "GO:0031056", "GO:0031060", "GO:0031123", "GO:0031145", "GO:0031175", "GO:0031323", "GO:0031324", "GO:0031325", "GO:0031326", "GO:0031327", "GO:0031331", "GO:0031398", "GO:0031399", "GO:0031401", "GO:0031570", "GO:0031572", "GO:0031935", "GO:0032268", "GO:0032270", "GO:0032501", "GO:0032502", "GO:0032504", "GO:0032507", "GO:0032774", "GO:0032776", "GO:0032886", "GO:0033043", "GO:0033044", "GO:0033260", "GO:0033301", "GO:0033554", "GO:0034622", "GO:0034641", "GO:0034645", "GO:0034654", "GO:0034754", "GO:0034968", "GO:0035023", "GO:0035107", "GO:0035114", "GO:0035120", "GO:0035186", "GO:0035194", "GO:0035195", "GO:0035220", "GO:0035282", "GO:0035295", "GO:0035825", "GO:0036211", "GO:0036388", "GO:0040029", "GO:0042060", "GO:0042221", "GO:0042445", "GO:0043009", "GO:0043066", "GO:0043069", "GO:0043161", "GO:0043170", "GO:0043331", "GO:0043412", "GO:0043414", "GO:0043549", "GO:0043631", "GO:0043933", "GO:0044237", "GO:0044249", "GO:0044260", "GO:0044271", "GO:0044419", "GO:0044700", "GO:0044702", "GO:0044703", "GO:0044707", "GO:0044728", "GO:0044763", "GO:0044767", "GO:0044770", "GO:0044771", "GO:0044772", "GO:0044773", "GO:0044774", "GO:0044786", "GO:0044818", "GO:0044839", "GO:0044843", "GO:0044848", "GO:0045132", "GO:0045165", "GO:0045168", "GO:0045185", "GO:0045448", "GO:0045455", "GO:0045787", "GO:0045814", "GO:0045859", "GO:0045892", "GO:0045931", "GO:0045934", "GO:0046331", "GO:0046425", "GO:0046483", "GO:0046580", "GO:0046605", "GO:0046777", "GO:0048070", "GO:0048134", "GO:0048135", "GO:0048285", "GO:0048311", "GO:0048468", "GO:0048477", "GO:0048513", "GO:0048518", "GO:0048519", "GO:0048522", "GO:0048523", "GO:0048563", "GO:0048569", "GO:0048583", "GO:0048585", "GO:0048609", "GO:0048646", "GO:0048666", "GO:0048699", "GO:0048704", "GO:0048705", "GO:0048706", "GO:0048707", "GO:0048731", "GO:0048736", "GO:0048737", "GO:0048754", "GO:0048856", "GO:0048863", "GO:0048865", "GO:0048867", "GO:0048869", "GO:0050789", "GO:0050793", "GO:0050794", "GO:0050896", "GO:0051052", "GO:0051058", "GO:0051128", "GO:0051171", "GO:0051172", "GO:0051225", "GO:0051235", "GO:0051246", "GO:0051247", "GO:0051252", "GO:0051253", "GO:0051276", "GO:0051297", "GO:0051299", "GO:0051301", "GO:0051302", "GO:0051321", "GO:0051325", "GO:0051329", "GO:0051338", "GO:0051351", "GO:0051443", "GO:0051445", "GO:0051641", "GO:0051646", "GO:0051651", "GO:0051704", "GO:0051716", "GO:0051726", "GO:0051783", "GO:0051785", "GO:0060255", "GO:0060429", "GO:0060548", "GO:0060688", "GO:0060966", "GO:0060968", "GO:0060993", "GO:0061138", "GO:0065003", "GO:0065004", "GO:0065007", "GO:0070192", "GO:0070507", "GO:0070887", "GO:0070918", "GO:0071103", "GO:0071359", "GO:0071822", "GO:0071824", "GO:0071840", "GO:0071897", "GO:0071900", "GO:0072028", "GO:0072078", "GO:0072079", "GO:0072088", "GO:0080090", "GO:0090068", "GO:0090304", "GO:0090306", "GO:0098609", "GO:1901071", "GO:1901360", "GO:1901362", "GO:1901576", "GO:1901987", "GO:1901988", "GO:1901990", "GO:1901991", "GO:1902275", "GO:1902299", "GO:1902589", "GO:1902679", "GO:1902749", "GO:1903046", "GO:1903047", "GO:1903308", "GO:1903322", "GO:2000026", "GO:2000112", "GO:2000113", "GO:2001141")
The error message in itself is informative. If one tries to make it reproducible, it's best to work with small subsets. It usually helps to have a dead stare at your data before trying to reproduce the behavior. For example,
OQ = c("GO:0000003", "GO:2001141", )
Notice that there are two elements of this character vector. Or are they?
Error in c("GO:0000003", "GO:2001141", ) : argument 3 is empty
Number 3 is the key. R is expecting three elements. Notice the comma after the second element. Once you remove it, you'll be able to create the QQ variable. Scan your real example. I'm sure there's a , , somewhere.
EDIT
I tried copy/pasting your code into a script in Rstudio and it produced the error you describe. If you scroll right, you'll notice that syntax coloring is not working at around position 5000. I have folded the code so that it fits on screen and it runs fine.
This is how I folded the vector and it worked.
OQ = c("GO:0000003", "GO:0000070", "GO:0000077", "GO:0000079", "GO:0000082", "GO:0000086", "GO:0000122",
"GO:0000212", "GO:0000226", "GO:0000278", "GO:0000279", "GO:0000280", "GO:0000724", "GO:0000725",
"GO:0000819", "GO:0000910", "GO:0001932", "GO:0002118", "GO:0002121", "GO:0002165", "GO:0003002",
"GO:0003006", "GO:0006022", "GO:0006030", "GO:0006040", "GO:0006139", "GO:0006259", "GO:0006260",
"GO:0006261", "GO:0006267", "GO:0006270", "GO:0006275", "GO:0006277", "GO:0006281", "GO:0006302",
"GO:0006304", "GO:0006305", "GO:0006306", "GO:0006310", "GO:0006323", "GO:0006325", "GO:0006342",
"GO:0006351", "GO:0006355", "GO:0006357", "GO:0006366", "GO:0006464", "GO:0006468", "GO:0006479",
"GO:0006725", "GO:0006807", "GO:0006928", "GO:0006950", "GO:0006974", "GO:0006996", "GO:0007010",
"GO:0007017", "GO:0007018", "GO:0007049", "GO:0007051", "GO:0007059", "GO:0007062", "GO:0007067",
"GO:0007076", "GO:0007088", "GO:0007093", "GO:0007095", "GO:0007098", "GO:0007126", "GO:0007127",
"GO:0007131", "GO:0007140", "GO:0007141", "GO:0007143", "GO:0007154", "GO:0007155", "GO:0007156",
"GO:0007259", "GO:0007266", "GO:0007275", "GO:0007276", "GO:0007281", "GO:0007282", "GO:0007292",
"GO:0007304", "GO:0007307", "GO:0007346", "GO:0007350", "GO:0007365", "GO:0007367", "GO:0007379",
"GO:0007389", "GO:0007399", "GO:0007400", "GO:0007417", "GO:0007420", "GO:0007423", "GO:0007444",
"GO:0007472", "GO:0007476", "GO:0007552", "GO:0007560", "GO:0008104", "GO:0008213", "GO:0008283",
"GO:0008284", "GO:0008315", "GO:0008356", "GO:0009059", "GO:0009611", "GO:0009653", "GO:0009790",
"GO:0009791", "GO:0009880", "GO:0009886", "GO:0009887", "GO:0009888", "GO:0009889", "GO:0009890",
"GO:0009892", "GO:0009893", "GO:0009896", "GO:0009968", "GO:0009987", "GO:0010032", "GO:0010033",
"GO:0010092", "GO:0010389", "GO:0010468", "GO:0010498", "GO:0010556", "GO:0010558", "GO:0010564",
"GO:0010604", "GO:0010605", "GO:0010608", "GO:0010629", "GO:0010648", "GO:0010948", "GO:0014016",
"GO:0014017", "GO:0014070", "GO:0016043", "GO:0016055", "GO:0016070", "GO:0016310", "GO:0016319",
"GO:0016321", "GO:0016441", "GO:0016458", "GO:0016568", "GO:0016569", "GO:0016570", "GO:0016571",
"GO:0016572", "GO:0017145", "GO:0018130", "GO:0019219", "GO:0019222", "GO:0019438", "GO:0019827",
"GO:0019953", "GO:0022402", "GO:0022403", "GO:0022404", "GO:0022412", "GO:0022414", "GO:0022610",
"GO:0023052", "GO:0023057", "GO:0030111", "GO:0030154", "GO:0030178", "GO:0030182", "GO:0030261",
"GO:0030422", "GO:0030703", "GO:0030727", "GO:0031023", "GO:0031047", "GO:0031050", "GO:0031056",
"GO:0031060", "GO:0031123", "GO:0031145", "GO:0031175", "GO:0031323", "GO:0031324", "GO:0031325",
"GO:0031326", "GO:0031327", "GO:0031331", "GO:0031398", "GO:0031399", "GO:0031401", "GO:0031570",
"GO:0031572", "GO:0031935", "GO:0032268", "GO:0032270", "GO:0032501", "GO:0032502", "GO:0032504",
"GO:0032507", "GO:0032774", "GO:0032776", "GO:0032886", "GO:0033043", "GO:0033044", "GO:0033260",
"GO:0033301", "GO:0033554", "GO:0034622", "GO:0034641", "GO:0034645", "GO:0034654", "GO:0034754",
"GO:0034968", "GO:0035023", "GO:0035107", "GO:0035114", "GO:0035120", "GO:0035186", "GO:0035194",
"GO:0035195", "GO:0035220", "GO:0035282", "GO:0035295", "GO:0035825", "GO:0036211", "GO:0036388",
"GO:0040029", "GO:0042060", "GO:0042221", "GO:0042445", "GO:0043009", "GO:0043066", "GO:0043069",
"GO:0043161", "GO:0043170", "GO:0043331", "GO:0043412", "GO:0043414", "GO:0043549", "GO:0043631",
"GO:0043933", "GO:0044237", "GO:0044249", "GO:0044260", "GO:0044271", "GO:0044419", "GO:0044700",
"GO:0044702", "GO:0044703", "GO:0044707", "GO:0044728", "GO:0044763", "GO:0044767", "GO:0044770",
"GO:0044771", "GO:0044772", "GO:0044773", "GO:0044774", "GO:0044786", "GO:0044818", "GO:0044839",
"GO:0044843", "GO:0044848", "GO:0045132", "GO:0045165", "GO:0045168", "GO:0045185", "GO:0045448",
"GO:0045455", "GO:0045787", "GO:0045814", "GO:0045859", "GO:0045892", "GO:0045931", "GO:0045934",
"GO:0046331", "GO:0046425", "GO:0046483", "GO:0046580", "GO:0046605", "GO:0046777", "GO:0048070",
"GO:0048134", "GO:0048135", "GO:0048285", "GO:0048311", "GO:0048468", "GO:0048477", "GO:0048513",
"GO:0048518", "GO:0048519", "GO:0048522", "GO:0048523", "GO:0048563", "GO:0048569", "GO:0048583",
"GO:0048585", "GO:0048609", "GO:0048646", "GO:0048666", "GO:0048699", "GO:0048704", "GO:0048705",
"GO:0048706", "GO:0048707", "GO:0048731", "GO:0048736", "GO:0048737", "GO:0048754", "GO:0048856",
"GO:0048863", "GO:0048865", "GO:0048867", "GO:0048869", "GO:0050789", "GO:0050793", "GO:0050794",
"GO:0050896", "GO:0051052", "GO:0051058", "GO:0051128", "GO:0051171", "GO:0051172", "GO:0051225",
"GO:0051235", "GO:0051246", "GO:0051247", "GO:0051252", "GO:0051253", "GO:0051276", "GO:0051297",
"GO:0051299", "GO:0051301", "GO:0051302", "GO:0051321", "GO:0051325", "GO:0051329", "GO:0051338",
"GO:0051351", "GO:0051443", "GO:0051445", "GO:0051641", "GO:0051646", "GO:0051651", "GO:0051704",
"GO:0051716", "GO:0051726", "GO:0051783", "GO:0051785", "GO:0060255", "GO:0060429", "GO:0060548",
"GO:0060688", "GO:0060966", "GO:0060968", "GO:0060993", "GO:0061138", "GO:0065003", "GO:0065004",
"GO:0065007", "GO:0070192", "GO:0070507", "GO:0070887", "GO:0070918", "GO:0071103", "GO:0071359",
"GO:0071822", "GO:0071824", "GO:0071840", "GO:0071897", "GO:0071900", "GO:0072028", "GO:0072078",
"GO:0072079", "GO:0072088", "GO:0080090", "GO:0090068", "GO:0090304", "GO:0090306", "GO:0098609",
"GO:1901071", "GO:1901360", "GO:1901362", "GO:1901576", "GO:1901987", "GO:1901988", "GO:1901990",
"GO:1901991", "GO:1902275", "GO:1902299", "GO:1902589", "GO:1902679", "GO:1902749", "GO:1903046",
"GO:1903047", "GO:1903308", "GO:1903322", "GO:2000026", "GO:2000112", "GO:2000113", "GO:2001141")

xQuery category nesting issue

I have a problem nesting the result tags in each other the right way.
The result should look like this:
aimed result
<categoryA>
<position>...</position>
<position>...</position>
...
</categoryA>
<categoryB>
<position>...</position>
<position>...</position>
...
</categoryB>
currently I have only managed to get the right results for the positions, the categoryA and B are 1 hierarchic layer higher than the positions. the positions should be nested in the categories. The categories can be referenced by let $y := $d/Bilanz/Aktiva/* (respectively $d$d/Bilanz/Aktiva/LangfristigesVermoegen and $d$d/Bilanz/Aktiva/KurzfristigesVermoegen).
Here is my query:
query
let $d := doc('http://etutor.dke.uni-linz.ac.at/etutor/XML?id=5001')/Bilanzen
let $a02 := $d/Bilanz[#jahr='2002']/Aktiva/*
let $a03 := $d/Bilanz[#jahr='2003']/Aktiva/*
for $n02 in $a02//* , $n03 in $a03//*
(:
where name($n02) = name($n03)
where node-name($n02) = node-name($n03)
:)
where name($n02) = name($n03)
return <position name="{node-name($n02)}">
<j2002>{data($n02/#summe)}</j2002>
<j2003>{data($n03/#summe)}</j2003>
<diff>{data($n03/#summe) - data($n02/#summe)}</diff>
</position>
xml
<Bilanzen>
<Bilanz jahr="2002">
<Aktiva>
<LangfristigesVermoegen>
<Sachanlagen summe="1486575.8"/>
<ImmateriellesVermoegen summe="67767.2"/>
<AssoziierteUnternehmen summe="190826.3"/>
<AndereBeteiligungen summe="507692.7"/>
<Uebrige summe="92916.4"/>
</LangfristigesVermoegen>
<KurzfristigesVermoegen>
<Vorraete summe="78830.9"/>
<Forderungen summe="198210.3"/>
<Finanzmittel summe="181102.0"/>
</KurzfristigesVermoegen>
</Aktiva>
<Passiva>
<Eigenkapital>
<Grundkapital summe="91072.4"/>
<Kapitalruecklagen summe="186789.5"/>
<Gewinnruecklagen summe="798176.2"/>
<Bewertungsruecklagen summe="-34922.4"/>
<Waehrungsumrechnung summe="0"/>
<EigeneAktien summe="0"/>
</Eigenkapital>
<AnteileGesellschafter summe="23613.1"/>
<LangfristigeVerb>
<Finanzverbindlichkeiten summe="680007.1"/>
<Steuern summe="36555.8"/>
<Rueckstellungen summe="429286.1"/>
<Baukostenzuschuesse summe="169246.0"/>
<Uebrige summe="36166.9"/>
</LangfristigeVerb>
<KurzfristigeVerb>
<Finanzverbindlichkeiten summe="14614.6"/>
<Steuern summe="65247.6"/>
<Lieferanten summe="94939.2"/>
<Rueckstellungen summe="123664.8"/>
<Uebrige summe="89464.8"/>
</KurzfristigeVerb>
</Passiva>
</Bilanz>
<Bilanz jahr="2003">
<Aktiva>
<LangfristigesVermoegen>
<Sachanlagen summe="1590313.7"/>
<ImmateriellesVermoegen summe="69693.2"/>
<AssoziierteUnternehmen summe="198224.7"/>
<AndereBeteiligungen summe="418489.3"/>
<Uebrige summe="104566.7"/>
</LangfristigesVermoegen>
<KurzfristigesVermoegen>
<Vorraete summe="20609.8"/>
<Forderungen summe="289458.5"/>
<Finanzmittel summe="302445.9"/>
</KurzfristigesVermoegen>
</Aktiva>
<Passiva>
<Eigenkapital>
<Grundkapital summe="91072.4"/>
<Kapitalruecklagen summe="186789.5"/>
<Gewinnruecklagen summe="875723.4"/>
<Bewertungsruecklagen summe="-15459.5"/>
<Waehrungsumrechnung summe="-633.7"/>
<EigeneAktien summe="0"/>
</Eigenkapital>
<AnteileGesellschafter summe="22669.8"/>
<LangfristigeVerb>
<Finanzverbindlichkeiten summe="733990.2"/>
<Steuern summe="68156.8"/>
<Rueckstellungen summe="395997.2"/>
<Baukostenzuschuesse summe="177338.5"/>
<Uebrige summe="38064.9"/>
</LangfristigeVerb>
<KurzfristigeVerb>
<Finanzverbindlichkeiten summe="6634.7"/>
<Steuern summe="97119.1"/>
<Lieferanten summe="89606.0"/>
<Rueckstellungen summe="128237.5"/>
<Uebrige summe="98495.2"/>
</KurzfristigeVerb>
</Passiva>
</Bilanz>
</Bilanzen>
I would really appreciate some help, i have no clue at all. Thank you.
If I understand you correctly, you want the information about LangfristigesVermoegen (and its children) to be grouped in the output under element categoryA, and the information about Kurzfristigesvermoegen to be grouped under categoryB.
So you will want first of all to do something to generate the categoryA and categoryB elements. For example,
let $d := doc(...)/Bilanzen
return (
<categoryA>{ ... children of category A here ... }</categoryA>,
<categoryB>{ ... children of category B here ... }</categoryB>
)
The positions in each category can be generated using code similar to what you've now got, except that instead of iterating over
for $n02 in $a02//* , $n03 in $a03//*
you will need to iterate over $a02[self::LangfristigesVermoegen]/* for category A, and over $a02[self::KurzfristigesVermoegen]/* for category B (and similarly, of course, for $n02 and $n03).
If the set of categories is not static and you just want to group things in the output using the same grouping elements present in the input, then you'll want an outer structure something like this:
for $assetclass1 in $anno2002/*
let $assetclass2 := $anno2003/*[name() = name($assetclass1)]
return
(element {name($assetclass1)} {
for $old in $assetclass1/*,
$new in $assetclass2/*
where name($old) eq name($new)
return <position name="{node-name($old)}">
<j2002>{data($old/#summe)}</j2002>
<j2003>{data($new/#summe)}</j2003>
<diff>{data($new/#summe) - data($old/#summe)}</diff>
</position>
})

Resources