Commit 17597a82 authored by Matthieu Le Corre's avatar Matthieu Le Corre
Browse files
parent 87ff7cf8
......@@ -21,8 +21,8 @@
return [
'routes' => [
[ 'name' => 'config#getConfig', url => '/config', verb => 'GET' ],
[ 'name' => 'config#setConfig', url => '/config', verb => 'POST' ]
[ 'name' => 'config#getConfig', 'url' => '/config', 'verb' => 'GET' ],
[ 'name' => 'config#setConfig', 'url' => '/config', 'verb' => 'POST' ]
]
];
\ No newline at end of file
];
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=282)}({282:function(e,t){
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=284)}({284:function(e,t){
/**
* @author Matthieu Le Corre <matthieu.lecorre@univ-nantes.fr>
*
......
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/config.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","$","document","ready","click","Event","post","OC","generateUrl","target","checked","success","json","console","log"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAAU,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAzB,EAAA6B,EAAA,SAAA1B,GACA,IAAAS,EAAAT,KAAAqB,WACA,WAA2B,OAAArB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD/B,EAAAkC,EAAA,GAIAlC,IAAAmC,EAAA;;;;;;;;;;;;;;;;;;;;AC9DAC,EAAAC,UAAAC,MAAA,WAEAF,EAAA,4BAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,aAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,GACAC,QAAAC,IAAAF,OAIAX,EAAA,8BAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,cAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,GACAC,QAAAC,IAAAF","file":"config.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 282);\n","/**\n * @author Matthieu Le Corre <matthieu.lecorre@univ-nantes.fr>\n *\n * @license GNU AGPL version 3 or any later version\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n $(document).ready(function () {\n\n $(\"#readmeMD-appearance-txt\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_title\", value: Event.target.checked})\n .success(function (json) {\n console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-appearance-color\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"yellow_back\", value: Event.target.checked})\n .success(function (json) {\n console.log(json) ;\n })\n }) ;\n\n }) ;"],"sourceRoot":""}
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/config.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","$","document","ready","click","Event","post","OC","generateUrl","target","checked","success","json","console","log"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA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K,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,aAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,GACAC,QAAAC,IAAAF,OAIAX,EAAA,8BAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,cAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,GACAC,QAAAC,IAAAF","file":"config.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 284);\n","/**\n * @author Matthieu Le Corre <matthieu.lecorre@univ-nantes.fr>\n *\n * @license GNU AGPL version 3 or any later version\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n $(document).ready(function () {\n\n $(\"#readmeMD-appearance-txt\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_title\", value: Event.target.checked})\n .success(function (json) {\n console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-appearance-color\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"yellow_back\", value: Event.target.checked})\n .success(function (json) {\n console.log(json) ;\n })\n }) ;\n\n }) ;"],"sourceRoot":""}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -12,6 +12,7 @@
"watch": "NODE_ENV=none webpack --progress --watch --config webpack.dev.js "
},
"dependencies": {
"asciidoctor": "^2.0.3",
"github-markdown-css": "^3.0.1",
"markdown-it": "^8.4.2",
"markdown-it-highlightjs": "^3.0.0",
......@@ -22,7 +23,7 @@
"devDependencies": {
"css-loader": "^2.1.1",
"style-loader": "^0.23.1",
"webpack": "^4.33.0",
"webpack": "^4.34.0",
"webpack-cli": "^3.3.4"
}
}
......@@ -73,11 +73,11 @@ OCA.ReadmeMD.App = {
// this is a different for search as we doesn't toogle on hide but on show
//hideContainerOnShowObserver.observe($('div.nofilterresults')[0],{attributes: true }) ;
hideContainerOnShowObserver.observe($('#searchresults')[0],{attributes: true}) ;
// this one is for mindmap or all other "fullscreen" apps
hideContainerOnHideObserver.observe($('#filestable')[0],{attributes: true }) ;
} ;
// this one is for mindmap or all other "fullscreen" apps
hideContainerOnHideObserver.observe($('#filestable')[0],{attributes: true }) ;
},
/**
......@@ -233,44 +233,58 @@ OCA.ReadmeMD.App = {
.done(function(data) {
//promise solved -> render MarkDown
zone.content=data ;
self.renderMD(zone) ;
self.render(zone) ;
}) ;
},
/**
* Render Markdown
**/
renderMD: function(zone) {
//render MD
var self = this ;
var md = require('markdown-it') ;
var converter = md({
replaceLink: function(link,env){
if ( link.startsWith('http://') || link.startsWith('https://') ) {
return link ;
} else {
if (self.mode == 'public') {
var token = $('#sharingToken').val()
var dir = OCA.Sharing.PublicApp.fileList._currentDirectory ;
return OC.generateUrl('/s/{token}/download?path={path}&files={file}', {token: token, path: dir, file: link}) ;
} else {
var dir = OCA.Files.App.fileList._currentDirectory ;
return OC.linkToRemoteBase('files') + dir + '/' + link ;
} ;
render: function(zone) {
//render MD
var self = this ;
// check which engine to run
var ext = zone.filename.substr(zone.filename.lastIndexOf(".") + 1) ;
if (ext == "adoc" ) {
var asciidoctor = require("asciidoctor") ;
var Aconverter = asciidoctor() ;
zone.container.html(Aconverter.convert(zone.content)) ;
$("#filestable > tfoot > tr").height("auto") ;
} ;
if (ext == "md" || ext == "markdown") {
var md = require('markdown-it') ;
var converter = md({
replaceLink: function(link,env){
if ( link.startsWith('http://') || link.startsWith('https://') ) {
return link ;
} else {
if (self.mode == 'public') {
var token = $('#sharingToken').val()
var dir = OCA.Sharing.PublicApp.fileList._currentDirectory ;
return OC.generateUrl('/s/{token}/download?path={path}&files={file}', {token: token, path: dir, file: link}) ;
} else {
var dir = OCA.Files.App.fileList._currentDirectory ;
return OC.linkToRemoteBase('files') + dir + '/' + link ;
} ;
}
}
}
})
.use(require('markdown-it-task-lists'), {enabled: true} )
.use(require('markdown-it-highlightjs'))
.use(require('markdown-it-replace-link'))
.use(require('markdown-it-imsize'))
zone.container.html(converter.render(zone.content)) ;
$("#filestable > tfoot > tr").height("auto") ;
})
.use(require('markdown-it-task-lists'), {enabled: true} )
.use(require('markdown-it-highlightjs'))
.use(require('markdown-it-replace-link'))
.use(require('markdown-it-imsize'))
zone.container.html(converter.render(zone.content)) ;
$("#filestable > tfoot > tr").height("auto") ;
};
},
};
......@@ -296,7 +310,8 @@ $(document).ready(function () {
"HEADER.md",
"HEADER.markdown",
".HEADER.md",
".HEADER.markdown"
".HEADER.markdown",
"HEADER.adoc"
],
content : null
} ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment