changed: remove empty entries in journal
This commit is contained in:
		
							parent
							
								
									d6a04cbcb8
								
							
						
					
					
						commit
						71a0f3cac2
					
				
							
								
								
									
										6
									
								
								main.js
								
								
								
								
							
							
						
						
									
										6
									
								
								main.js
								
								
								
								
							| 
						 | 
					@ -3016,9 +3016,13 @@ function loadnote(name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (gettags(note).includes("journal"))
 | 
						if (gettags(note).includes("journal"))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							// remove empty entries
 | 
				
			||||||
 | 
							note.content = note.content.replace(/\d{4}-\d{2}-\d{2}\n*(\d{4}-\d{2}-\d{2})/g, "$1");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// create new entry for today
 | 
				
			||||||
		var hat = headerandtext(note);
 | 
							var hat = headerandtext(note);
 | 
				
			||||||
		var today = timestamp().substr(0,10);
 | 
							var today = timestamp().substr(0,10);
 | 
				
			||||||
		if (!hat.text.startsWith("\n" + today))
 | 
							if (!hat.text.startsWith(today) && !hat.text.startsWith("\n" + today))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			note.content = hat.header + "\n" + today + "\n\n" + hat.text;
 | 
								note.content = hat.header + "\n" + today + "\n\n" + hat.text;
 | 
				
			||||||
			note.pos = hat.header.length + 12;
 | 
								note.pos = hat.header.length + 12;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue