import { gMainApp, gEventBus, gContentDocs } from "./MainApp.js" ; import { fixupSearchHilites } from "./utils.js" ; // -------------------------------------------------------------------- gMainApp.component( "index-sr", { props: [ "sr" ], template: `
`, computed: { makeSeeAlso() { if ( this.sr.see_also ) return "See also: " + this.sr.see_also.join( ", " ) ; return null ; }, }, methods: { fixupHilites( val ) { return fixupSearchHilites( val ) ; }, }, } ) ; // -------------------------------------------------------------------- gMainApp.component( "ruleid", { props: [ "docId", "ruleId" ], data() { return { target: null, } ; }, template: `[{{ruleId}}{{ruleId}}]`, created() { // figure out which rule is being referenced let ruleId = this.ruleId ; let pos = ruleId.indexOf( "-" ) ; if ( pos >= 0 ) { // NOTE: For ruleid's of the form "A12.3-.4", we want to target "A12.3". ruleId = ruleId.substring( 0, pos ) ; } // check if the rule is one we know about if ( gContentDocs[this.docId] && gContentDocs[this.docId].targets ) { if ( gContentDocs[this.docId].targets[ ruleId ] ) this.target = ruleId ; } }, methods: { onClick() { // show the target gEventBus.emit( "show-target", this.docId, this.target ) ; }, }, } ) ;