aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/components
diff options
context:
space:
mode:
authoralexwl <alexey.a.kiryushin@gmail.com>2019-01-28 17:41:23 +0300
committeralexwl <alexey.a.kiryushin@gmail.com>2019-01-28 17:41:23 +0300
commitb796d370c6b7ec7452a37440b089fd45853a47f4 (patch)
treeefb5c10da18484ede45f42ed208db1e709d4009f /javascript/app/components
parent0f84e1f004e29663b51e550d5bf7abe6188d3dca (diff)
Add links to Haskell language extensions docs
Diffstat (limited to 'javascript/app/components')
-rw-r--r--javascript/app/components/haskell-module.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/javascript/app/components/haskell-module.js b/javascript/app/components/haskell-module.js
index a509c58..ee3f7f3 100644
--- a/javascript/app/components/haskell-module.js
+++ b/javascript/app/components/haskell-module.js
@@ -1,6 +1,7 @@
import Ember from 'ember';
import {goToDefinition} from '../utils/go-to-definition';
import {initializeLineSelection} from '../utils/line-selection';
+import {addLinksToLanguageExtensionsDocs} from '../utils/language-extensions';
function compareLocations (p1,p2) {
if(p1.line === p2.line) {
@@ -472,8 +473,24 @@ export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
const sourceCodeContainerElement = this.element.querySelector('.source-code-container');
- sourceCodeContainerElement.innerHTML = this.get('html');
+ sourceCodeContainerElement.innerHTML = this.get('html');
this.sourceCodeContainerElement = sourceCodeContainerElement;
+
+ // Add links to Haskell language extensions docs
+ const lines = this.sourceCodeContainerElement.querySelectorAll("tr > td:nth-child(2)");
+ const lineCount = lines.length;
+ let i = 0;
+ while(i < lineCount) {
+ let line = lines.item(i);
+ // A file-header pragma must precede the module keyword in the file.
+ if(line.innerText.indexOf("module ") === 0) {
+ break;
+ } else {
+ line.innerHTML = addLinksToLanguageExtensionsDocs(line.innerText);
+ i = i + 1;
+ }
+ }
+
this.element.parentNode.scrollTop = 0;
const declarations = this.element.querySelector('.declarations-content');
this.set('query','');