Skip to content

Commit e51fe4f

Browse files
committed
added cfgPrintOn,Off and getVersion
1 parent f749075 commit e51fe4f

File tree

13 files changed

+46
-11
lines changed

13 files changed

+46
-11
lines changed

dist/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" crossorigin="anonymous">
7+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css" rel="stylesheet">
88
<link rel="stylesheet" href="style.css" />
99
<title>Reacto Test</title>
1010
</head>
@@ -31,10 +31,12 @@ <h1>Reacto Tester</h1>
3131
<h2>Examples</h2>
3232
<pre>
3333
Today is =>
34+
((r.cfg.printOff)) # TURN OFF PRINTING
3435
English: ((r.cfg.setLocale.en))((r.dt.day))
3536
Bengali: ((r.cfg.setLocale.bn))((r.dt.day))
3637
Bhojpuri: ((r.cfg.setLocale.bh))((r.dt.day))
3738
Hindi: ((r.cfg.setLocale.hi))((r.dt.day))
39+
((r.cfg.printOn)) # TURN ON PRINTING
3840
Assammese: ((r.cfg.setLocale.as))((r.dt.day))
3941
Gujrati: ((r.cfg.setLocale.gu))((r.dt.day))
4042
Marathi: ((r.cfg.setLocale.mr))((r.dt.day))

dist/reacto.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"scripts": {
77
"watch": "webpack --watch",
8-
"build": "jest && webpack",
8+
"build": "tsc || (jest && webpack)",
99
"test": "jest --watch",
1010
"coverage": "jest --coverage"
1111
},

src/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
It can contain single "(" and ")"
1414
It can contain "( (", i.e. double ( with space in between
1515
*/
16+
const version='1.0.9'
17+
1618
import { _preReplaceBlocks } from './modules/blocks';
1719
import { _findAndProcessReactos } from './modules/processor';
1820
import { _eatUnwantedNL } from './modules/util';
@@ -36,6 +38,7 @@ function _startProcessing(rTxt: string) {
3638
}
3739
// @ts-ignore
3840
window.rto = {
41+
getVersion: () => version,
3942
process,
4043
addFn,
4144
getFnList,

src/modules/constants.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/constants.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
2+
export const days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']
3+
4+
// All internal variable
5+
// Start with triple underscore
6+
export const VAR_IS_PRINT_OFF = '___isPrintOff'

src/modules/interpreters/cfg.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@
66
*/
77
import { _startsWith } from '../util'
88
import { setCurrentLocale } from '../locale'
9+
import { _setVar } from './var'
10+
11+
import { VAR_IS_PRINT_OFF } from '../constants'
912

1013
function _interpret_cfg (token) {
1114
// (r.cfg.setLocale.en) => Changes rto.currentLang
1215
if (_startsWith(token, 'setLocale')) {
1316
var langCode = token.replace('setLocale.', '').trim(); // remove 'setLocale.'
1417
setCurrentLocale(langCode);
1518
}
16-
19+
else if (token === 'printOff') {
20+
_setVar(VAR_IS_PRINT_OFF, 'YES')
21+
}
22+
else if (token === 'printOn') {
23+
_setVar(VAR_IS_PRINT_OFF, 'NO')
24+
}
1725
return '';
1826
}
1927

0 commit comments

Comments
 (0)