Skip to content

Commit 39cd871

Browse files
committed
Minor changes
1 parent 152c901 commit 39cd871

File tree

10 files changed

+101
-57
lines changed

10 files changed

+101
-57
lines changed

javascript/web/src/classes/Files.js

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default class Files {
2424

2525
async get_files() {
2626
let files = await this.filesystem.file.get_all()
27-
printf( "files -> ", files )
2827
this.list = files
2928
}
3029

javascript/web/src/classes/Markdown.js

+46-4
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export default class Markdown {
200200
}
201201
*/
202202

203-
let ref = ilse.utils.get_note_reference( match[0] )
203+
let ref = ilse.notes.get_references( match[0] )
204204

205205
// printf( "note_ref -> match -> ", ref )
206206
if( !ref ) return `<span class="note-reference" > ((MALFORMED REF)) </span>`
@@ -260,13 +260,10 @@ export default class Markdown {
260260
function( match, utils ) {
261261

262262
let content = match[0]
263-
printf( "content -> ", content )
264263
return `<span class="blockquote" title="${content}" > AAAA ${content} </span>`
265264
}
266265
)
267266

268-
this.plugins.push( inline_code )
269-
270267
this.after_setup()
271268
}
272269

@@ -284,6 +281,51 @@ export default class Markdown {
284281
this.md = md
285282
}
286283

284+
// Removed resolved, have only last
285+
reference( text, last = "" ) {
286+
287+
let link = ilse.notes.get_references( text )
288+
if( !link ) return `${last} \n\t ${text} `
289+
290+
let link_content = ilse.notes.query( link + ":")[0].content
291+
292+
if( link ) {
293+
if( last ) {
294+
last += `\n ${link_content}`
295+
} else {
296+
last += `${text} \n ${link_content} `
297+
}
298+
}
299+
300+
let target = ilse.notes.get_references( link_content )
301+
302+
if( target ) {
303+
let target_content = ilse.notes.query( target + ":")[0].content
304+
return this.reference( target_content, last )
305+
} else {
306+
return last
307+
}
308+
309+
}
310+
311+
get_blockquote( content ) {
312+
313+
// === Refs === //
314+
let text = this.reference( content )
315+
let chunks = text.split("\n")
316+
317+
let final = "<blockquote>"
318+
for( const [index, chunk] of chunks.entries() ) {
319+
if( index === 0 ) {
320+
final += `<p> ${chunk} </p>`
321+
} else {
322+
final += `<blockquote style="margin-left: ${index * 10}px"> ${chunk} </blockquote>`
323+
}
324+
}
325+
final += "</blockquote>"
326+
return final
327+
}
328+
287329
render( string ) {
288330
return this.md.render( string )
289331
}

javascript/web/src/classes/Notes.js

+21
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,27 @@ export default class Notes {
297297
}
298298
}
299299

300+
get_references( string ) {
301+
302+
let chunks = string.split(" ")
303+
let has_opening_parenthesis
304+
let has_closing_parenthesis
305+
let has_both
306+
let ref
307+
308+
for( const chunk of chunks ) {
309+
310+
has_opening_parenthesis = chunk.indexOf( "((" ) !== -1
311+
has_closing_parenthesis = chunk.indexOf( "))" ) !== -1
312+
313+
has_both = has_opening_parenthesis && has_closing_parenthesis
314+
if( has_both ) ref = chunk.replace( " ", "" ).replace( "((", "" ).replace( "))", "" )
315+
316+
}
317+
318+
return ref
319+
}
320+
300321
listen() {
301322

302323
Messager.on( "~ilse", async (action, payload) => {

javascript/web/src/classes/Utils.js

-23
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,6 @@ export default class Utils {
107107

108108
};
109109

110-
111-
get_note_reference( string ) {
112-
113-
let chunks = string.split(" ")
114-
let has_opening_parenthesis
115-
let has_closing_parenthesis
116-
let has_both
117-
let ref
118-
119-
for( const chunk of chunks ) {
120-
121-
has_opening_parenthesis = chunk.indexOf( "((" ) !== -1
122-
has_closing_parenthesis = chunk.indexOf( "))" ) !== -1
123-
124-
has_both = has_opening_parenthesis && has_closing_parenthesis
125-
if( has_both ) ref = chunk.replace( " ", "" ).replace( "((", "" ).replace( "))", "" )
126-
127-
}
128-
129-
return ref
130-
131-
}
132-
133110
move_array(arr, old_index, new_index) {
134111

135112
if( new_index >= arr.length ) {

javascript/web/src/components/Note.vue

+24-22
Original file line numberDiff line numberDiff line change
@@ -237,31 +237,33 @@ export default {
237237
// Empty note
238238
if( !inote.content ) return " "
239239
240-
// === note Ref === //
241-
// let has_right_parenthesis = inote.content.indexOf("))") !== -1
242-
// let has_left_parenthesis = inote.content.indexOf("((") !== -1
243-
// let has_both = has_left_parenthesis && has_right_parenthesis
240+
// === no Ref === //
241+
let ref = ilse.notes.get_references( inote.content ) // TODO: Make this a notes function
242+
if( !ref ) return ilse.markdown.render( inote.content ) // No note references, normal markdown.
244243
245-
let ref = ilse.utils.get_note_reference( inote.content )
244+
// === Refs === //
246245
247-
// No note references, normal markdown.
248-
if( !ref ) return ilse.markdown.render( inote.content )
246+
let html = ilse.markdown.get_blockquote( inote.content )
247+
printf( "html -> ", html )
248+
return html
249249
250-
// The content has references
251-
let notes = ilse.notes.query( ref )
252-
let final = inote.content + "\n\t"
253-
for( const note of notes ) {
254-
255-
if( !note ) {
256-
final += `\n > ERROR: Could not find note: ${ref} `
250+
/*
251+
let text = ilse.notes.reference( inote.content )
252+
let chunks = text.split("\n")
253+
254+
printf( "chunks -> ", chunks )
255+
let final = "<blockquote>"
256+
for( const [index, chunk] of chunks.entries() ) {
257+
if( index === 0 ) {
258+
final += `<p> ${chunk} </p>`
257259
} else {
258-
final += `\n > ${note.content} `
260+
final += `<blockquote style="margin-left: ${index * 10}px"> ${chunk} </blockquote>`
259261
}
260-
261262
}
262-
263-
return ilse.markdown.render( final )
264-
263+
final += "</blockquote>"
264+
return final
265+
return ilse.markdown.render( text )
266+
*/
265267
},
266268
267269
on_focus( event, inote ) {
@@ -540,13 +542,12 @@ export default {
540542
}
541543
542544
.paragraph-note {
543-
margin-right: 8px;
544-
margin-top: 2px;
545+
margin-top: -5px;
545546
text-align: center;
546547
cursor: pointer;
547548
color: #a3a3a3;
548549
color: var(--text-color);
549-
font-size: 12px;
550+
font-size: 24px;
550551
}
551552
552553
.link {
@@ -626,6 +627,7 @@ blockquote {
626627
border-left: 4px solid var( --text-color );
627628
color: var( --text-color );
628629
background: var( --background-color );
630+
margin-left: auto;
629631
}
630632
631633
code {

javascript/web/src/components/References.vue

-5
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ export default {
4949
let file = payload.link
5050
let event = payload.event
5151
let is_shift = event.shiftKey
52-
printf( "is_shift -> ", is_shift )
5352
let is_ctrl = event.ctrlKey
54-
printf( "is_ctrl -> ", is_ctrl )
5553
5654
let is_file_markdown = !(file.indexOf(".mp4") !== -1 || file.indexOf(".png") !== -1 || file.indexOf(".jpg") !== -1 || file.indexOf(".jpeg") !== -1 || file.indexOf(".gif") !== -1 || file.indexOf(".svg") !== -1 || file.indexOf(".mp4") !== -1 || file.indexOf(".webm") !== -1 || file.indexOf(".mp3") !== -1 || file.indexOf(".ogg") !== -1 || file.indexOf(".wav") !== -1)
5755
if( is_file_markdown ) file += ".md"
@@ -83,9 +81,6 @@ export default {
8381
if( !file ) return null
8482
8583
this.refs = ilse.links.links[ file ]
86-
printf( "ilse.links.links -> ", ilse.links.links )
87-
printf( "file -> ", file )
88-
printf( "this.refs -> ", this.refs )
8984
9085
return this.refs
9186
},

lisp/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
out.exe

lisp/build.lisp

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+
(load "main.lisp")

lisp/hello-world.lisp

+2
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,5 @@
148148
nil))
149149
(gtk-container-add window button)
150150
(gtk-widget-show-all window))))
151+
152+
(app.run)

lisp/main.lisp

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
(load "hello-world.lisp")
66

77
(defun main()
8-
(try-gtk-exampl:app.run)
8+
(try-gtk-example:app.run)
99
)
1010

11-
(main)
11+
; (sb-ext:save-lisp-and-die "out.exe" :toplevel #'main :executable t)
12+
; (main)
13+

0 commit comments

Comments
 (0)